| 1 |
(function(react_dom, 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 |
react_dom = __toESM(react_dom); |
| 57 |
let react$1 = __toESM(react, 1); |
| 58 |
react = __toESM(react); |
| 59 |
_elementor_ui_TextField = __toESM(_elementor_ui_TextField); |
| 60 |
|
| 61 |
//#region node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js |
| 62 |
function _objectWithoutPropertiesLoose$1(r, e) { |
| 63 |
if (null == r) return {}; |
| 64 |
var t = {}; |
| 65 |
for (var n in r) if ({}.hasOwnProperty.call(r, n)) { |
| 66 |
if (-1 !== e.indexOf(n)) continue; |
| 67 |
t[n] = r[n]; |
| 68 |
} |
| 69 |
return t; |
| 70 |
} |
| 71 |
var init_objectWithoutPropertiesLoose$1 = __esmMin((() => { |
| 72 |
__name(_objectWithoutPropertiesLoose$1, "_objectWithoutPropertiesLoose"); |
| 73 |
})); |
| 74 |
|
| 75 |
//#endregion |
| 76 |
//#region node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js |
| 77 |
function _objectWithoutProperties$1(e, t) { |
| 78 |
if (null == e) return {}; |
| 79 |
var o; |
| 80 |
var r; |
| 81 |
var i = _objectWithoutPropertiesLoose$1(e, t); |
| 82 |
if (Object.getOwnPropertySymbols) { |
| 83 |
var n = Object.getOwnPropertySymbols(e); |
| 84 |
for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); |
| 85 |
} |
| 86 |
return i; |
| 87 |
} |
| 88 |
var init_objectWithoutProperties$1 = __esmMin((() => { |
| 89 |
init_objectWithoutPropertiesLoose$1(); |
| 90 |
__name(_objectWithoutProperties$1, "_objectWithoutProperties"); |
| 91 |
})); |
| 92 |
|
| 93 |
//#endregion |
| 94 |
//#region node_modules/@babel/runtime/helpers/esm/typeof.js |
| 95 |
function _typeof$1(o) { |
| 96 |
"@babel/helpers - typeof"; |
| 97 |
return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) { |
| 98 |
return typeof o; |
| 99 |
} : function(o) { |
| 100 |
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; |
| 101 |
}, _typeof$1(o); |
| 102 |
} |
| 103 |
var init_typeof$1 = __esmMin((() => { |
| 104 |
__name(_typeof$1, "_typeof"); |
| 105 |
})); |
| 106 |
|
| 107 |
//#endregion |
| 108 |
//#region node_modules/@babel/runtime/helpers/esm/toPrimitive.js |
| 109 |
function toPrimitive$1(t, r) { |
| 110 |
if ("object" != _typeof$1(t) || !t) return t; |
| 111 |
var e = t[Symbol.toPrimitive]; |
| 112 |
if (void 0 !== e) { |
| 113 |
var i = e.call(t, r || "default"); |
| 114 |
if ("object" != _typeof$1(i)) return i; |
| 115 |
throw new TypeError("@@toPrimitive must return a primitive value."); |
| 116 |
} |
| 117 |
return ("string" === r ? String : Number)(t); |
| 118 |
} |
| 119 |
var init_toPrimitive$1 = __esmMin((() => { |
| 120 |
init_typeof$1(); |
| 121 |
__name(toPrimitive$1, "toPrimitive"); |
| 122 |
})); |
| 123 |
|
| 124 |
//#endregion |
| 125 |
//#region node_modules/@babel/runtime/helpers/esm/toPropertyKey.js |
| 126 |
function toPropertyKey$1(t) { |
| 127 |
var i = toPrimitive$1(t, "string"); |
| 128 |
return "symbol" == _typeof$1(i) ? i : i + ""; |
| 129 |
} |
| 130 |
var init_toPropertyKey$1 = __esmMin((() => { |
| 131 |
init_typeof$1(); |
| 132 |
init_toPrimitive$1(); |
| 133 |
__name(toPropertyKey$1, "toPropertyKey"); |
| 134 |
})); |
| 135 |
|
| 136 |
//#endregion |
| 137 |
//#region node_modules/@babel/runtime/helpers/esm/defineProperty.js |
| 138 |
function _defineProperty$1(e, r, t) { |
| 139 |
return (r = toPropertyKey$1(r)) in e ? Object.defineProperty(e, r, { |
| 140 |
value: t, |
| 141 |
enumerable: !0, |
| 142 |
configurable: !0, |
| 143 |
writable: !0 |
| 144 |
}) : e[r] = t, e; |
| 145 |
} |
| 146 |
var init_defineProperty$1 = __esmMin((() => { |
| 147 |
init_toPropertyKey$1(); |
| 148 |
__name(_defineProperty$1, "_defineProperty"); |
| 149 |
})); |
| 150 |
|
| 151 |
//#endregion |
| 152 |
//#region node_modules/@babel/runtime/helpers/esm/classCallCheck.js |
| 153 |
init_objectWithoutProperties$1(); |
| 154 |
init_defineProperty$1(); |
| 155 |
function _classCallCheck(a, n) { |
| 156 |
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); |
| 157 |
} |
| 158 |
|
| 159 |
//#endregion |
| 160 |
//#region node_modules/@babel/runtime/helpers/esm/createClass.js |
| 161 |
init_toPropertyKey$1(); |
| 162 |
function _defineProperties(e, r) { |
| 163 |
for (var t = 0; t < r.length; t++) { |
| 164 |
var o = r[t]; |
| 165 |
o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, toPropertyKey$1(o.key), o); |
| 166 |
} |
| 167 |
} |
| 168 |
function _createClass(e, r, t) { |
| 169 |
return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; |
| 170 |
} |
| 171 |
|
| 172 |
//#endregion |
| 173 |
//#region node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js |
| 174 |
function _assertThisInitialized(e) { |
| 175 |
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); |
| 176 |
return e; |
| 177 |
} |
| 178 |
|
| 179 |
//#endregion |
| 180 |
//#region node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js |
| 181 |
init_typeof$1(); |
| 182 |
function _possibleConstructorReturn(t, e) { |
| 183 |
if (e && ("object" == _typeof$1(e) || "function" == typeof e)) return e; |
| 184 |
if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); |
| 185 |
return _assertThisInitialized(t); |
| 186 |
} |
| 187 |
|
| 188 |
//#endregion |
| 189 |
//#region node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js |
| 190 |
function _getPrototypeOf(t) { |
| 191 |
return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t) { |
| 192 |
return t.__proto__ || Object.getPrototypeOf(t); |
| 193 |
}, _getPrototypeOf(t); |
| 194 |
} |
| 195 |
|
| 196 |
//#endregion |
| 197 |
//#region node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js |
| 198 |
function _setPrototypeOf(t, e) { |
| 199 |
return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t, e) { |
| 200 |
return t.__proto__ = e, t; |
| 201 |
}, _setPrototypeOf(t, e); |
| 202 |
} |
| 203 |
|
| 204 |
//#endregion |
| 205 |
//#region node_modules/@babel/runtime/helpers/esm/inherits.js |
| 206 |
function _inherits(t, e) { |
| 207 |
if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); |
| 208 |
t.prototype = Object.create(e && e.prototype, { constructor: { |
| 209 |
value: t, |
| 210 |
writable: !0, |
| 211 |
configurable: !0 |
| 212 |
} }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); |
| 213 |
} |
| 214 |
|
| 215 |
//#endregion |
| 216 |
//#region node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js |
| 217 |
function asyncGeneratorStep$1(n, t, e, r, o, a, c) { |
| 218 |
try { |
| 219 |
var i = n[a](c); |
| 220 |
var u = i.value; |
| 221 |
} catch (n) { |
| 222 |
e(n); |
| 223 |
return; |
| 224 |
} |
| 225 |
i.done ? t(u) : Promise.resolve(u).then(r, o); |
| 226 |
} |
| 227 |
function _asyncToGenerator$1(n) { |
| 228 |
return function() { |
| 229 |
var t = this; |
| 230 |
var e = arguments; |
| 231 |
return new Promise(function(r, o) { |
| 232 |
var a = n.apply(t, e); |
| 233 |
function _next(n) { |
| 234 |
asyncGeneratorStep$1(a, r, o, _next, _throw, "next", n); |
| 235 |
} |
| 236 |
function _throw(n) { |
| 237 |
asyncGeneratorStep$1(a, r, o, _next, _throw, "throw", n); |
| 238 |
} |
| 239 |
_next(void 0); |
| 240 |
}); |
| 241 |
}; |
| 242 |
} |
| 243 |
var init_asyncToGenerator = __esmMin((() => { |
| 244 |
__name(asyncGeneratorStep$1, "asyncGeneratorStep"); |
| 245 |
__name(_asyncToGenerator$1, "_asyncToGenerator"); |
| 246 |
})); |
| 247 |
|
| 248 |
//#endregion |
| 249 |
//#region node_modules/@babel/runtime/helpers/OverloadYield.js |
| 250 |
var require_OverloadYield = /* @__PURE__ */ __commonJSMin(((exports, module) => { |
| 251 |
function _OverloadYield(e, d) { |
| 252 |
this.v = e, this.k = d; |
| 253 |
} |
| 254 |
module.exports = _OverloadYield, module.exports.__esModule = true, module.exports["default"] = module.exports; |
| 255 |
})); |
| 256 |
|
| 257 |
//#endregion |
| 258 |
//#region node_modules/@babel/runtime/helpers/regeneratorDefine.js |
| 259 |
var require_regeneratorDefine = /* @__PURE__ */ __commonJSMin(((exports, module) => { |
| 260 |
function _regeneratorDefine(e, r, n, t) { |
| 261 |
var i = Object.defineProperty; |
| 262 |
try { |
| 263 |
i({}, "", {}); |
| 264 |
} catch (e) { |
| 265 |
i = 0; |
| 266 |
} |
| 267 |
module.exports = _regeneratorDefine = function regeneratorDefine(e, r, n, t) { |
| 268 |
function o(r, n) { |
| 269 |
_regeneratorDefine(e, r, function(e) { |
| 270 |
return this._invoke(r, n, e); |
| 271 |
}); |
| 272 |
} |
| 273 |
r ? i ? i(e, r, { |
| 274 |
value: n, |
| 275 |
enumerable: !t, |
| 276 |
configurable: !t, |
| 277 |
writable: !t |
| 278 |
}) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); |
| 279 |
}, module.exports.__esModule = true, module.exports["default"] = module.exports, _regeneratorDefine(e, r, n, t); |
| 280 |
} |
| 281 |
module.exports = _regeneratorDefine, module.exports.__esModule = true, module.exports["default"] = module.exports; |
| 282 |
})); |
| 283 |
|
| 284 |
//#endregion |
| 285 |
//#region node_modules/@babel/runtime/helpers/regenerator.js |
| 286 |
var require_regenerator$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => { |
| 287 |
var regeneratorDefine = require_regeneratorDefine(); |
| 288 |
function _regenerator() { |
| 289 |
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ |
| 290 |
var e; |
| 291 |
var t; |
| 292 |
var r = "function" == typeof Symbol ? Symbol : {}; |
| 293 |
var n = r.iterator || "@@iterator"; |
| 294 |
var o = r.toStringTag || "@@toStringTag"; |
| 295 |
function i(r, n, o, i) { |
| 296 |
var c = n && n.prototype instanceof Generator ? n : Generator; |
| 297 |
var u = Object.create(c.prototype); |
| 298 |
return regeneratorDefine(u, "_invoke", function(r, n, o) { |
| 299 |
var i; |
| 300 |
var c; |
| 301 |
var u; |
| 302 |
var f = 0; |
| 303 |
var p = o || []; |
| 304 |
var y = !1; |
| 305 |
var G = { |
| 306 |
p: 0, |
| 307 |
n: 0, |
| 308 |
v: e, |
| 309 |
a: d, |
| 310 |
f: d.bind(e, 4), |
| 311 |
d: function d(t, r) { |
| 312 |
return i = t, c = 0, u = e, G.n = r, a; |
| 313 |
} |
| 314 |
}; |
| 315 |
function d(r, n) { |
| 316 |
for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { |
| 317 |
var o; |
| 318 |
var i = p[t]; |
| 319 |
var d = G.p; |
| 320 |
var l = i[2]; |
| 321 |
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)); |
| 322 |
} |
| 323 |
if (o || r > 1) return a; |
| 324 |
throw y = !0, n; |
| 325 |
} |
| 326 |
return function(o, p, l) { |
| 327 |
if (f > 1) throw TypeError("Generator is already running"); |
| 328 |
for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { |
| 329 |
i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); |
| 330 |
try { |
| 331 |
if (f = 2, i) { |
| 332 |
if (c || (o = "next"), t = i[o]) { |
| 333 |
if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); |
| 334 |
if (!t.done) return t; |
| 335 |
u = t.value, c < 2 && (c = 0); |
| 336 |
} else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); |
| 337 |
i = e; |
| 338 |
} else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; |
| 339 |
} catch (t) { |
| 340 |
i = e, c = 1, u = t; |
| 341 |
} finally { |
| 342 |
f = 1; |
| 343 |
} |
| 344 |
} |
| 345 |
return { |
| 346 |
value: t, |
| 347 |
done: y |
| 348 |
}; |
| 349 |
}; |
| 350 |
}(r, o, i), !0), u; |
| 351 |
} |
| 352 |
var a = {}; |
| 353 |
function Generator() {} |
| 354 |
function GeneratorFunction() {} |
| 355 |
function GeneratorFunctionPrototype() {} |
| 356 |
t = Object.getPrototypeOf; |
| 357 |
var c = [][n] ? t(t([][n]())) : (regeneratorDefine(t = {}, n, function() { |
| 358 |
return this; |
| 359 |
}), t); |
| 360 |
var u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); |
| 361 |
function f(e) { |
| 362 |
return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, regeneratorDefine(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; |
| 363 |
} |
| 364 |
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() { |
| 365 |
return this; |
| 366 |
}), regeneratorDefine(u, "toString", function() { |
| 367 |
return "[object Generator]"; |
| 368 |
}), (module.exports = _regenerator = function _regenerator() { |
| 369 |
return { |
| 370 |
w: i, |
| 371 |
m: f |
| 372 |
}; |
| 373 |
}, module.exports.__esModule = true, module.exports["default"] = module.exports)(); |
| 374 |
} |
| 375 |
module.exports = _regenerator, module.exports.__esModule = true, module.exports["default"] = module.exports; |
| 376 |
})); |
| 377 |
|
| 378 |
//#endregion |
| 379 |
//#region node_modules/@babel/runtime/helpers/regeneratorAsyncIterator.js |
| 380 |
var require_regeneratorAsyncIterator = /* @__PURE__ */ __commonJSMin(((exports, module) => { |
| 381 |
var OverloadYield = require_OverloadYield(); |
| 382 |
var regeneratorDefine = require_regeneratorDefine(); |
| 383 |
function AsyncIterator(t, e) { |
| 384 |
function n(r, o, i, f) { |
| 385 |
try { |
| 386 |
var c = t[r](o); |
| 387 |
var u = c.value; |
| 388 |
return u instanceof OverloadYield ? e.resolve(u.v).then(function(t) { |
| 389 |
n("next", t, i, f); |
| 390 |
}, function(t) { |
| 391 |
n("throw", t, i, f); |
| 392 |
}) : e.resolve(u).then(function(t) { |
| 393 |
c.value = t, i(c); |
| 394 |
}, function(t) { |
| 395 |
return n("throw", t, i, f); |
| 396 |
}); |
| 397 |
} catch (t) { |
| 398 |
f(t); |
| 399 |
} |
| 400 |
} |
| 401 |
var r; |
| 402 |
this.next || (regeneratorDefine(AsyncIterator.prototype), regeneratorDefine(AsyncIterator.prototype, "function" == typeof Symbol && Symbol.asyncIterator || "@asyncIterator", function() { |
| 403 |
return this; |
| 404 |
})), regeneratorDefine(this, "_invoke", function(t, o, i) { |
| 405 |
function f() { |
| 406 |
return new e(function(e, r) { |
| 407 |
n(t, i, e, r); |
| 408 |
}); |
| 409 |
} |
| 410 |
return r = r ? r.then(f, f) : f(); |
| 411 |
}, !0); |
| 412 |
} |
| 413 |
module.exports = AsyncIterator, module.exports.__esModule = true, module.exports["default"] = module.exports; |
| 414 |
})); |
| 415 |
|
| 416 |
//#endregion |
| 417 |
//#region node_modules/@babel/runtime/helpers/regeneratorAsyncGen.js |
| 418 |
var require_regeneratorAsyncGen = /* @__PURE__ */ __commonJSMin(((exports, module) => { |
| 419 |
var regenerator = require_regenerator$1(); |
| 420 |
var regeneratorAsyncIterator = require_regeneratorAsyncIterator(); |
| 421 |
function _regeneratorAsyncGen(r, e, t, o, n) { |
| 422 |
return new regeneratorAsyncIterator(regenerator().w(r, e, t, o), n || Promise); |
| 423 |
} |
| 424 |
module.exports = _regeneratorAsyncGen, module.exports.__esModule = true, module.exports["default"] = module.exports; |
| 425 |
})); |
| 426 |
|
| 427 |
//#endregion |
| 428 |
//#region node_modules/@babel/runtime/helpers/regeneratorAsync.js |
| 429 |
var require_regeneratorAsync = /* @__PURE__ */ __commonJSMin(((exports, module) => { |
| 430 |
var regeneratorAsyncGen = require_regeneratorAsyncGen(); |
| 431 |
function _regeneratorAsync(n, e, r, t, o) { |
| 432 |
var a = regeneratorAsyncGen(n, e, r, t, o); |
| 433 |
return a.next().then(function(n) { |
| 434 |
return n.done ? n.value : a.next(); |
| 435 |
}); |
| 436 |
} |
| 437 |
module.exports = _regeneratorAsync, module.exports.__esModule = true, module.exports["default"] = module.exports; |
| 438 |
})); |
| 439 |
|
| 440 |
//#endregion |
| 441 |
//#region node_modules/@babel/runtime/helpers/regeneratorKeys.js |
| 442 |
var require_regeneratorKeys = /* @__PURE__ */ __commonJSMin(((exports, module) => { |
| 443 |
function _regeneratorKeys(e) { |
| 444 |
var n = Object(e); |
| 445 |
var r = []; |
| 446 |
for (var t in n) r.unshift(t); |
| 447 |
return function e() { |
| 448 |
for (; r.length;) if ((t = r.pop()) in n) return e.value = t, e.done = !1, e; |
| 449 |
return e.done = !0, e; |
| 450 |
}; |
| 451 |
} |
| 452 |
module.exports = _regeneratorKeys, module.exports.__esModule = true, module.exports["default"] = module.exports; |
| 453 |
})); |
| 454 |
|
| 455 |
//#endregion |
| 456 |
//#region node_modules/@babel/runtime/helpers/typeof.js |
| 457 |
var require_typeof = /* @__PURE__ */ __commonJSMin(((exports, module) => { |
| 458 |
function _typeof(o) { |
| 459 |
"@babel/helpers - typeof"; |
| 460 |
return module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) { |
| 461 |
return typeof o; |
| 462 |
} : function(o) { |
| 463 |
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; |
| 464 |
}, module.exports.__esModule = true, module.exports["default"] = module.exports, _typeof(o); |
| 465 |
} |
| 466 |
module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports; |
| 467 |
})); |
| 468 |
|
| 469 |
//#endregion |
| 470 |
//#region node_modules/@babel/runtime/helpers/regeneratorValues.js |
| 471 |
var require_regeneratorValues = /* @__PURE__ */ __commonJSMin(((exports, module) => { |
| 472 |
var _typeof = require_typeof()["default"]; |
| 473 |
function _regeneratorValues(e) { |
| 474 |
if (null != e) { |
| 475 |
var t = e["function" == typeof Symbol && Symbol.iterator || "@@iterator"]; |
| 476 |
var r = 0; |
| 477 |
if (t) return t.call(e); |
| 478 |
if ("function" == typeof e.next) return e; |
| 479 |
if (!isNaN(e.length)) return { next: function next() { |
| 480 |
return e && r >= e.length && (e = void 0), { |
| 481 |
value: e && e[r++], |
| 482 |
done: !e |
| 483 |
}; |
| 484 |
} }; |
| 485 |
} |
| 486 |
throw new TypeError(_typeof(e) + " is not iterable"); |
| 487 |
} |
| 488 |
module.exports = _regeneratorValues, module.exports.__esModule = true, module.exports["default"] = module.exports; |
| 489 |
})); |
| 490 |
|
| 491 |
//#endregion |
| 492 |
//#region node_modules/@babel/runtime/helpers/regeneratorRuntime.js |
| 493 |
var require_regeneratorRuntime = /* @__PURE__ */ __commonJSMin(((exports, module) => { |
| 494 |
var OverloadYield = require_OverloadYield(); |
| 495 |
var regenerator = require_regenerator$1(); |
| 496 |
var regeneratorAsync = require_regeneratorAsync(); |
| 497 |
var regeneratorAsyncGen = require_regeneratorAsyncGen(); |
| 498 |
var regeneratorAsyncIterator = require_regeneratorAsyncIterator(); |
| 499 |
var regeneratorKeys = require_regeneratorKeys(); |
| 500 |
var regeneratorValues = require_regeneratorValues(); |
| 501 |
function _regeneratorRuntime() { |
| 502 |
"use strict"; |
| 503 |
var r = regenerator(); |
| 504 |
var e = r.m(_regeneratorRuntime); |
| 505 |
var t = (Object.getPrototypeOf ? Object.getPrototypeOf(e) : e.__proto__).constructor; |
| 506 |
function n(r) { |
| 507 |
var e = "function" == typeof r && r.constructor; |
| 508 |
return !!e && (e === t || "GeneratorFunction" === (e.displayName || e.name)); |
| 509 |
} |
| 510 |
var o = { |
| 511 |
"throw": 1, |
| 512 |
"return": 2, |
| 513 |
"break": 3, |
| 514 |
"continue": 3 |
| 515 |
}; |
| 516 |
function a(r) { |
| 517 |
var e; |
| 518 |
var t; |
| 519 |
return function(n) { |
| 520 |
e || (e = { |
| 521 |
stop: function stop() { |
| 522 |
return t(n.a, 2); |
| 523 |
}, |
| 524 |
"catch": function _catch() { |
| 525 |
return n.v; |
| 526 |
}, |
| 527 |
abrupt: function abrupt(r, e) { |
| 528 |
return t(n.a, o[r], e); |
| 529 |
}, |
| 530 |
delegateYield: function delegateYield(r, o, a) { |
| 531 |
return e.resultName = o, t(n.d, regeneratorValues(r), a); |
| 532 |
}, |
| 533 |
finish: function finish(r) { |
| 534 |
return t(n.f, r); |
| 535 |
} |
| 536 |
}, t = function t(r, _t, o) { |
| 537 |
n.p = e.prev, n.n = e.next; |
| 538 |
try { |
| 539 |
return r(_t, o); |
| 540 |
} finally { |
| 541 |
e.next = n.n; |
| 542 |
} |
| 543 |
}), e.resultName && (e[e.resultName] = n.v, e.resultName = void 0), e.sent = n.v, e.next = n.n; |
| 544 |
try { |
| 545 |
return r.call(this, e); |
| 546 |
} finally { |
| 547 |
n.p = e.prev, n.n = e.next; |
| 548 |
} |
| 549 |
}; |
| 550 |
} |
| 551 |
return (module.exports = _regeneratorRuntime = function _regeneratorRuntime() { |
| 552 |
return { |
| 553 |
wrap: function wrap(e, t, n, o) { |
| 554 |
return r.w(a(e), t, n, o && o.reverse()); |
| 555 |
}, |
| 556 |
isGeneratorFunction: n, |
| 557 |
mark: r.m, |
| 558 |
awrap: function awrap(r, e) { |
| 559 |
return new OverloadYield(r, e); |
| 560 |
}, |
| 561 |
AsyncIterator: regeneratorAsyncIterator, |
| 562 |
async: function async(r, e, t, o, u) { |
| 563 |
return (n(e) ? regeneratorAsyncGen : regeneratorAsync)(a(r), e, t, o, u); |
| 564 |
}, |
| 565 |
keys: regeneratorKeys, |
| 566 |
values: regeneratorValues |
| 567 |
}; |
| 568 |
}, module.exports.__esModule = true, module.exports["default"] = module.exports)(); |
| 569 |
} |
| 570 |
module.exports = _regeneratorRuntime, module.exports.__esModule = true, module.exports["default"] = module.exports; |
| 571 |
})); |
| 572 |
|
| 573 |
//#endregion |
| 574 |
//#region node_modules/@babel/runtime/regenerator/index.js |
| 575 |
var require_regenerator = /* @__PURE__ */ __commonJSMin(((exports, module) => { |
| 576 |
var runtime = require_regeneratorRuntime()(); |
| 577 |
module.exports = runtime; |
| 578 |
try { |
| 579 |
regeneratorRuntime = runtime; |
| 580 |
} catch (accidentalStrictMode) { |
| 581 |
if (typeof globalThis === "object") globalThis.regeneratorRuntime = runtime; |
| 582 |
else Function("r", "regeneratorRuntime = r")(runtime); |
| 583 |
} |
| 584 |
})); |
| 585 |
|
| 586 |
//#endregion |
| 587 |
//#region node_modules/react-dom/client.js |
| 588 |
var require_client = /* @__PURE__ */ __commonJSMin(((exports) => { |
| 589 |
var m$1 = (globalThis.ReactDOM); |
| 590 |
var i = m$1.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; |
| 591 |
exports.createRoot = function(c, o) { |
| 592 |
i.usingClientEntryPoint = true; |
| 593 |
try { |
| 594 |
return m$1.createRoot(c, o); |
| 595 |
} finally { |
| 596 |
i.usingClientEntryPoint = false; |
| 597 |
} |
| 598 |
}; |
| 599 |
})); |
| 600 |
|
| 601 |
//#endregion |
| 602 |
//#region assets/dev/js/utils/react.js |
| 603 |
init_asyncToGenerator(); |
| 604 |
var import_regenerator$3 = /* @__PURE__ */ __toESM(require_regenerator()); |
| 605 |
var import_client = require_client(); |
| 606 |
/** |
| 607 |
* Support conditional rendering of a React App to the DOM, based on the React version. |
| 608 |
* We use `createRoot` when available, but fallback to `ReactDOM.render` for older versions. |
| 609 |
* |
| 610 |
* @param {Promise.resolve(React).ReactElement} app The app to render. |
| 611 |
* @param {HTMLElement} domElement The DOM element to render the app into. |
| 612 |
* |
| 613 |
* @return {{ unmount: () => void }} The unmount function. |
| 614 |
*/ |
| 615 |
function render(app, domElement) { |
| 616 |
var unmountFunction; |
| 617 |
try { |
| 618 |
var root = (0, import_client.createRoot)(domElement); |
| 619 |
root.render(app); |
| 620 |
unmountFunction = function unmountFunction() { |
| 621 |
root.unmount(); |
| 622 |
}; |
| 623 |
} catch (e) { |
| 624 |
react_dom.render(app, domElement); |
| 625 |
unmountFunction = function unmountFunction() { |
| 626 |
react_dom.unmountComponentAtNode(domElement); |
| 627 |
}; |
| 628 |
} |
| 629 |
return { unmount: unmountFunction }; |
| 630 |
} |
| 631 |
var react_default = { render }; |
| 632 |
|
| 633 |
//#endregion |
| 634 |
//#region node_modules/prop-types/node_modules/react-is/cjs/react-is.development.js |
| 635 |
/** @license React v16.13.1 |
| 636 |
* react-is.development.js |
| 637 |
* |
| 638 |
* Copyright (c) Facebook, Inc. and its affiliates. |
| 639 |
* |
| 640 |
* This source code is licensed under the MIT license found in the |
| 641 |
* LICENSE file in the root directory of this source tree. |
| 642 |
*/ |
| 643 |
var require_react_is_development$1 = /* @__PURE__ */ __commonJSMin(((exports) => { |
| 644 |
(function() { |
| 645 |
"use strict"; |
| 646 |
var hasSymbol = typeof Symbol === "function" && Symbol.for; |
| 647 |
var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for("react.element") : 60103; |
| 648 |
var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for("react.portal") : 60106; |
| 649 |
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for("react.fragment") : 60107; |
| 650 |
var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for("react.strict_mode") : 60108; |
| 651 |
var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for("react.profiler") : 60114; |
| 652 |
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for("react.provider") : 60109; |
| 653 |
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for("react.context") : 60110; |
| 654 |
var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for("react.async_mode") : 60111; |
| 655 |
var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for("react.concurrent_mode") : 60111; |
| 656 |
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for("react.forward_ref") : 60112; |
| 657 |
var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for("react.suspense") : 60113; |
| 658 |
var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for("react.suspense_list") : 60120; |
| 659 |
var REACT_MEMO_TYPE = hasSymbol ? Symbol.for("react.memo") : 60115; |
| 660 |
var REACT_LAZY_TYPE = hasSymbol ? Symbol.for("react.lazy") : 60116; |
| 661 |
var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for("react.block") : 60121; |
| 662 |
var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for("react.fundamental") : 60117; |
| 663 |
var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for("react.responder") : 60118; |
| 664 |
var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for("react.scope") : 60119; |
| 665 |
function isValidElementType(type) { |
| 666 |
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); |
| 667 |
} |
| 668 |
function typeOf(object) { |
| 669 |
if (typeof object === "object" && object !== null) { |
| 670 |
var $$typeof = object.$$typeof; |
| 671 |
switch ($$typeof) { |
| 672 |
case REACT_ELEMENT_TYPE: |
| 673 |
var type = object.type; |
| 674 |
switch (type) { |
| 675 |
case REACT_ASYNC_MODE_TYPE: |
| 676 |
case REACT_CONCURRENT_MODE_TYPE: |
| 677 |
case REACT_FRAGMENT_TYPE: |
| 678 |
case REACT_PROFILER_TYPE: |
| 679 |
case REACT_STRICT_MODE_TYPE: |
| 680 |
case REACT_SUSPENSE_TYPE: return type; |
| 681 |
default: |
| 682 |
var $$typeofType = type && type.$$typeof; |
| 683 |
switch ($$typeofType) { |
| 684 |
case REACT_CONTEXT_TYPE: |
| 685 |
case REACT_FORWARD_REF_TYPE: |
| 686 |
case REACT_LAZY_TYPE: |
| 687 |
case REACT_MEMO_TYPE: |
| 688 |
case REACT_PROVIDER_TYPE: return $$typeofType; |
| 689 |
default: return $$typeof; |
| 690 |
} |
| 691 |
} |
| 692 |
case REACT_PORTAL_TYPE: return $$typeof; |
| 693 |
} |
| 694 |
} |
| 695 |
} |
| 696 |
var AsyncMode = REACT_ASYNC_MODE_TYPE; |
| 697 |
var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE; |
| 698 |
var ContextConsumer = REACT_CONTEXT_TYPE; |
| 699 |
var ContextProvider = REACT_PROVIDER_TYPE; |
| 700 |
var Element = REACT_ELEMENT_TYPE; |
| 701 |
var ForwardRef = REACT_FORWARD_REF_TYPE; |
| 702 |
var Fragment = REACT_FRAGMENT_TYPE; |
| 703 |
var Lazy = REACT_LAZY_TYPE; |
| 704 |
var Memo = REACT_MEMO_TYPE; |
| 705 |
var Portal = REACT_PORTAL_TYPE; |
| 706 |
var Profiler = REACT_PROFILER_TYPE; |
| 707 |
var StrictMode = REACT_STRICT_MODE_TYPE; |
| 708 |
var Suspense = REACT_SUSPENSE_TYPE; |
| 709 |
var hasWarnedAboutDeprecatedIsAsyncMode = false; |
| 710 |
function isAsyncMode(object) { |
| 711 |
if (!hasWarnedAboutDeprecatedIsAsyncMode) { |
| 712 |
hasWarnedAboutDeprecatedIsAsyncMode = true; |
| 713 |
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."); |
| 714 |
} |
| 715 |
return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE; |
| 716 |
} |
| 717 |
function isConcurrentMode(object) { |
| 718 |
return typeOf(object) === REACT_CONCURRENT_MODE_TYPE; |
| 719 |
} |
| 720 |
function isContextConsumer(object) { |
| 721 |
return typeOf(object) === REACT_CONTEXT_TYPE; |
| 722 |
} |
| 723 |
function isContextProvider(object) { |
| 724 |
return typeOf(object) === REACT_PROVIDER_TYPE; |
| 725 |
} |
| 726 |
function isElement(object) { |
| 727 |
return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; |
| 728 |
} |
| 729 |
function isForwardRef(object) { |
| 730 |
return typeOf(object) === REACT_FORWARD_REF_TYPE; |
| 731 |
} |
| 732 |
function isFragment(object) { |
| 733 |
return typeOf(object) === REACT_FRAGMENT_TYPE; |
| 734 |
} |
| 735 |
function isLazy(object) { |
| 736 |
return typeOf(object) === REACT_LAZY_TYPE; |
| 737 |
} |
| 738 |
function isMemo(object) { |
| 739 |
return typeOf(object) === REACT_MEMO_TYPE; |
| 740 |
} |
| 741 |
function isPortal(object) { |
| 742 |
return typeOf(object) === REACT_PORTAL_TYPE; |
| 743 |
} |
| 744 |
function isProfiler(object) { |
| 745 |
return typeOf(object) === REACT_PROFILER_TYPE; |
| 746 |
} |
| 747 |
function isStrictMode(object) { |
| 748 |
return typeOf(object) === REACT_STRICT_MODE_TYPE; |
| 749 |
} |
| 750 |
function isSuspense(object) { |
| 751 |
return typeOf(object) === REACT_SUSPENSE_TYPE; |
| 752 |
} |
| 753 |
exports.AsyncMode = AsyncMode; |
| 754 |
exports.ConcurrentMode = ConcurrentMode; |
| 755 |
exports.ContextConsumer = ContextConsumer; |
| 756 |
exports.ContextProvider = ContextProvider; |
| 757 |
exports.Element = Element; |
| 758 |
exports.ForwardRef = ForwardRef; |
| 759 |
exports.Fragment = Fragment; |
| 760 |
exports.Lazy = Lazy; |
| 761 |
exports.Memo = Memo; |
| 762 |
exports.Portal = Portal; |
| 763 |
exports.Profiler = Profiler; |
| 764 |
exports.StrictMode = StrictMode; |
| 765 |
exports.Suspense = Suspense; |
| 766 |
exports.isAsyncMode = isAsyncMode; |
| 767 |
exports.isConcurrentMode = isConcurrentMode; |
| 768 |
exports.isContextConsumer = isContextConsumer; |
| 769 |
exports.isContextProvider = isContextProvider; |
| 770 |
exports.isElement = isElement; |
| 771 |
exports.isForwardRef = isForwardRef; |
| 772 |
exports.isFragment = isFragment; |
| 773 |
exports.isLazy = isLazy; |
| 774 |
exports.isMemo = isMemo; |
| 775 |
exports.isPortal = isPortal; |
| 776 |
exports.isProfiler = isProfiler; |
| 777 |
exports.isStrictMode = isStrictMode; |
| 778 |
exports.isSuspense = isSuspense; |
| 779 |
exports.isValidElementType = isValidElementType; |
| 780 |
exports.typeOf = typeOf; |
| 781 |
})(); |
| 782 |
})); |
| 783 |
|
| 784 |
//#endregion |
| 785 |
//#region node_modules/prop-types/node_modules/react-is/index.js |
| 786 |
var require_react_is$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => { |
| 787 |
module.exports = require_react_is_development$1(); |
| 788 |
})); |
| 789 |
|
| 790 |
//#endregion |
| 791 |
//#region node_modules/object-assign/index.js |
| 792 |
/* |
| 793 |
object-assign |
| 794 |
(c) Sindre Sorhus |
| 795 |
@license MIT |
| 796 |
*/ |
| 797 |
var require_object_assign = /* @__PURE__ */ __commonJSMin(((exports, module) => { |
| 798 |
var getOwnPropertySymbols = Object.getOwnPropertySymbols; |
| 799 |
var hasOwnProperty = Object.prototype.hasOwnProperty; |
| 800 |
var propIsEnumerable = Object.prototype.propertyIsEnumerable; |
| 801 |
function toObject(val) { |
| 802 |
if (val === null || val === void 0) throw new TypeError("Object.assign cannot be called with null or undefined"); |
| 803 |
return Object(val); |
| 804 |
} |
| 805 |
function shouldUseNative() { |
| 806 |
try { |
| 807 |
if (!Object.assign) return false; |
| 808 |
var test1 = /* @__PURE__ */ new String("abc"); |
| 809 |
test1[5] = "de"; |
| 810 |
if (Object.getOwnPropertyNames(test1)[0] === "5") return false; |
| 811 |
var test2 = {}; |
| 812 |
for (var i = 0; i < 10; i++) test2["_" + String.fromCharCode(i)] = i; |
| 813 |
if (Object.getOwnPropertyNames(test2).map(function(n) { |
| 814 |
return test2[n]; |
| 815 |
}).join("") !== "0123456789") return false; |
| 816 |
var test3 = {}; |
| 817 |
"abcdefghijklmnopqrst".split("").forEach(function(letter) { |
| 818 |
test3[letter] = letter; |
| 819 |
}); |
| 820 |
if (Object.keys(Object.assign({}, test3)).join("") !== "abcdefghijklmnopqrst") return false; |
| 821 |
return true; |
| 822 |
} catch (err) { |
| 823 |
return false; |
| 824 |
} |
| 825 |
} |
| 826 |
module.exports = shouldUseNative() ? Object.assign : function(target, source) { |
| 827 |
var from; |
| 828 |
var to = toObject(target); |
| 829 |
var symbols; |
| 830 |
for (var s = 1; s < arguments.length; s++) { |
| 831 |
from = Object(arguments[s]); |
| 832 |
for (var key in from) if (hasOwnProperty.call(from, key)) to[key] = from[key]; |
| 833 |
if (getOwnPropertySymbols) { |
| 834 |
symbols = getOwnPropertySymbols(from); |
| 835 |
for (var i = 0; i < symbols.length; i++) if (propIsEnumerable.call(from, symbols[i])) to[symbols[i]] = from[symbols[i]]; |
| 836 |
} |
| 837 |
} |
| 838 |
return to; |
| 839 |
}; |
| 840 |
})); |
| 841 |
|
| 842 |
//#endregion |
| 843 |
//#region node_modules/prop-types/lib/ReactPropTypesSecret.js |
| 844 |
/** |
| 845 |
* Copyright (c) 2013-present, Facebook, Inc. |
| 846 |
* |
| 847 |
* This source code is licensed under the MIT license found in the |
| 848 |
* LICENSE file in the root directory of this source tree. |
| 849 |
*/ |
| 850 |
var require_ReactPropTypesSecret = /* @__PURE__ */ __commonJSMin(((exports, module) => { |
| 851 |
var ReactPropTypesSecret = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"; |
| 852 |
module.exports = ReactPropTypesSecret; |
| 853 |
})); |
| 854 |
|
| 855 |
//#endregion |
| 856 |
//#region node_modules/prop-types/lib/has.js |
| 857 |
var require_has = /* @__PURE__ */ __commonJSMin(((exports, module) => { |
| 858 |
module.exports = Function.call.bind(Object.prototype.hasOwnProperty); |
| 859 |
})); |
| 860 |
|
| 861 |
//#endregion |
| 862 |
//#region node_modules/prop-types/checkPropTypes.js |
| 863 |
/** |
| 864 |
* Copyright (c) 2013-present, Facebook, Inc. |
| 865 |
* |
| 866 |
* This source code is licensed under the MIT license found in the |
| 867 |
* LICENSE file in the root directory of this source tree. |
| 868 |
*/ |
| 869 |
var require_checkPropTypes = /* @__PURE__ */ __commonJSMin(((exports, module) => { |
| 870 |
var printWarning = function() {}; |
| 871 |
var ReactPropTypesSecret = require_ReactPropTypesSecret(); |
| 872 |
var loggedTypeFailures = {}; |
| 873 |
var has = require_has(); |
| 874 |
printWarning = function(text) { |
| 875 |
var message = "Warning: " + text; |
| 876 |
if (typeof console !== "undefined") console.error(message); |
| 877 |
try { |
| 878 |
throw new Error(message); |
| 879 |
} catch (x) {} |
| 880 |
}; |
| 881 |
/** |
| 882 |
* Assert that the values match with the type specs. |
| 883 |
* Error messages are memorized and will only be shown once. |
| 884 |
* |
| 885 |
* @param {object} typeSpecs Map of name to a ReactPropType |
| 886 |
* @param {object} values Runtime values that need to be type-checked |
| 887 |
* @param {string} location e.g. "prop", "context", "child context" |
| 888 |
* @param {string} componentName Name of the component for error messages. |
| 889 |
* @param {?Function} getStack Returns the component stack. |
| 890 |
* @private |
| 891 |
*/ |
| 892 |
function checkPropTypes(typeSpecs, values, location, componentName, getStack) { |
| 893 |
for (var typeSpecName in typeSpecs) if (has(typeSpecs, typeSpecName)) { |
| 894 |
var error; |
| 895 |
try { |
| 896 |
if (typeof typeSpecs[typeSpecName] !== "function") { |
| 897 |
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`."); |
| 898 |
err.name = "Invariant Violation"; |
| 899 |
throw err; |
| 900 |
} |
| 901 |
error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret); |
| 902 |
} catch (ex) { |
| 903 |
error = ex; |
| 904 |
} |
| 905 |
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)."); |
| 906 |
if (error instanceof Error && !(error.message in loggedTypeFailures)) { |
| 907 |
loggedTypeFailures[error.message] = true; |
| 908 |
var stack = getStack ? getStack() : ""; |
| 909 |
printWarning("Failed " + location + " type: " + error.message + (stack != null ? stack : "")); |
| 910 |
} |
| 911 |
} |
| 912 |
} |
| 913 |
/** |
| 914 |
* Resets warning cache when testing. |
| 915 |
* |
| 916 |
* @private |
| 917 |
*/ |
| 918 |
checkPropTypes.resetWarningCache = function() { |
| 919 |
loggedTypeFailures = {}; |
| 920 |
}; |
| 921 |
module.exports = checkPropTypes; |
| 922 |
})); |
| 923 |
|
| 924 |
//#endregion |
| 925 |
//#region node_modules/prop-types/factoryWithTypeCheckers.js |
| 926 |
/** |
| 927 |
* Copyright (c) 2013-present, Facebook, Inc. |
| 928 |
* |
| 929 |
* This source code is licensed under the MIT license found in the |
| 930 |
* LICENSE file in the root directory of this source tree. |
| 931 |
*/ |
| 932 |
var require_factoryWithTypeCheckers = /* @__PURE__ */ __commonJSMin(((exports, module) => { |
| 933 |
var ReactIs = require_react_is$1(); |
| 934 |
var assign = require_object_assign(); |
| 935 |
var ReactPropTypesSecret = require_ReactPropTypesSecret(); |
| 936 |
var has = require_has(); |
| 937 |
var checkPropTypes = require_checkPropTypes(); |
| 938 |
var printWarning = function() {}; |
| 939 |
printWarning = function(text) { |
| 940 |
var message = "Warning: " + text; |
| 941 |
if (typeof console !== "undefined") console.error(message); |
| 942 |
try { |
| 943 |
throw new Error(message); |
| 944 |
} catch (x) {} |
| 945 |
}; |
| 946 |
function emptyFunctionThatReturnsNull() { |
| 947 |
return null; |
| 948 |
} |
| 949 |
module.exports = function(isValidElement, throwOnDirectAccess) { |
| 950 |
var ITERATOR_SYMBOL = typeof Symbol === "function" && Symbol.iterator; |
| 951 |
var FAUX_ITERATOR_SYMBOL = "@@iterator"; |
| 952 |
/** |
| 953 |
* Returns the iterator method function contained on the iterable object. |
| 954 |
* |
| 955 |
* Be sure to invoke the function with the iterable as context: |
| 956 |
* |
| 957 |
* var iteratorFn = getIteratorFn(myIterable); |
| 958 |
* if (iteratorFn) { |
| 959 |
* var iterator = iteratorFn.call(myIterable); |
| 960 |
* ... |
| 961 |
* } |
| 962 |
* |
| 963 |
* @param {?object} maybeIterable |
| 964 |
* @return {?function} |
| 965 |
*/ |
| 966 |
function getIteratorFn(maybeIterable) { |
| 967 |
var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]); |
| 968 |
if (typeof iteratorFn === "function") return iteratorFn; |
| 969 |
} |
| 970 |
/** |
| 971 |
* Collection of methods that allow declaration and validation of props that are |
| 972 |
* supplied to React components. Example usage: |
| 973 |
* |
| 974 |
* var Props = require('ReactPropTypes'); |
| 975 |
* var MyArticle = React.createClass({ |
| 976 |
* propTypes: { |
| 977 |
* // An optional string prop named "description". |
| 978 |
* description: Props.string, |
| 979 |
* |
| 980 |
* // A required enum prop named "category". |
| 981 |
* category: Props.oneOf(['News','Photos']).isRequired, |
| 982 |
* |
| 983 |
* // A prop named "dialog" that requires an instance of Dialog. |
| 984 |
* dialog: Props.instanceOf(Dialog).isRequired |
| 985 |
* }, |
| 986 |
* render: function() { ... } |
| 987 |
* }); |
| 988 |
* |
| 989 |
* A more formal specification of how these methods are used: |
| 990 |
* |
| 991 |
* type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...) |
| 992 |
* decl := ReactPropTypes.{type}(.isRequired)? |
| 993 |
* |
| 994 |
* Each and every declaration produces a function with the same signature. This |
| 995 |
* allows the creation of custom validation functions. For example: |
| 996 |
* |
| 997 |
* var MyLink = React.createClass({ |
| 998 |
* propTypes: { |
| 999 |
* // An optional string or URI prop named "href". |
| 1000 |
* href: function(props, propName, componentName) { |
| 1001 |
* var propValue = props[propName]; |
| 1002 |
* if (propValue != null && typeof propValue !== 'string' && |
| 1003 |
* !(propValue instanceof URI)) { |
| 1004 |
* return new Error( |
| 1005 |
* 'Expected a string or an URI for ' + propName + ' in ' + |
| 1006 |
* componentName |
| 1007 |
* ); |
| 1008 |
* } |
| 1009 |
* } |
| 1010 |
* }, |
| 1011 |
* render: function() {...} |
| 1012 |
* }); |
| 1013 |
* |
| 1014 |
* @internal |
| 1015 |
*/ |
| 1016 |
var ANONYMOUS = "<<anonymous>>"; |
| 1017 |
var ReactPropTypes = { |
| 1018 |
array: createPrimitiveTypeChecker("array"), |
| 1019 |
bigint: createPrimitiveTypeChecker("bigint"), |
| 1020 |
bool: createPrimitiveTypeChecker("boolean"), |
| 1021 |
func: createPrimitiveTypeChecker("function"), |
| 1022 |
number: createPrimitiveTypeChecker("number"), |
| 1023 |
object: createPrimitiveTypeChecker("object"), |
| 1024 |
string: createPrimitiveTypeChecker("string"), |
| 1025 |
symbol: createPrimitiveTypeChecker("symbol"), |
| 1026 |
any: createAnyTypeChecker(), |
| 1027 |
arrayOf: createArrayOfTypeChecker, |
| 1028 |
element: createElementTypeChecker(), |
| 1029 |
elementType: createElementTypeTypeChecker(), |
| 1030 |
instanceOf: createInstanceTypeChecker, |
| 1031 |
node: createNodeChecker(), |
| 1032 |
objectOf: createObjectOfTypeChecker, |
| 1033 |
oneOf: createEnumTypeChecker, |
| 1034 |
oneOfType: createUnionTypeChecker, |
| 1035 |
shape: createShapeTypeChecker, |
| 1036 |
exact: createStrictShapeTypeChecker |
| 1037 |
}; |
| 1038 |
/** |
| 1039 |
* inlined Object.is polyfill to avoid requiring consumers ship their own |
| 1040 |
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is |
| 1041 |
*/ |
| 1042 |
function is(x, y) { |
| 1043 |
if (x === y) return x !== 0 || 1 / x === 1 / y; |
| 1044 |
else return x !== x && y !== y; |
| 1045 |
} |
| 1046 |
/** |
| 1047 |
* We use an Error-like object for backward compatibility as people may call |
| 1048 |
* PropTypes directly and inspect their output. However, we don't use real |
| 1049 |
* Errors anymore. We don't inspect their stack anyway, and creating them |
| 1050 |
* is prohibitively expensive if they are created too often, such as what |
| 1051 |
* happens in oneOfType() for any type before the one that matched. |
| 1052 |
*/ |
| 1053 |
function PropTypeError(message, data) { |
| 1054 |
this.message = message; |
| 1055 |
this.data = data && typeof data === "object" ? data : {}; |
| 1056 |
this.stack = ""; |
| 1057 |
} |
| 1058 |
PropTypeError.prototype = Error.prototype; |
| 1059 |
function createChainableTypeChecker(validate) { |
| 1060 |
var manualPropTypeCallCache = {}; |
| 1061 |
var manualPropTypeWarningCount = 0; |
| 1062 |
function checkType(isRequired, props, propName, componentName, location, propFullName, secret) { |
| 1063 |
componentName = componentName || ANONYMOUS; |
| 1064 |
propFullName = propFullName || propName; |
| 1065 |
if (secret !== ReactPropTypesSecret) { |
| 1066 |
if (throwOnDirectAccess) { |
| 1067 |
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"); |
| 1068 |
err.name = "Invariant Violation"; |
| 1069 |
throw err; |
| 1070 |
} else if (typeof console !== "undefined") { |
| 1071 |
var cacheKey = componentName + ":" + propName; |
| 1072 |
if (!manualPropTypeCallCache[cacheKey] && manualPropTypeWarningCount < 3) { |
| 1073 |
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."); |
| 1074 |
manualPropTypeCallCache[cacheKey] = true; |
| 1075 |
manualPropTypeWarningCount++; |
| 1076 |
} |
| 1077 |
} |
| 1078 |
} |
| 1079 |
if (props[propName] == null) { |
| 1080 |
if (isRequired) { |
| 1081 |
if (props[propName] === null) return new PropTypeError("The " + location + " `" + propFullName + "` is marked as required " + ("in `" + componentName + "`, but its value is `null`.")); |
| 1082 |
return new PropTypeError("The " + location + " `" + propFullName + "` is marked as required in " + ("`" + componentName + "`, but its value is `undefined`.")); |
| 1083 |
} |
| 1084 |
return null; |
| 1085 |
} else return validate(props, propName, componentName, location, propFullName); |
| 1086 |
} |
| 1087 |
var chainedCheckType = checkType.bind(null, false); |
| 1088 |
chainedCheckType.isRequired = checkType.bind(null, true); |
| 1089 |
return chainedCheckType; |
| 1090 |
} |
| 1091 |
function createPrimitiveTypeChecker(expectedType) { |
| 1092 |
function validate(props, propName, componentName, location, propFullName, secret) { |
| 1093 |
var propValue = props[propName]; |
| 1094 |
if (getPropType(propValue) !== expectedType) { |
| 1095 |
var preciseType = getPreciseType(propValue); |
| 1096 |
return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + preciseType + "` supplied to `" + componentName + "`, expected ") + ("`" + expectedType + "`."), { expectedType }); |
| 1097 |
} |
| 1098 |
return null; |
| 1099 |
} |
| 1100 |
return createChainableTypeChecker(validate); |
| 1101 |
} |
| 1102 |
function createAnyTypeChecker() { |
| 1103 |
return createChainableTypeChecker(emptyFunctionThatReturnsNull); |
| 1104 |
} |
| 1105 |
function createArrayOfTypeChecker(typeChecker) { |
| 1106 |
function validate(props, propName, componentName, location, propFullName) { |
| 1107 |
if (typeof typeChecker !== "function") return new PropTypeError("Property `" + propFullName + "` of component `" + componentName + "` has invalid PropType notation inside arrayOf."); |
| 1108 |
var propValue = props[propName]; |
| 1109 |
if (!Array.isArray(propValue)) { |
| 1110 |
var propType = getPropType(propValue); |
| 1111 |
return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected an array.")); |
| 1112 |
} |
| 1113 |
for (var i = 0; i < propValue.length; i++) { |
| 1114 |
var error = typeChecker(propValue, i, componentName, location, propFullName + "[" + i + "]", ReactPropTypesSecret); |
| 1115 |
if (error instanceof Error) return error; |
| 1116 |
} |
| 1117 |
return null; |
| 1118 |
} |
| 1119 |
return createChainableTypeChecker(validate); |
| 1120 |
} |
| 1121 |
function createElementTypeChecker() { |
| 1122 |
function validate(props, propName, componentName, location, propFullName) { |
| 1123 |
var propValue = props[propName]; |
| 1124 |
if (!isValidElement(propValue)) { |
| 1125 |
var propType = getPropType(propValue); |
| 1126 |
return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected a single ReactElement.")); |
| 1127 |
} |
| 1128 |
return null; |
| 1129 |
} |
| 1130 |
return createChainableTypeChecker(validate); |
| 1131 |
} |
| 1132 |
function createElementTypeTypeChecker() { |
| 1133 |
function validate(props, propName, componentName, location, propFullName) { |
| 1134 |
var propValue = props[propName]; |
| 1135 |
if (!ReactIs.isValidElementType(propValue)) { |
| 1136 |
var propType = getPropType(propValue); |
| 1137 |
return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected a single ReactElement type.")); |
| 1138 |
} |
| 1139 |
return null; |
| 1140 |
} |
| 1141 |
return createChainableTypeChecker(validate); |
| 1142 |
} |
| 1143 |
function createInstanceTypeChecker(expectedClass) { |
| 1144 |
function validate(props, propName, componentName, location, propFullName) { |
| 1145 |
if (!(props[propName] instanceof expectedClass)) { |
| 1146 |
var expectedClassName = expectedClass.name || ANONYMOUS; |
| 1147 |
var actualClassName = getClassName(props[propName]); |
| 1148 |
return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + actualClassName + "` supplied to `" + componentName + "`, expected ") + ("instance of `" + expectedClassName + "`.")); |
| 1149 |
} |
| 1150 |
return null; |
| 1151 |
} |
| 1152 |
return createChainableTypeChecker(validate); |
| 1153 |
} |
| 1154 |
function createEnumTypeChecker(expectedValues) { |
| 1155 |
if (!Array.isArray(expectedValues)) { |
| 1156 |
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])."); |
| 1157 |
else printWarning("Invalid argument supplied to oneOf, expected an array."); |
| 1158 |
return emptyFunctionThatReturnsNull; |
| 1159 |
} |
| 1160 |
function validate(props, propName, componentName, location, propFullName) { |
| 1161 |
var propValue = props[propName]; |
| 1162 |
for (var i = 0; i < expectedValues.length; i++) if (is(propValue, expectedValues[i])) return null; |
| 1163 |
var valuesString = JSON.stringify(expectedValues, function replacer(key, value) { |
| 1164 |
if (getPreciseType(value) === "symbol") return String(value); |
| 1165 |
return value; |
| 1166 |
}); |
| 1167 |
return new PropTypeError("Invalid " + location + " `" + propFullName + "` of value `" + String(propValue) + "` " + ("supplied to `" + componentName + "`, expected one of " + valuesString + ".")); |
| 1168 |
} |
| 1169 |
return createChainableTypeChecker(validate); |
| 1170 |
} |
| 1171 |
function createObjectOfTypeChecker(typeChecker) { |
| 1172 |
function validate(props, propName, componentName, location, propFullName) { |
| 1173 |
if (typeof typeChecker !== "function") return new PropTypeError("Property `" + propFullName + "` of component `" + componentName + "` has invalid PropType notation inside objectOf."); |
| 1174 |
var propValue = props[propName]; |
| 1175 |
var propType = getPropType(propValue); |
| 1176 |
if (propType !== "object") return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected an object.")); |
| 1177 |
for (var key in propValue) if (has(propValue, key)) { |
| 1178 |
var error = typeChecker(propValue, key, componentName, location, propFullName + "." + key, ReactPropTypesSecret); |
| 1179 |
if (error instanceof Error) return error; |
| 1180 |
} |
| 1181 |
return null; |
| 1182 |
} |
| 1183 |
return createChainableTypeChecker(validate); |
| 1184 |
} |
| 1185 |
function createUnionTypeChecker(arrayOfTypeCheckers) { |
| 1186 |
if (!Array.isArray(arrayOfTypeCheckers)) { |
| 1187 |
printWarning("Invalid argument supplied to oneOfType, expected an instance of array."); |
| 1188 |
return emptyFunctionThatReturnsNull; |
| 1189 |
} |
| 1190 |
for (var i = 0; i < arrayOfTypeCheckers.length; i++) { |
| 1191 |
var checker = arrayOfTypeCheckers[i]; |
| 1192 |
if (typeof checker !== "function") { |
| 1193 |
printWarning("Invalid argument supplied to oneOfType. Expected an array of check functions, but received " + getPostfixForTypeWarning(checker) + " at index " + i + "."); |
| 1194 |
return emptyFunctionThatReturnsNull; |
| 1195 |
} |
| 1196 |
} |
| 1197 |
function validate(props, propName, componentName, location, propFullName) { |
| 1198 |
var expectedTypes = []; |
| 1199 |
for (var i = 0; i < arrayOfTypeCheckers.length; i++) { |
| 1200 |
var checker = arrayOfTypeCheckers[i]; |
| 1201 |
var checkerResult = checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret); |
| 1202 |
if (checkerResult == null) return null; |
| 1203 |
if (checkerResult.data && has(checkerResult.data, "expectedType")) expectedTypes.push(checkerResult.data.expectedType); |
| 1204 |
} |
| 1205 |
var expectedTypesMessage = expectedTypes.length > 0 ? ", expected one of type [" + expectedTypes.join(", ") + "]" : ""; |
| 1206 |
return new PropTypeError("Invalid " + location + " `" + propFullName + "` supplied to " + ("`" + componentName + "`" + expectedTypesMessage + ".")); |
| 1207 |
} |
| 1208 |
return createChainableTypeChecker(validate); |
| 1209 |
} |
| 1210 |
function createNodeChecker() { |
| 1211 |
function validate(props, propName, componentName, location, propFullName) { |
| 1212 |
if (!isNode(props[propName])) return new PropTypeError("Invalid " + location + " `" + propFullName + "` supplied to " + ("`" + componentName + "`, expected a ReactNode.")); |
| 1213 |
return null; |
| 1214 |
} |
| 1215 |
return createChainableTypeChecker(validate); |
| 1216 |
} |
| 1217 |
function invalidValidatorError(componentName, location, propFullName, key, type) { |
| 1218 |
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 + "`."); |
| 1219 |
} |
| 1220 |
function createShapeTypeChecker(shapeTypes) { |
| 1221 |
function validate(props, propName, componentName, location, propFullName) { |
| 1222 |
var propValue = props[propName]; |
| 1223 |
var propType = getPropType(propValue); |
| 1224 |
if (propType !== "object") return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type `" + propType + "` " + ("supplied to `" + componentName + "`, expected `object`.")); |
| 1225 |
for (var key in shapeTypes) { |
| 1226 |
var checker = shapeTypes[key]; |
| 1227 |
if (typeof checker !== "function") return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker)); |
| 1228 |
var error = checker(propValue, key, componentName, location, propFullName + "." + key, ReactPropTypesSecret); |
| 1229 |
if (error) return error; |
| 1230 |
} |
| 1231 |
return null; |
| 1232 |
} |
| 1233 |
return createChainableTypeChecker(validate); |
| 1234 |
} |
| 1235 |
function createStrictShapeTypeChecker(shapeTypes) { |
| 1236 |
function validate(props, propName, componentName, location, propFullName) { |
| 1237 |
var propValue = props[propName]; |
| 1238 |
var propType = getPropType(propValue); |
| 1239 |
if (propType !== "object") return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type `" + propType + "` " + ("supplied to `" + componentName + "`, expected `object`.")); |
| 1240 |
for (var key in assign({}, props[propName], shapeTypes)) { |
| 1241 |
var checker = shapeTypes[key]; |
| 1242 |
if (has(shapeTypes, key) && typeof checker !== "function") return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker)); |
| 1243 |
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, " ")); |
| 1244 |
var error = checker(propValue, key, componentName, location, propFullName + "." + key, ReactPropTypesSecret); |
| 1245 |
if (error) return error; |
| 1246 |
} |
| 1247 |
return null; |
| 1248 |
} |
| 1249 |
return createChainableTypeChecker(validate); |
| 1250 |
} |
| 1251 |
function isNode(propValue) { |
| 1252 |
switch (typeof propValue) { |
| 1253 |
case "number": |
| 1254 |
case "string": |
| 1255 |
case "undefined": return true; |
| 1256 |
case "boolean": return !propValue; |
| 1257 |
case "object": |
| 1258 |
if (Array.isArray(propValue)) return propValue.every(isNode); |
| 1259 |
if (propValue === null || isValidElement(propValue)) return true; |
| 1260 |
var iteratorFn = getIteratorFn(propValue); |
| 1261 |
if (iteratorFn) { |
| 1262 |
var iterator = iteratorFn.call(propValue); |
| 1263 |
var step; |
| 1264 |
if (iteratorFn !== propValue.entries) { |
| 1265 |
while (!(step = iterator.next()).done) if (!isNode(step.value)) return false; |
| 1266 |
} else while (!(step = iterator.next()).done) { |
| 1267 |
var entry = step.value; |
| 1268 |
if (entry) { |
| 1269 |
if (!isNode(entry[1])) return false; |
| 1270 |
} |
| 1271 |
} |
| 1272 |
} else return false; |
| 1273 |
return true; |
| 1274 |
default: return false; |
| 1275 |
} |
| 1276 |
} |
| 1277 |
function isSymbol(propType, propValue) { |
| 1278 |
if (propType === "symbol") return true; |
| 1279 |
if (!propValue) return false; |
| 1280 |
if (propValue["@@toStringTag"] === "Symbol") return true; |
| 1281 |
if (typeof Symbol === "function" && propValue instanceof Symbol) return true; |
| 1282 |
return false; |
| 1283 |
} |
| 1284 |
function getPropType(propValue) { |
| 1285 |
var propType = typeof propValue; |
| 1286 |
if (Array.isArray(propValue)) return "array"; |
| 1287 |
if (propValue instanceof RegExp) return "object"; |
| 1288 |
if (isSymbol(propType, propValue)) return "symbol"; |
| 1289 |
return propType; |
| 1290 |
} |
| 1291 |
function getPreciseType(propValue) { |
| 1292 |
if (typeof propValue === "undefined" || propValue === null) return "" + propValue; |
| 1293 |
var propType = getPropType(propValue); |
| 1294 |
if (propType === "object") { |
| 1295 |
if (propValue instanceof Date) return "date"; |
| 1296 |
else if (propValue instanceof RegExp) return "regexp"; |
| 1297 |
} |
| 1298 |
return propType; |
| 1299 |
} |
| 1300 |
function getPostfixForTypeWarning(value) { |
| 1301 |
var type = getPreciseType(value); |
| 1302 |
switch (type) { |
| 1303 |
case "array": |
| 1304 |
case "object": return "an " + type; |
| 1305 |
case "boolean": |
| 1306 |
case "date": |
| 1307 |
case "regexp": return "a " + type; |
| 1308 |
default: return type; |
| 1309 |
} |
| 1310 |
} |
| 1311 |
function getClassName(propValue) { |
| 1312 |
if (!propValue.constructor || !propValue.constructor.name) return ANONYMOUS; |
| 1313 |
return propValue.constructor.name; |
| 1314 |
} |
| 1315 |
ReactPropTypes.checkPropTypes = checkPropTypes; |
| 1316 |
ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache; |
| 1317 |
ReactPropTypes.PropTypes = ReactPropTypes; |
| 1318 |
return ReactPropTypes; |
| 1319 |
}; |
| 1320 |
})); |
| 1321 |
|
| 1322 |
//#endregion |
| 1323 |
//#region node_modules/prop-types/index.js |
| 1324 |
var require_prop_types = /* @__PURE__ */ __commonJSMin(((exports, module) => { |
| 1325 |
var ReactIs = require_react_is$1(); |
| 1326 |
var throwOnDirectAccess = true; |
| 1327 |
module.exports = require_factoryWithTypeCheckers()(ReactIs.isElement, throwOnDirectAccess); |
| 1328 |
})); |
| 1329 |
|
| 1330 |
//#endregion |
| 1331 |
//#region node_modules/@babel/runtime/helpers/esm/extends.js |
| 1332 |
function _extends$1() { |
| 1333 |
return _extends$1 = Object.assign ? Object.assign.bind() : function(n) { |
| 1334 |
for (var e = 1; e < arguments.length; e++) { |
| 1335 |
var t = arguments[e]; |
| 1336 |
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); |
| 1337 |
} |
| 1338 |
return n; |
| 1339 |
}, _extends$1.apply(null, arguments); |
| 1340 |
} |
| 1341 |
var init_extends = __esmMin((() => { |
| 1342 |
__name(_extends$1, "_extends"); |
| 1343 |
})); |
| 1344 |
|
| 1345 |
//#endregion |
| 1346 |
//#region node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js |
| 1347 |
function _arrayWithHoles(r) { |
| 1348 |
if (Array.isArray(r)) return r; |
| 1349 |
} |
| 1350 |
var init_arrayWithHoles = __esmMin((() => {})); |
| 1351 |
|
| 1352 |
//#endregion |
| 1353 |
//#region node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js |
| 1354 |
function _iterableToArrayLimit(r, l) { |
| 1355 |
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; |
| 1356 |
if (null != t) { |
| 1357 |
var e; |
| 1358 |
var n; |
| 1359 |
var i; |
| 1360 |
var u; |
| 1361 |
var a = []; |
| 1362 |
var f = !0; |
| 1363 |
var o = !1; |
| 1364 |
try { |
| 1365 |
if (i = (t = t.call(r)).next, 0 === l) { |
| 1366 |
if (Object(t) !== t) return; |
| 1367 |
f = !1; |
| 1368 |
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); |
| 1369 |
} catch (r) { |
| 1370 |
o = !0, n = r; |
| 1371 |
} finally { |
| 1372 |
try { |
| 1373 |
if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; |
| 1374 |
} finally { |
| 1375 |
if (o) throw n; |
| 1376 |
} |
| 1377 |
} |
| 1378 |
return a; |
| 1379 |
} |
| 1380 |
} |
| 1381 |
var init_iterableToArrayLimit = __esmMin((() => {})); |
| 1382 |
|
| 1383 |
//#endregion |
| 1384 |
//#region node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js |
| 1385 |
function _arrayLikeToArray$2(r, a) { |
| 1386 |
(null == a || a > r.length) && (a = r.length); |
| 1387 |
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; |
| 1388 |
return n; |
| 1389 |
} |
| 1390 |
var init_arrayLikeToArray = __esmMin((() => { |
| 1391 |
__name(_arrayLikeToArray$2, "_arrayLikeToArray"); |
| 1392 |
})); |
| 1393 |
|
| 1394 |
//#endregion |
| 1395 |
//#region node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js |
| 1396 |
function _unsupportedIterableToArray$2(r, a) { |
| 1397 |
if (r) { |
| 1398 |
if ("string" == typeof r) return _arrayLikeToArray$2(r, a); |
| 1399 |
var t = {}.toString.call(r).slice(8, -1); |
| 1400 |
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; |
| 1401 |
} |
| 1402 |
} |
| 1403 |
var init_unsupportedIterableToArray = __esmMin((() => { |
| 1404 |
init_arrayLikeToArray(); |
| 1405 |
__name(_unsupportedIterableToArray$2, "_unsupportedIterableToArray"); |
| 1406 |
})); |
| 1407 |
|
| 1408 |
//#endregion |
| 1409 |
//#region node_modules/@babel/runtime/helpers/esm/nonIterableRest.js |
| 1410 |
function _nonIterableRest() { |
| 1411 |
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); |
| 1412 |
} |
| 1413 |
var init_nonIterableRest = __esmMin((() => {})); |
| 1414 |
|
| 1415 |
//#endregion |
| 1416 |
//#region node_modules/@babel/runtime/helpers/esm/slicedToArray.js |
| 1417 |
function _slicedToArray(r, e) { |
| 1418 |
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray$2(r, e) || _nonIterableRest(); |
| 1419 |
} |
| 1420 |
var init_slicedToArray = __esmMin((() => { |
| 1421 |
init_arrayWithHoles(); |
| 1422 |
init_iterableToArrayLimit(); |
| 1423 |
init_unsupportedIterableToArray(); |
| 1424 |
init_nonIterableRest(); |
| 1425 |
})); |
| 1426 |
|
| 1427 |
//#endregion |
| 1428 |
//#region modules/ai/assets/js/editor/components/loader.js |
| 1429 |
function ownKeys$33(e, r) { |
| 1430 |
var t = Object.keys(e); |
| 1431 |
if (Object.getOwnPropertySymbols) { |
| 1432 |
var o = Object.getOwnPropertySymbols(e); |
| 1433 |
r && (o = o.filter(function(r) { |
| 1434 |
return Object.getOwnPropertyDescriptor(e, r).enumerable; |
| 1435 |
})), t.push.apply(t, o); |
| 1436 |
} |
| 1437 |
return t; |
| 1438 |
} |
| 1439 |
function _objectSpread$32(e) { |
| 1440 |
for (var r = 1; r < arguments.length; r++) { |
| 1441 |
var t = null != arguments[r] ? arguments[r] : {}; |
| 1442 |
r % 2 ? ownKeys$33(Object(t), !0).forEach(function(r) { |
| 1443 |
_defineProperty$1(e, r, t[r]); |
| 1444 |
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$33(Object(t)).forEach(function(r) { |
| 1445 |
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); |
| 1446 |
}); |
| 1447 |
} |
| 1448 |
return e; |
| 1449 |
} |
| 1450 |
var import_prop_types$13, _excluded$34, Loader; |
| 1451 |
var init_loader = __esmMin((() => { |
| 1452 |
init_extends(); |
| 1453 |
import_prop_types$13 = /* @__PURE__ */ __toESM(require_prop_types()); |
| 1454 |
_excluded$34 = ["sx", "BoxProps"]; |
| 1455 |
__name(ownKeys$33, "ownKeys"); |
| 1456 |
__name(_objectSpread$32, "_objectSpread"); |
| 1457 |
Loader = function Loader(_ref) { |
| 1458 |
var _ref$sx = _ref.sx; |
| 1459 |
var sx = _ref$sx === void 0 ? {} : _ref$sx; |
| 1460 |
var _ref$BoxProps = _ref.BoxProps; |
| 1461 |
var BoxProps = _ref$BoxProps === void 0 ? {} : _ref$BoxProps; |
| 1462 |
var props = _objectWithoutProperties$1(_ref, _excluded$34); |
| 1463 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, _extends$1({ |
| 1464 |
width: "100%", |
| 1465 |
display: "flex", |
| 1466 |
alignItems: "center" |
| 1467 |
}, BoxProps, { sx: _objectSpread$32({ |
| 1468 |
px: 1.5, |
| 1469 |
minHeight: function minHeight(theme) { |
| 1470 |
return theme.spacing(5); |
| 1471 |
} |
| 1472 |
}, BoxProps.sx || {}) }), /*#__PURE__*/ react.default.createElement(_elementor_ui.LinearProgress, _extends$1({ color: "secondary" }, props, { sx: _objectSpread$32({ width: "100%" }, sx) }))); |
| 1473 |
}; |
| 1474 |
Loader.propTypes = { |
| 1475 |
sx: import_prop_types$13.default.object, |
| 1476 |
BoxProps: import_prop_types$13.default.object |
| 1477 |
}; |
| 1478 |
})); |
| 1479 |
|
| 1480 |
//#endregion |
| 1481 |
//#region modules/ai/assets/js/editor/components/ui/search-field.js |
| 1482 |
var import_prop_types$12, StyledTextField$1, SearchField; |
| 1483 |
var init_search_field = __esmMin((() => { |
| 1484 |
init_extends(); |
| 1485 |
import_prop_types$12 = /* @__PURE__ */ __toESM(require_prop_types()); |
| 1486 |
StyledTextField$1 = (0, _elementor_ui.styled)(_elementor_ui.TextField)(function() { |
| 1487 |
return { ".wp-admin & .MuiInputBase-input, & .MuiInputBase-input:focus": { |
| 1488 |
backgroundColor: "initial", |
| 1489 |
boxShadow: "none", |
| 1490 |
border: 0, |
| 1491 |
color: "inherit", |
| 1492 |
outline: 0, |
| 1493 |
/** |
| 1494 |
* TODO: |
| 1495 |
* Find a better solution to get the component padding value dynamically or fix the global CSS override. |
| 1496 |
* These values are taken from Material UI's source code (the left padding reset was added to match the component style). |
| 1497 |
*/ |
| 1498 |
padding: "16.5px 14px 16.5px 0", |
| 1499 |
"&.MuiInputBase-inputSizeSmall": { padding: "8.5px 14px 8.5px 0" } |
| 1500 |
} }; |
| 1501 |
}); |
| 1502 |
SearchField = (0, react.forwardRef)(function(props, ref) { |
| 1503 |
return /*#__PURE__*/ react.default.createElement(StyledTextField$1, _extends$1({ |
| 1504 |
autoFocus: true, |
| 1505 |
fullWidth: true, |
| 1506 |
required: true, |
| 1507 |
size: "small", |
| 1508 |
color: "secondary", |
| 1509 |
InputProps: { |
| 1510 |
autoComplete: "off", |
| 1511 |
startAdornment: /*#__PURE__*/ react.default.createElement(_elementor_ui.InputAdornment, { position: "start" }, /*#__PURE__*/ react.default.createElement(_elementor_icons.SearchIcon, null)) |
| 1512 |
}, |
| 1513 |
placeholder: props.placeholder, |
| 1514 |
name: props.name, |
| 1515 |
value: props.value, |
| 1516 |
onChange: props.onChange |
| 1517 |
}, props, { inputRef: ref })); |
| 1518 |
}); |
| 1519 |
SearchField.propTypes = { |
| 1520 |
placeholder: import_prop_types$12.default.string, |
| 1521 |
name: import_prop_types$12.default.string, |
| 1522 |
value: import_prop_types$12.default.string, |
| 1523 |
onChange: import_prop_types$12.default.func |
| 1524 |
}; |
| 1525 |
})); |
| 1526 |
|
| 1527 |
//#endregion |
| 1528 |
//#region modules/ai/assets/js/editor/components/prompt-search.js |
| 1529 |
var PromptSearch; |
| 1530 |
var init_prompt_search = __esmMin((() => { |
| 1531 |
init_extends(); |
| 1532 |
init_search_field(); |
| 1533 |
PromptSearch = (0, react.forwardRef)(function(props, ref) { |
| 1534 |
return /*#__PURE__*/ react.default.createElement(SearchField, _extends$1({ |
| 1535 |
name: "prompt", |
| 1536 |
placeholder: (0, _wordpress_i18n.__)("Describe the text and tone you want to use", "elementor") + "..." |
| 1537 |
}, props, { ref })); |
| 1538 |
}); |
| 1539 |
})); |
| 1540 |
|
| 1541 |
//#endregion |
| 1542 |
//#region modules/ai/assets/js/editor/components/textarea.js |
| 1543 |
var import_prop_types$11, Textarea; |
| 1544 |
var init_textarea = __esmMin((() => { |
| 1545 |
init_extends(); |
| 1546 |
import_prop_types$11 = /* @__PURE__ */ __toESM(require_prop_types()); |
| 1547 |
Textarea = (0, react.forwardRef)(function(props, ref) { |
| 1548 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.TextField, _extends$1({ |
| 1549 |
inputRef: ref, |
| 1550 |
multiline: true, |
| 1551 |
minRows: 4, |
| 1552 |
maxRows: 20, |
| 1553 |
color: "secondary" |
| 1554 |
}, props)); |
| 1555 |
}); |
| 1556 |
Textarea.propTypes = { |
| 1557 |
value: import_prop_types$11.default.string, |
| 1558 |
onChange: import_prop_types$11.default.func, |
| 1559 |
helperText: import_prop_types$11.default.string |
| 1560 |
}; |
| 1561 |
})); |
| 1562 |
|
| 1563 |
//#endregion |
| 1564 |
//#region modules/ai/assets/js/editor/components/prompt-suggestions.js |
| 1565 |
var import_prop_types$10, PromptSuggestions; |
| 1566 |
var init_prompt_suggestions = __esmMin((() => { |
| 1567 |
import_prop_types$10 = /* @__PURE__ */ __toESM(require_prop_types()); |
| 1568 |
PromptSuggestions = function PromptSuggestions(props) { |
| 1569 |
var _props$suggestions; |
| 1570 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, null, /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, { |
| 1571 |
variant: "subtitle1", |
| 1572 |
color: "text.secondary" |
| 1573 |
}, (0, _wordpress_i18n.__)("Suggested prompts", "elementor") + ":"), /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, { |
| 1574 |
direction: "column", |
| 1575 |
alignItems: "flex-start", |
| 1576 |
gap: 1, |
| 1577 |
sx: { my: 1 } |
| 1578 |
}, (_props$suggestions = props.suggestions) === null || _props$suggestions === void 0 ? void 0 : _props$suggestions.map(function(option, index) { |
| 1579 |
var _props$suggestionFilt; |
| 1580 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Chip, { |
| 1581 |
key: index, |
| 1582 |
variant: "outlined", |
| 1583 |
size: "large", |
| 1584 |
color: "secondary", |
| 1585 |
label: ((_props$suggestionFilt = props.suggestionFilter) === null || _props$suggestionFilt === void 0 ? void 0 : _props$suggestionFilt.call(props, option)) || option, |
| 1586 |
onClick: function onClick() { |
| 1587 |
return props.onSelect(option); |
| 1588 |
} |
| 1589 |
}); |
| 1590 |
})), props.children); |
| 1591 |
}; |
| 1592 |
PromptSuggestions.propTypes = { |
| 1593 |
suggestions: import_prop_types$10.default.arrayOf(import_prop_types$10.default.string), |
| 1594 |
onSelect: import_prop_types$10.default.func.isRequired, |
| 1595 |
suggestionFilter: import_prop_types$10.default.func, |
| 1596 |
children: import_prop_types$10.default.node |
| 1597 |
}; |
| 1598 |
})); |
| 1599 |
|
| 1600 |
//#endregion |
| 1601 |
//#region modules/ai/assets/js/editor/components/prompt-library-link.js |
| 1602 |
var import_prop_types$9, PromptLibraryLink; |
| 1603 |
var init_prompt_library_link = __esmMin((() => { |
| 1604 |
import_prop_types$9 = /* @__PURE__ */ __toESM(require_prop_types()); |
| 1605 |
PromptLibraryLink = function PromptLibraryLink(props) { |
| 1606 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, { |
| 1607 |
variant: "body2", |
| 1608 |
color: "text.secondary" |
| 1609 |
}, (0, _wordpress_i18n.__)("For more suggestions, explore our"), " ", /*#__PURE__*/ react.default.createElement(_elementor_ui.Link, { |
| 1610 |
href: props.libraryLink, |
| 1611 |
className: "elementor-clickable", |
| 1612 |
target: "_blank" |
| 1613 |
}, (0, _wordpress_i18n.__)("prompt library"))); |
| 1614 |
}; |
| 1615 |
PromptLibraryLink.propTypes = { libraryLink: import_prop_types$9.default.string }; |
| 1616 |
})); |
| 1617 |
|
| 1618 |
//#endregion |
| 1619 |
//#region modules/ai/assets/js/editor/components/prompt-action-selection.js |
| 1620 |
init_slicedToArray(); |
| 1621 |
init_loader(); |
| 1622 |
init_prompt_search(); |
| 1623 |
init_textarea(); |
| 1624 |
init_prompt_suggestions(); |
| 1625 |
init_prompt_library_link(); |
| 1626 |
var import_prop_types$8 = /* @__PURE__ */ __toESM(require_prop_types()); |
| 1627 |
var labelToDashCash = function labelToDashCash(str) { |
| 1628 |
return str.toLowerCase().replace(/ /g, "-"); |
| 1629 |
}; |
| 1630 |
var PromptActionSelection = function PromptActionSelection(props) { |
| 1631 |
var actionId = labelToDashCash(props.label); |
| 1632 |
var _props$wrapperStyle = props.wrapperStyle; |
| 1633 |
var wrapperStyle = _props$wrapperStyle === void 0 ? { maxWidth: 138 } : _props$wrapperStyle; |
| 1634 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.FormControl, { |
| 1635 |
size: "small", |
| 1636 |
color: "secondary", |
| 1637 |
fullWidth: true, |
| 1638 |
sx: wrapperStyle |
| 1639 |
}, /*#__PURE__*/ react.default.createElement(_elementor_ui.InputLabel, { id: actionId }, props.label), /*#__PURE__*/ react.default.createElement(_elementor_ui.Select, { |
| 1640 |
id: actionId, |
| 1641 |
labelId: actionId, |
| 1642 |
label: props.label, |
| 1643 |
value: props.value || "", |
| 1644 |
onChange: props.onChange, |
| 1645 |
disabled: props.disabled, |
| 1646 |
sx: { "&.Mui-disabled .MuiSelect-nativeInput": { |
| 1647 |
backgroundColor: "initial", |
| 1648 |
opacity: 0 |
| 1649 |
} } |
| 1650 |
}, props.options.map(function(option) { |
| 1651 |
var _option$value; |
| 1652 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.MenuItem, { |
| 1653 |
dense: true, |
| 1654 |
key: option.label, |
| 1655 |
value: (_option$value = option.value) !== null && _option$value !== void 0 ? _option$value : option.label |
| 1656 |
}, option.label); |
| 1657 |
}))); |
| 1658 |
}; |
| 1659 |
PromptActionSelection.propTypes = { |
| 1660 |
label: import_prop_types$8.default.string.isRequired, |
| 1661 |
options: import_prop_types$8.default.arrayOf(import_prop_types$8.default.shape({ |
| 1662 |
label: import_prop_types$8.default.string.isRequired, |
| 1663 |
value: import_prop_types$8.default.string |
| 1664 |
})).isRequired, |
| 1665 |
onChange: import_prop_types$8.default.func.isRequired, |
| 1666 |
value: import_prop_types$8.default.string, |
| 1667 |
wrapperStyle: import_prop_types$8.default.object, |
| 1668 |
disabled: import_prop_types$8.default.bool |
| 1669 |
}; |
| 1670 |
|
| 1671 |
//#endregion |
| 1672 |
//#region modules/ai/assets/js/editor/components/generate-button.js |
| 1673 |
var GenerateButton$1; |
| 1674 |
var init_generate_button = __esmMin((() => { |
| 1675 |
init_extends(); |
| 1676 |
GenerateButton$1 = function GenerateButton(props) { |
| 1677 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Button, _extends$1({ |
| 1678 |
variant: "contained", |
| 1679 |
endIcon: /*#__PURE__*/ react.default.createElement(_elementor_icons.AIIcon, { fontSize: "small" }), |
| 1680 |
disabled: !prompt, |
| 1681 |
"aria-label": (0, _wordpress_i18n.__)("search", "elementor"), |
| 1682 |
type: "submit", |
| 1683 |
size: "small" |
| 1684 |
}, props)); |
| 1685 |
}; |
| 1686 |
})); |
| 1687 |
|
| 1688 |
//#endregion |
| 1689 |
//#region modules/ai/assets/js/editor/components/prompt-action.js |
| 1690 |
init_generate_button(); |
| 1691 |
init_extends(); |
| 1692 |
var PromptAction = function PromptAction(props) { |
| 1693 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Chip, _extends$1({ |
| 1694 |
size: "large", |
| 1695 |
color: "secondary", |
| 1696 |
variant: "outlined" |
| 1697 |
}, props)); |
| 1698 |
}; |
| 1699 |
|
| 1700 |
//#endregion |
| 1701 |
//#region modules/ai/assets/js/editor/components/prompt-error-message.js |
| 1702 |
var import_prop_types$7, _excluded$33, PromptErrorMessage; |
| 1703 |
var init_prompt_error_message = __esmMin((() => { |
| 1704 |
init_extends(); |
| 1705 |
init_objectWithoutProperties$1(); |
| 1706 |
import_prop_types$7 = /* @__PURE__ */ __toESM(require_prop_types()); |
| 1707 |
_excluded$33 = [ |
| 1708 |
"error", |
| 1709 |
"onRetry", |
| 1710 |
"actionPosition" |
| 1711 |
]; |
| 1712 |
PromptErrorMessage = function PromptErrorMessage(_ref) { |
| 1713 |
var error = _ref.error; |
| 1714 |
var _ref$onRetry = _ref.onRetry; |
| 1715 |
var onRetry = _ref$onRetry === void 0 ? function() {} : _ref$onRetry; |
| 1716 |
var _ref$actionPosition = _ref.actionPosition; |
| 1717 |
var actionPosition = _ref$actionPosition === void 0 ? "default" : _ref$actionPosition; |
| 1718 |
var props = _objectWithoutProperties$1(_ref, _excluded$33); |
| 1719 |
function getQuotaReachedTrailMessage(featureName) { |
| 1720 |
if (!featureName) return { |
| 1721 |
text: /*#__PURE__*/ react.default.createElement(_elementor_ui.AlertTitle, null, (0, _wordpress_i18n.__)("It's time to upgrade.", "elementor")), |
| 1722 |
description: (0, _wordpress_i18n.__)("Enjoy the free trial? Upgrade now for unlimited access to built-in image, text and custom code generators.", "elementor"), |
| 1723 |
buttonText: (0, _wordpress_i18n.__)("Upgrade", "elementor"), |
| 1724 |
buttonAction: function buttonAction() { |
| 1725 |
return window.open("https://go.elementor.com/ai-popup-purchase-limit-reached/", "_blank"); |
| 1726 |
} |
| 1727 |
}; |
| 1728 |
return { |
| 1729 |
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())), |
| 1730 |
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"), |
| 1731 |
buttonText: (0, _wordpress_i18n.__)("Upgrade now", "elementor"), |
| 1732 |
buttonAction: function buttonAction() { |
| 1733 |
return window.open("https://go.elementor.com/ai-popup-purchase-limit-reached/", "_blank"); |
| 1734 |
} |
| 1735 |
}; |
| 1736 |
} |
| 1737 |
function getErrorMessage() { |
| 1738 |
var _error$extra_data; |
| 1739 |
var errMsg = error.message || error; |
| 1740 |
var featureName = (_error$extra_data = error.extra_data) === null || _error$extra_data === void 0 ? void 0 : _error$extra_data.featureName; |
| 1741 |
var messages = { |
| 1742 |
default: { |
| 1743 |
text: /*#__PURE__*/ react.default.createElement(_elementor_ui.AlertTitle, null, (0, _wordpress_i18n.__)("There was a glitch.", "elementor")), |
| 1744 |
description: (0, _wordpress_i18n.__)("Wait a moment and give it another go, or try tweaking the prompt.", "elementor"), |
| 1745 |
buttonText: (0, _wordpress_i18n.__)("Try again", "elementor"), |
| 1746 |
buttonAction: onRetry |
| 1747 |
}, |
| 1748 |
service_outage_internal: { |
| 1749 |
text: /*#__PURE__*/ react.default.createElement(_elementor_ui.AlertTitle, null, (0, _wordpress_i18n.__)("There was a glitch.", "elementor")), |
| 1750 |
description: (0, _wordpress_i18n.__)("Wait a moment and give it another go.", "elementor"), |
| 1751 |
buttonText: (0, _wordpress_i18n.__)("Try again", "elementor"), |
| 1752 |
buttonAction: onRetry |
| 1753 |
}, |
| 1754 |
invalid_connect_data: { |
| 1755 |
text: /*#__PURE__*/ react.default.createElement(_elementor_ui.AlertTitle, null, (0, _wordpress_i18n.__)("There was a glitch.", "elementor")), |
| 1756 |
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", { |
| 1757 |
href: "https://elementor.com/help/disconnecting-reconnecting-your-elementor-account/", |
| 1758 |
target: "_blank", |
| 1759 |
rel: "noreferrer" |
| 1760 |
}, (0, _wordpress_i18n.__)("Show me how", "elementor"))), |
| 1761 |
buttonText: (0, _wordpress_i18n.__)("Reconnect", "elementor"), |
| 1762 |
buttonAction: function buttonAction() { |
| 1763 |
return window.open(window.ElementorAiConfig.connect_url); |
| 1764 |
} |
| 1765 |
}, |
| 1766 |
not_connected: { |
| 1767 |
text: /*#__PURE__*/ react.default.createElement(_elementor_ui.AlertTitle, null, (0, _wordpress_i18n.__)("You aren't connected to Elementor AI.", "elementor")), |
| 1768 |
description: (0, _wordpress_i18n.__)("Elementor AI is just a few clicks away. Connect your account to instantly create texts and custom code.", "elementor"), |
| 1769 |
buttonText: (0, _wordpress_i18n.__)("Connect", "elementor"), |
| 1770 |
buttonAction: function buttonAction() { |
| 1771 |
return window.open(window.ElementorAiConfig.connect_url); |
| 1772 |
} |
| 1773 |
}, |
| 1774 |
quota_reached_trail: getQuotaReachedTrailMessage(featureName), |
| 1775 |
quota_reached_subscription: { |
| 1776 |
text: /*#__PURE__*/ react.default.createElement(_elementor_ui.AlertTitle, null, (0, _wordpress_i18n.__)("Looks like you're out of credits.", "elementor")), |
| 1777 |
description: (0, _wordpress_i18n.__)("Ready to take it to the next level?", "elementor"), |
| 1778 |
buttonText: (0, _wordpress_i18n.__)("Upgrade now", "elementor"), |
| 1779 |
buttonAction: function buttonAction() { |
| 1780 |
return window.open("https://go.elementor.com/ai-popup-purchase-limit-reached/", "_blank"); |
| 1781 |
} |
| 1782 |
}, |
| 1783 |
rate_limit_network: { |
| 1784 |
text: /*#__PURE__*/ react.default.createElement(_elementor_ui.AlertTitle, null, (0, _wordpress_i18n.__)("Whoa! Slow down there.", "elementor")), |
| 1785 |
description: (0, _wordpress_i18n.__)("We can’t process that many requests so fast. Try again in 15 minutes.", "elementor") |
| 1786 |
}, |
| 1787 |
invalid_prompts: { |
| 1788 |
text: /*#__PURE__*/ react.default.createElement(_elementor_ui.AlertTitle, null, (0, _wordpress_i18n.__)("We were unable to generate that prompt.", "elementor")), |
| 1789 |
description: (0, _wordpress_i18n.__)("Seems like the prompt contains words that could generate harmful content. Write a different prompt to continue.", "elementor") |
| 1790 |
}, |
| 1791 |
service_unavailable: { |
| 1792 |
text: /*#__PURE__*/ react.default.createElement(_elementor_ui.AlertTitle, null, (0, _wordpress_i18n.__)("There was a glitch.", "elementor")), |
| 1793 |
description: (0, _wordpress_i18n.__)("Wait a moment and give it another go, or try tweaking the prompt.", "elementor"), |
| 1794 |
buttonText: (0, _wordpress_i18n.__)("Try again", "elementor"), |
| 1795 |
buttonAction: onRetry |
| 1796 |
}, |
| 1797 |
request_timeout_error: { |
| 1798 |
text: /*#__PURE__*/ react.default.createElement(_elementor_ui.AlertTitle, null, (0, _wordpress_i18n.__)("There was a glitch.", "elementor")), |
| 1799 |
description: (0, _wordpress_i18n.__)("Wait a moment and give it another go, or try tweaking the prompt.", "elementor"), |
| 1800 |
buttonText: (0, _wordpress_i18n.__)("Try again", "elementor"), |
| 1801 |
buttonAction: onRetry |
| 1802 |
}, |
| 1803 |
invalid_token: { |
| 1804 |
text: /*#__PURE__*/ react.default.createElement(_elementor_ui.AlertTitle, null, (0, _wordpress_i18n.__)("Try again", "elementor")), |
| 1805 |
description: (0, _wordpress_i18n.__)("Try exiting Elementor and sign in again.", "elementor"), |
| 1806 |
buttonText: (0, _wordpress_i18n.__)("Reconnect", "elementor"), |
| 1807 |
buttonAction: onRetry |
| 1808 |
}, |
| 1809 |
file_too_large: { |
| 1810 |
text: /*#__PURE__*/ react.default.createElement(_elementor_ui.AlertTitle, null, (0, _wordpress_i18n.__)("The file is too large.", "elementor")), |
| 1811 |
description: (0, _wordpress_i18n.__)("Please upload a file that is less than 4MB.", "elementor") |
| 1812 |
}, |
| 1813 |
image_resolution_maximum_exceeded: { |
| 1814 |
text: /*#__PURE__*/ react.default.createElement(_elementor_ui.AlertTitle, null, (0, _wordpress_i18n.__)("The image resolution exceeds the maximum allowed size.", "elementor")), |
| 1815 |
description: (0, _wordpress_i18n.__)("Please upload a file with dimensions less than 2048x2048 pixels.", "elementor") |
| 1816 |
}, |
| 1817 |
external_service_unavailable: { |
| 1818 |
text: /*#__PURE__*/ react.default.createElement(_elementor_ui.AlertTitle, null, (0, _wordpress_i18n.__)("Temporary external service issue", "elementor")), |
| 1819 |
description: (0, _wordpress_i18n.__)("It seems that one of our partner services is temporarily unavailable. Please try again in a few minutes.", "elementor"), |
| 1820 |
buttonText: (0, _wordpress_i18n.__)("Try Again", "elementor"), |
| 1821 |
buttonAction: onRetry |
| 1822 |
} |
| 1823 |
}; |
| 1824 |
return messages[errMsg] || messages.default; |
| 1825 |
} |
| 1826 |
var message = getErrorMessage(); |
| 1827 |
var action = (message === null || message === void 0 ? void 0 : message.buttonText) && /*#__PURE__*/ react.default.createElement(_elementor_ui.Button, { |
| 1828 |
color: "inherit", |
| 1829 |
size: "small", |
| 1830 |
variant: "outlined", |
| 1831 |
onClick: message.buttonAction |
| 1832 |
}, message.buttonText); |
| 1833 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Alert, _extends$1({ |
| 1834 |
severity: message.severity || "error", |
| 1835 |
action: "default" === actionPosition && action |
| 1836 |
}, props), message.text, message.description, "bottom" === actionPosition && /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, { sx: { mt: 1 } }, action)); |
| 1837 |
}; |
| 1838 |
PromptErrorMessage.propTypes = { |
| 1839 |
error: import_prop_types$7.default.oneOfType([import_prop_types$7.default.object, import_prop_types$7.default.string]), |
| 1840 |
onRetry: import_prop_types$7.default.func, |
| 1841 |
actionPosition: import_prop_types$7.default.oneOf(["default", "bottom"]) |
| 1842 |
}; |
| 1843 |
})); |
| 1844 |
|
| 1845 |
//#endregion |
| 1846 |
//#region modules/ai/assets/js/editor/api/index.js |
| 1847 |
function ownKeys$32(e, r) { |
| 1848 |
var t = Object.keys(e); |
| 1849 |
if (Object.getOwnPropertySymbols) { |
| 1850 |
var o = Object.getOwnPropertySymbols(e); |
| 1851 |
r && (o = o.filter(function(r) { |
| 1852 |
return Object.getOwnPropertyDescriptor(e, r).enumerable; |
| 1853 |
})), t.push.apply(t, o); |
| 1854 |
} |
| 1855 |
return t; |
| 1856 |
} |
| 1857 |
function _objectSpread$31(e) { |
| 1858 |
for (var r = 1; r < arguments.length; r++) { |
| 1859 |
var t = null != arguments[r] ? arguments[r] : {}; |
| 1860 |
r % 2 ? ownKeys$32(Object(t), !0).forEach(function(r) { |
| 1861 |
_defineProperty$1(e, r, t[r]); |
| 1862 |
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$32(Object(t)).forEach(function(r) { |
| 1863 |
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); |
| 1864 |
}); |
| 1865 |
} |
| 1866 |
return e; |
| 1867 |
} |
| 1868 |
var request, getUserInformation, getRemoteConfig, getRemoteFrontendConfig, getCompletionText, getExcerpt, getFeaturedImage, getEditText, getCustomCode, getCustomCSS, setGetStarted, setStatusFeedback, getTextToImageGeneration, getImageToImageGeneration, getImageToImageMaskCleanup, getImageToImageMaskGeneration, getImageToImageOutPainting, getImageToImageUpscale, getImageToImageRemoveBackground, getImageToImageIsolateObjects, getImageToImageReplaceBackground, getImagePromptEnhanced, getProductImageUnification, getAnimation, uploadImage, generateLayout, getLayoutPromptEnhanced, getHistory, deleteHistoryItem; |
| 1869 |
var init_api = __esmMin((() => { |
| 1870 |
init_defineProperty$1(); |
| 1871 |
__name(ownKeys$32, "ownKeys"); |
| 1872 |
__name(_objectSpread$31, "_objectSpread"); |
| 1873 |
request = function request(endpoint) { |
| 1874 |
var data = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; |
| 1875 |
var immediately = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false; |
| 1876 |
var signal = arguments.length > 3 ? arguments[3] : void 0; |
| 1877 |
if (Object.keys(data).length) if (window.elementorAiCurrentContext) data.context = window.elementorAiCurrentContext; |
| 1878 |
else data.context = window.elementorWpAiCurrentContext; |
| 1879 |
return new Promise(function(resolve, reject) { |
| 1880 |
var ajaxData = elementorCommon.ajax.addRequest(endpoint, { |
| 1881 |
success: resolve, |
| 1882 |
error: reject, |
| 1883 |
data, |
| 1884 |
unique_id: data.unique_id |
| 1885 |
}, immediately); |
| 1886 |
if (signal && ajaxData.jqXhr) signal.addEventListener("abort", ajaxData.jqXhr.abort); |
| 1887 |
}); |
| 1888 |
}; |
| 1889 |
getUserInformation = function getUserInformation(immediately) { |
| 1890 |
return request("ai_get_user_information", void 0, immediately); |
| 1891 |
}; |
| 1892 |
getRemoteConfig = function getRemoteConfig() { |
| 1893 |
return request("ai_get_remote_config"); |
| 1894 |
}; |
| 1895 |
getRemoteFrontendConfig = function getRemoteFrontendConfig(payload, immediately) { |
| 1896 |
return request("ai_get_remote_frontend_config", { payload }, immediately); |
| 1897 |
}; |
| 1898 |
getCompletionText = function getCompletionText(payload) { |
| 1899 |
return request("ai_get_completion_text", { payload }); |
| 1900 |
}; |
| 1901 |
getExcerpt = function getExcerpt(payload) { |
| 1902 |
return request("ai_get_excerpt", { payload }); |
| 1903 |
}; |
| 1904 |
getFeaturedImage = function getFeaturedImage(payload) { |
| 1905 |
return request("ai_get_featured_image", { payload }); |
| 1906 |
}; |
| 1907 |
getEditText = function getEditText(payload) { |
| 1908 |
return request("ai_get_edit_text", { payload }); |
| 1909 |
}; |
| 1910 |
getCustomCode = function getCustomCode(payload) { |
| 1911 |
return request("ai_get_custom_code", { payload }); |
| 1912 |
}; |
| 1913 |
getCustomCSS = function getCustomCSS(payload) { |
| 1914 |
return request("ai_get_custom_css", { payload }); |
| 1915 |
}; |
| 1916 |
setGetStarted = function setGetStarted() { |
| 1917 |
return request("ai_set_get_started"); |
| 1918 |
}; |
| 1919 |
setStatusFeedback = function setStatusFeedback(responseId) { |
| 1920 |
return request("ai_set_status_feedback", { response_id: responseId }, true); |
| 1921 |
}; |
| 1922 |
getTextToImageGeneration = function getTextToImageGeneration(payload) { |
| 1923 |
return request("ai_get_text_to_image", { payload }); |
| 1924 |
}; |
| 1925 |
getImageToImageGeneration = function getImageToImageGeneration(payload) { |
| 1926 |
return request("ai_get_image_to_image", { payload }); |
| 1927 |
}; |
| 1928 |
getImageToImageMaskCleanup = function getImageToImageMaskCleanup(payload) { |
| 1929 |
return request("ai_get_image_to_image_mask_cleanup", { payload }); |
| 1930 |
}; |
| 1931 |
getImageToImageMaskGeneration = function getImageToImageMaskGeneration(payload) { |
| 1932 |
return request("ai_get_image_to_image_mask", { payload }); |
| 1933 |
}; |
| 1934 |
getImageToImageOutPainting = function getImageToImageOutPainting(payload) { |
| 1935 |
return request("ai_get_image_to_image_outpainting", { payload }); |
| 1936 |
}; |
| 1937 |
getImageToImageUpscale = function getImageToImageUpscale(payload) { |
| 1938 |
return request("ai_get_image_to_image_upscale", { payload }); |
| 1939 |
}; |
| 1940 |
getImageToImageRemoveBackground = function getImageToImageRemoveBackground(payload) { |
| 1941 |
return request("ai_get_image_to_image_remove_background", { payload }); |
| 1942 |
}; |
| 1943 |
getImageToImageIsolateObjects = function getImageToImageIsolateObjects(payload) { |
| 1944 |
return request("ai_get_image_to_image_isolate_objects", { payload }); |
| 1945 |
}; |
| 1946 |
getImageToImageReplaceBackground = function getImageToImageReplaceBackground(payload) { |
| 1947 |
return request("ai_get_image_to_image_replace_background", { payload }); |
| 1948 |
}; |
| 1949 |
getImagePromptEnhanced = function getImagePromptEnhanced(prompt) { |
| 1950 |
return request("ai_get_image_prompt_enhancer", { prompt }); |
| 1951 |
}; |
| 1952 |
getProductImageUnification = function getProductImageUnification(payload, immediately) { |
| 1953 |
return request("ai_get_product_image_unification", { payload }, immediately); |
| 1954 |
}; |
| 1955 |
getAnimation = function getAnimation(payload) { |
| 1956 |
return request("ai_get_animation", { payload }); |
| 1957 |
}; |
| 1958 |
uploadImage = function uploadImage(image) { |
| 1959 |
return request("ai_upload_image", _objectSpread$31(_objectSpread$31({}, image), {}, { |
| 1960 |
editor_post_id: image.image.editor_post_id, |
| 1961 |
unique_id: image.image.unique_id |
| 1962 |
})); |
| 1963 |
}; |
| 1964 |
generateLayout = function generateLayout(requestBody, signal) { |
| 1965 |
return request("ai_generate_layout", requestBody, true, signal); |
| 1966 |
}; |
| 1967 |
getLayoutPromptEnhanced = function getLayoutPromptEnhanced(prompt, enhanceType) { |
| 1968 |
return request("ai_get_layout_prompt_enhancer", { |
| 1969 |
prompt, |
| 1970 |
enhance_type: enhanceType |
| 1971 |
}); |
| 1972 |
}; |
| 1973 |
getHistory = function getHistory(type, page, limit) { |
| 1974 |
return request("ai_get_history", { |
| 1975 |
type, |
| 1976 |
page, |
| 1977 |
limit |
| 1978 |
}); |
| 1979 |
}; |
| 1980 |
deleteHistoryItem = function deleteHistoryItem(id) { |
| 1981 |
return request("ai_delete_history_item", { id }); |
| 1982 |
}; |
| 1983 |
})); |
| 1984 |
|
| 1985 |
//#endregion |
| 1986 |
//#region modules/ai/assets/js/editor/context/requests-ids.js |
| 1987 |
var import_prop_types$6, Context, useRequestIds, getUniqueId, RequestIdsProvider; |
| 1988 |
var init_requests_ids = __esmMin((() => { |
| 1989 |
import_prop_types$6 = /* @__PURE__ */ __toESM(require_prop_types()); |
| 1990 |
Context = (0, react.createContext)({}); |
| 1991 |
useRequestIds = function useRequestIds() { |
| 1992 |
var context = (0, react.useContext)(Context); |
| 1993 |
if (!context) throw new Error("useRequestIds must be used within a RequestIdsProvider"); |
| 1994 |
return context; |
| 1995 |
}; |
| 1996 |
getUniqueId = function getUniqueId(prefix) { |
| 1997 |
return prefix + "-" + Math.random().toString(16).substr(2, 7); |
| 1998 |
}; |
| 1999 |
window.EDITOR_SESSION_ID = window.EDITOR_SESSION_ID || getUniqueId("editor-session"); |
| 2000 |
RequestIdsProvider = function RequestIdsProvider(props) { |
| 2001 |
var editorSessionId = (0, react.useRef)(window.EDITOR_SESSION_ID); |
| 2002 |
var sessionId = (0, react.useRef)(""); |
| 2003 |
var generateId = (0, react.useRef)(""); |
| 2004 |
var batchId = (0, react.useRef)(""); |
| 2005 |
var requestId = (0, react.useRef)(""); |
| 2006 |
sessionId.current = getUniqueId("session"); |
| 2007 |
var setGenerate = function setGenerate() { |
| 2008 |
generateId.current = getUniqueId("generate"); |
| 2009 |
return generateId; |
| 2010 |
}; |
| 2011 |
var setBatch = function setBatch() { |
| 2012 |
batchId.current = getUniqueId("batch"); |
| 2013 |
return batchId; |
| 2014 |
}; |
| 2015 |
var setRequest = function setRequest() { |
| 2016 |
requestId.current = getUniqueId("request"); |
| 2017 |
return requestId; |
| 2018 |
}; |
| 2019 |
var _useState2 = _slicedToArray((0, react.useState)(0), 2); |
| 2020 |
var usagePercentage = _useState2[0]; |
| 2021 |
var setUsagePercentage = _useState2[1]; |
| 2022 |
return /*#__PURE__*/ react.default.createElement(Context.Provider, { value: { |
| 2023 |
editorSessionId, |
| 2024 |
sessionId, |
| 2025 |
generateId, |
| 2026 |
batchId, |
| 2027 |
requestId, |
| 2028 |
setGenerate, |
| 2029 |
setBatch, |
| 2030 |
setRequest, |
| 2031 |
usagePercentage, |
| 2032 |
updateUsagePercentage: function updateUsagePercentage(newPercentage) { |
| 2033 |
setUsagePercentage(newPercentage); |
| 2034 |
} |
| 2035 |
} }, props.children); |
| 2036 |
}; |
| 2037 |
RequestIdsProvider.propTypes = { children: import_prop_types$6.default.node.isRequired }; |
| 2038 |
})); |
| 2039 |
|
| 2040 |
//#endregion |
| 2041 |
//#region modules/ai/assets/js/editor/hooks/use-prompt.js |
| 2042 |
function ownKeys$31(e, r) { |
| 2043 |
var t = Object.keys(e); |
| 2044 |
if (Object.getOwnPropertySymbols) { |
| 2045 |
var o = Object.getOwnPropertySymbols(e); |
| 2046 |
r && (o = o.filter(function(r) { |
| 2047 |
return Object.getOwnPropertyDescriptor(e, r).enumerable; |
| 2048 |
})), t.push.apply(t, o); |
| 2049 |
} |
| 2050 |
return t; |
| 2051 |
} |
| 2052 |
function _objectSpread$30(e) { |
| 2053 |
for (var r = 1; r < arguments.length; r++) { |
| 2054 |
var t = null != arguments[r] ? arguments[r] : {}; |
| 2055 |
r % 2 ? ownKeys$31(Object(t), !0).forEach(function(r) { |
| 2056 |
_defineProperty$1(e, r, t[r]); |
| 2057 |
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$31(Object(t)).forEach(function(r) { |
| 2058 |
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); |
| 2059 |
}); |
| 2060 |
} |
| 2061 |
return e; |
| 2062 |
} |
| 2063 |
var _excluded$32, normalizeResponse, usePrompt; |
| 2064 |
var init_use_prompt = __esmMin((() => { |
| 2065 |
init_defineProperty$1(); |
| 2066 |
init_slicedToArray(); |
| 2067 |
init_objectWithoutProperties$1(); |
| 2068 |
init_api(); |
| 2069 |
init_requests_ids(); |
| 2070 |
_excluded$32 = [ |
| 2071 |
"text", |
| 2072 |
"response_id", |
| 2073 |
"usage", |
| 2074 |
"images" |
| 2075 |
]; |
| 2076 |
__name(ownKeys$31, "ownKeys"); |
| 2077 |
__name(_objectSpread$30, "_objectSpread"); |
| 2078 |
normalizeResponse = function normalizeResponse(_ref) { |
| 2079 |
var text = _ref.text; |
| 2080 |
var responseId = _ref.response_id; |
| 2081 |
var usage = _ref.usage; |
| 2082 |
var images = _ref.images; |
| 2083 |
var optional = _objectWithoutProperties$1(_ref, _excluded$32); |
| 2084 |
var creditsData = usage ? usage.quota - usage.usedQuota : 0; |
| 2085 |
var normalized = { |
| 2086 |
result: text || images, |
| 2087 |
responseId, |
| 2088 |
credits: Math.max(creditsData, 0), |
| 2089 |
usagePercentage: usage === null || usage === void 0 ? void 0 : usage.usagePercentage |
| 2090 |
}; |
| 2091 |
if (optional.base_template_id) normalized.baseTemplateId = optional.base_template_id; |
| 2092 |
normalized.type = optional.template_type; |
| 2093 |
return normalized; |
| 2094 |
}; |
| 2095 |
usePrompt = function usePrompt(fetchData, initialState) { |
| 2096 |
var _useState2 = _slicedToArray((0, react.useState)(false), 2); |
| 2097 |
var isLoading = _useState2[0]; |
| 2098 |
var setIsLoading = _useState2[1]; |
| 2099 |
var _useState4 = _slicedToArray((0, react.useState)(""), 2); |
| 2100 |
var error = _useState4[0]; |
| 2101 |
var setError = _useState4[1]; |
| 2102 |
var _useState6 = _slicedToArray((0, react.useState)(initialState), 2); |
| 2103 |
var data = _useState6[0]; |
| 2104 |
var setData = _useState6[1]; |
| 2105 |
var _useRequestIds = useRequestIds(); |
| 2106 |
var updateUsagePercentage = _useRequestIds.updateUsagePercentage; |
| 2107 |
var usagePercentage = _useRequestIds.usagePercentage; |
| 2108 |
var send = (0, react.useRef)(/*#__PURE__*/ function() { |
| 2109 |
var _ref2 = _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$3.default.mark(function _callee(payload) { |
| 2110 |
return import_regenerator$3.default.wrap(function(_context) { |
| 2111 |
while (1) switch (_context.prev = _context.next) { |
| 2112 |
case 0: return _context.abrupt("return", payload); |
| 2113 |
case 1: |
| 2114 |
case "end": return _context.stop(); |
| 2115 |
} |
| 2116 |
}, _callee); |
| 2117 |
})); |
| 2118 |
return function(_x) { |
| 2119 |
return _ref2.apply(this, arguments); |
| 2120 |
}; |
| 2121 |
}()); |
| 2122 |
var sendUsageData = (0, react.useRef)(function() {}); |
| 2123 |
(0, react.useEffect)(function() { |
| 2124 |
var newUsageValue = data === null || data === void 0 ? void 0 : data.usagePercentage; |
| 2125 |
if (newUsageValue && newUsageValue !== usagePercentage) updateUsagePercentage(newUsageValue); |
| 2126 |
}, [ |
| 2127 |
data, |
| 2128 |
usagePercentage, |
| 2129 |
updateUsagePercentage |
| 2130 |
]); |
| 2131 |
var _useRequestIds2 = useRequestIds(); |
| 2132 |
var setRequest = _useRequestIds2.setRequest; |
| 2133 |
var editorSessionId = _useRequestIds2.editorSessionId; |
| 2134 |
var sessionId = _useRequestIds2.sessionId; |
| 2135 |
var generateId = _useRequestIds2.generateId; |
| 2136 |
var batchId = _useRequestIds2.batchId; |
| 2137 |
send.current = (0, react.useCallback)(/*#__PURE__*/ function() { |
| 2138 |
var _ref3 = _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$3.default.mark(function _callee2(payload) { |
| 2139 |
return import_regenerator$3.default.wrap(function(_context2) { |
| 2140 |
while (1) switch (_context2.prev = _context2.next) { |
| 2141 |
case 0: return _context2.abrupt("return", new Promise(function(resolve, reject) { |
| 2142 |
setError(""); |
| 2143 |
setIsLoading(true); |
| 2144 |
var requestId = setRequest(); |
| 2145 |
var requestIds = { |
| 2146 |
editorSessionId: editorSessionId.current, |
| 2147 |
sessionId: sessionId.current, |
| 2148 |
generateId: generateId.current, |
| 2149 |
batchId: batchId.current, |
| 2150 |
requestId: requestId.current |
| 2151 |
}; |
| 2152 |
payload = _objectSpread$30(_objectSpread$30({}, payload), {}, { requestIds }); |
| 2153 |
fetchData(payload).then(function(result) { |
| 2154 |
var normalizedData = normalizeResponse(result); |
| 2155 |
setData(normalizedData); |
| 2156 |
resolve(normalizedData); |
| 2157 |
}).catch(function(err) { |
| 2158 |
var finalError = (err === null || err === void 0 ? void 0 : err.responseText) || err; |
| 2159 |
setError(finalError); |
| 2160 |
reject(finalError); |
| 2161 |
}).finally(function() { |
| 2162 |
return setIsLoading(false); |
| 2163 |
}); |
| 2164 |
})); |
| 2165 |
case 1: |
| 2166 |
case "end": return _context2.stop(); |
| 2167 |
} |
| 2168 |
}, _callee2); |
| 2169 |
})); |
| 2170 |
return function(_x2) { |
| 2171 |
return _ref3.apply(this, arguments); |
| 2172 |
}; |
| 2173 |
}(), [ |
| 2174 |
batchId, |
| 2175 |
editorSessionId, |
| 2176 |
fetchData, |
| 2177 |
generateId, |
| 2178 |
sessionId, |
| 2179 |
setRequest |
| 2180 |
]); |
| 2181 |
sendUsageData.current = (0, react.useCallback)(function() { |
| 2182 |
var usageData = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : data; |
| 2183 |
return usageData.responseId && setStatusFeedback(usageData.responseId); |
| 2184 |
}, [data]); |
| 2185 |
return { |
| 2186 |
isLoading, |
| 2187 |
error, |
| 2188 |
data, |
| 2189 |
setResult: function setResult(result) { |
| 2190 |
var responseId = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null; |
| 2191 |
var updatedResult = _objectSpread$30({}, data); |
| 2192 |
updatedResult.result = result; |
| 2193 |
if (responseId) updatedResult.responseId = responseId; |
| 2194 |
setData(updatedResult); |
| 2195 |
}, |
| 2196 |
reset: function reset() { |
| 2197 |
setData(function(_ref4) { |
| 2198 |
return { |
| 2199 |
credits: _ref4.credits, |
| 2200 |
result: "", |
| 2201 |
responseId: "" |
| 2202 |
}; |
| 2203 |
}); |
| 2204 |
setError(""); |
| 2205 |
setIsLoading(false); |
| 2206 |
}, |
| 2207 |
send: send.current, |
| 2208 |
sendUsageData: sendUsageData.current |
| 2209 |
}; |
| 2210 |
}; |
| 2211 |
})); |
| 2212 |
|
| 2213 |
//#endregion |
| 2214 |
//#region modules/ai/assets/js/editor/hooks/use-text-prompt.js |
| 2215 |
init_prompt_error_message(); |
| 2216 |
init_asyncToGenerator(); |
| 2217 |
var import_regenerator$2 = /* @__PURE__ */ __toESM(require_regenerator()); |
| 2218 |
init_api(); |
| 2219 |
init_use_prompt(); |
| 2220 |
var getTextResult = /*#__PURE__*/ function() { |
| 2221 |
var _ref = _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee(payload) { |
| 2222 |
return import_regenerator$2.default.wrap(function(_context) { |
| 2223 |
while (1) switch (_context.prev = _context.next) { |
| 2224 |
case 0: |
| 2225 |
if (!(payload !== null && payload !== void 0 && payload.instruction)) { |
| 2226 |
_context.next = 1; |
| 2227 |
break; |
| 2228 |
} |
| 2229 |
return _context.abrupt("return", getEditText(payload)); |
| 2230 |
case 1: return _context.abrupt("return", getCompletionText(payload)); |
| 2231 |
case 2: |
| 2232 |
case "end": return _context.stop(); |
| 2233 |
} |
| 2234 |
}, _callee); |
| 2235 |
})); |
| 2236 |
return function getTextResult(_x) { |
| 2237 |
return _ref.apply(this, arguments); |
| 2238 |
}; |
| 2239 |
}(); |
| 2240 |
var useTextPrompt = function useTextPrompt(initialValue) { |
| 2241 |
return usePrompt(getTextResult, initialValue); |
| 2242 |
}; |
| 2243 |
|
| 2244 |
//#endregion |
| 2245 |
//#region modules/ai/assets/js/editor/actions-data.js |
| 2246 |
var textAutocomplete, textareaAutocomplete, codeHtmlAutocomplete, codeCssAutocomplete, vocalTones, translateLanguages, motionEffectAutocomplete, hoverEffectAutocomplete; |
| 2247 |
var init_actions_data = __esmMin((() => { |
| 2248 |
textAutocomplete = [ |
| 2249 |
(0, _wordpress_i18n.__)("Craft a catchy slogan for", "elementor"), |
| 2250 |
(0, _wordpress_i18n.__)("Write a strong section header for", "elementor"), |
| 2251 |
(0, _wordpress_i18n.__)("Create a blog title for", "elementor"), |
| 2252 |
(0, _wordpress_i18n.__)("Suggest a 4 word headline for", "elementor"), |
| 2253 |
(0, _wordpress_i18n.__)("Write an attention grabbing title for", "elementor") |
| 2254 |
]; |
| 2255 |
textareaAutocomplete = [ |
| 2256 |
(0, _wordpress_i18n.__)("Write a product description for", "elementor"), |
| 2257 |
(0, _wordpress_i18n.__)("Create a blog post for", "elementor"), |
| 2258 |
(0, _wordpress_i18n.__)("Craft an about us section for", "elementor"), |
| 2259 |
(0, _wordpress_i18n.__)("Offer a few sentences to invite visitors to", "elementor"), |
| 2260 |
(0, _wordpress_i18n.__)("Write microcopy for a submission form that includes", "elementor") |
| 2261 |
]; |
| 2262 |
codeHtmlAutocomplete = [ |
| 2263 |
(0, _wordpress_i18n.__)("GA event fired on every button element click (assume GA was loaded)", "elementor"), |
| 2264 |
(0, _wordpress_i18n.__)("Iframe code to embed a Spotify widget on my web page. My ID is 1234567890", "elementor"), |
| 2265 |
(0, _wordpress_i18n.__)("Write an embed code of Google Analytics", "elementor"), |
| 2266 |
(0, _wordpress_i18n.__)("Write an embed code of Facebook Pixel", "elementor"), |
| 2267 |
(0, _wordpress_i18n.__)("HTML code that embeds the following PDF into a webpage: link to PDF", "elementor") |
| 2268 |
]; |
| 2269 |
codeCssAutocomplete = [ |
| 2270 |
(0, _wordpress_i18n.__)("On hover, animate 20% bigger, rotate 10 deg CCW", "elementor"), |
| 2271 |
(0, _wordpress_i18n.__)("Add a circle-shaped clip mask, semi transparent on hover", "elementor"), |
| 2272 |
(0, _wordpress_i18n.__)("Rainbow colored animated text gradient", "elementor"), |
| 2273 |
(0, _wordpress_i18n.__)("Add a 3D shadow to the text", "elementor") |
| 2274 |
]; |
| 2275 |
vocalTones = [ |
| 2276 |
{ label: (0, _wordpress_i18n.__)("Casual", "elementor") }, |
| 2277 |
{ label: (0, _wordpress_i18n.__)("Confidence", "elementor") }, |
| 2278 |
{ label: (0, _wordpress_i18n.__)("Formal", "elementor") }, |
| 2279 |
{ label: (0, _wordpress_i18n.__)("Friendly", "elementor") }, |
| 2280 |
{ label: (0, _wordpress_i18n.__)("Inspirational", "elementor") }, |
| 2281 |
{ label: (0, _wordpress_i18n.__)("Motivational", "elementor") }, |
| 2282 |
{ label: (0, _wordpress_i18n.__)("Nostalgic", "elementor") }, |
| 2283 |
{ label: (0, _wordpress_i18n.__)("Playful", "elementor") }, |
| 2284 |
{ label: (0, _wordpress_i18n.__)("Professional", "elementor") }, |
| 2285 |
{ label: (0, _wordpress_i18n.__)("Scientific", "elementor") }, |
| 2286 |
{ label: (0, _wordpress_i18n.__)("Straightforward", "elementor") }, |
| 2287 |
{ label: (0, _wordpress_i18n.__)("Witty", "elementor") } |
| 2288 |
]; |
| 2289 |
translateLanguages = [ |
| 2290 |
{ |
| 2291 |
label: (0, _wordpress_i18n.__)("Arabic", "elementor"), |
| 2292 |
value: "ar-SA" |
| 2293 |
}, |
| 2294 |
{ |
| 2295 |
label: (0, _wordpress_i18n.__)("Chinese", "elementor"), |
| 2296 |
value: "zh-CN" |
| 2297 |
}, |
| 2298 |
{ |
| 2299 |
label: (0, _wordpress_i18n.__)("Czech", "elementor"), |
| 2300 |
value: "cs-CZ" |
| 2301 |
}, |
| 2302 |
{ |
| 2303 |
label: (0, _wordpress_i18n.__)("Danish", "elementor"), |
| 2304 |
value: "da-DK" |
| 2305 |
}, |
| 2306 |
{ |
| 2307 |
label: (0, _wordpress_i18n.__)("Dutch", "elementor"), |
| 2308 |
value: "nl-NL" |
| 2309 |
}, |
| 2310 |
{ |
| 2311 |
label: (0, _wordpress_i18n.__)("English", "elementor"), |
| 2312 |
value: "en-US" |
| 2313 |
}, |
| 2314 |
{ |
| 2315 |
label: (0, _wordpress_i18n.__)("Finnish", "elementor"), |
| 2316 |
value: "fi-FI" |
| 2317 |
}, |
| 2318 |
{ |
| 2319 |
label: (0, _wordpress_i18n.__)("French", "elementor"), |
| 2320 |
value: "fr-FR" |
| 2321 |
}, |
| 2322 |
{ |
| 2323 |
label: (0, _wordpress_i18n.__)("German", "elementor"), |
| 2324 |
value: "de-DE" |
| 2325 |
}, |
| 2326 |
{ |
| 2327 |
label: (0, _wordpress_i18n.__)("Greek", "elementor"), |
| 2328 |
value: "el-GR" |
| 2329 |
}, |
| 2330 |
{ |
| 2331 |
label: (0, _wordpress_i18n.__)("Hebrew", "elementor"), |
| 2332 |
value: "he-IL" |
| 2333 |
}, |
| 2334 |
{ |
| 2335 |
label: (0, _wordpress_i18n.__)("Hungarian", "elementor"), |
| 2336 |
value: "hu-HU" |
| 2337 |
}, |
| 2338 |
{ |
| 2339 |
label: (0, _wordpress_i18n.__)("Indonesian", "elementor"), |
| 2340 |
value: "id-ID" |
| 2341 |
}, |
| 2342 |
{ |
| 2343 |
label: (0, _wordpress_i18n.__)("Italian", "elementor"), |
| 2344 |
value: "it-IT" |
| 2345 |
}, |
| 2346 |
{ |
| 2347 |
label: (0, _wordpress_i18n.__)("Japanese", "elementor"), |
| 2348 |
value: "ja-JP" |
| 2349 |
}, |
| 2350 |
{ |
| 2351 |
label: (0, _wordpress_i18n.__)("Korean", "elementor"), |
| 2352 |
value: "ko-KR" |
| 2353 |
}, |
| 2354 |
{ |
| 2355 |
label: (0, _wordpress_i18n.__)("Persian", "elementor"), |
| 2356 |
value: "fa-IR" |
| 2357 |
}, |
| 2358 |
{ |
| 2359 |
label: (0, _wordpress_i18n.__)("Polish", "elementor"), |
| 2360 |
value: "pl-PL" |
| 2361 |
}, |
| 2362 |
{ |
| 2363 |
label: (0, _wordpress_i18n.__)("Portuguese", "elementor"), |
| 2364 |
value: "pt-PT" |
| 2365 |
}, |
| 2366 |
{ |
| 2367 |
label: (0, _wordpress_i18n.__)("Russian", "elementor"), |
| 2368 |
value: "ru-RU" |
| 2369 |
}, |
| 2370 |
{ |
| 2371 |
label: (0, _wordpress_i18n.__)("Spanish", "elementor"), |
| 2372 |
value: "es-ES" |
| 2373 |
}, |
| 2374 |
{ |
| 2375 |
label: (0, _wordpress_i18n.__)("Swedish", "elementor"), |
| 2376 |
value: "sv-SE" |
| 2377 |
}, |
| 2378 |
{ |
| 2379 |
label: (0, _wordpress_i18n.__)("Thai", "elementor"), |
| 2380 |
value: "th-TH" |
| 2381 |
}, |
| 2382 |
{ |
| 2383 |
label: (0, _wordpress_i18n.__)("Turkish", "elementor"), |
| 2384 |
value: "tr-TR" |
| 2385 |
}, |
| 2386 |
{ |
| 2387 |
label: (0, _wordpress_i18n.__)("Vietnamese", "elementor"), |
| 2388 |
value: "vi-VN" |
| 2389 |
} |
| 2390 |
]; |
| 2391 |
motionEffectAutocomplete = [ |
| 2392 |
(0, _wordpress_i18n.__)("Create Fade out animation on scroll", "elementor"), |
| 2393 |
(0, _wordpress_i18n.__)("Create a Parallax effect on scroll", "elementor"), |
| 2394 |
(0, _wordpress_i18n.__)("On scroll, fade in with slight scaling up", "elementor"), |
| 2395 |
(0, _wordpress_i18n.__)("Move and tilt opposite to mouse position", "elementor"), |
| 2396 |
(0, _wordpress_i18n.__)("Slide in from the left on load", "elementor") |
| 2397 |
]; |
| 2398 |
hoverEffectAutocomplete = [ |
| 2399 |
(0, _wordpress_i18n.__)("Move down on hover", "elementor"), |
| 2400 |
(0, _wordpress_i18n.__)("Slightly shift right on hover", "elementor"), |
| 2401 |
(0, _wordpress_i18n.__)("Apply a subtle 3D tilt", "elementor"), |
| 2402 |
(0, _wordpress_i18n.__)("Rotate gently clockwise on hover", "elementor"), |
| 2403 |
(0, _wordpress_i18n.__)("Scale down and move up on hover", "elementor") |
| 2404 |
]; |
| 2405 |
})); |
| 2406 |
|
| 2407 |
//#endregion |
| 2408 |
//#region modules/ai/assets/js/editor/components/prompt-history/history-types.js |
| 2409 |
var HISTORY_TYPES, TRANSLATED_HISTORY_TYPES_FALLBACK, TRANSLATED_HISTORY_TYPES, getTranslatedPromptHistoryType; |
| 2410 |
var init_history_types = __esmMin((() => { |
| 2411 |
init_defineProperty$1(); |
| 2412 |
HISTORY_TYPES = Object.freeze({ |
| 2413 |
ALL: "all", |
| 2414 |
TEXT: "text", |
| 2415 |
CODE: "code", |
| 2416 |
IMAGE: "images", |
| 2417 |
BLOCK: "blocks" |
| 2418 |
}); |
| 2419 |
TRANSLATED_HISTORY_TYPES_FALLBACK = (0, _wordpress_i18n.__)("things", "elementor"); |
| 2420 |
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"))); |
| 2421 |
getTranslatedPromptHistoryType = function getTranslatedPromptHistoryType(historyType) { |
| 2422 |
if (TRANSLATED_HISTORY_TYPES[historyType]) return TRANSLATED_HISTORY_TYPES[historyType]; |
| 2423 |
return TRANSLATED_HISTORY_TYPES_FALLBACK; |
| 2424 |
}; |
| 2425 |
})); |
| 2426 |
|
| 2427 |
//#endregion |
| 2428 |
//#region modules/ai/assets/js/editor/helpers/index.js |
| 2429 |
var vh; |
| 2430 |
var init_helpers = __esmMin((() => { |
| 2431 |
vh = function vh(value) { |
| 2432 |
return value * Math.max(document.documentElement.clientHeight, window.innerHeight || 0) / 100; |
| 2433 |
}; |
| 2434 |
})); |
| 2435 |
|
| 2436 |
//#endregion |
| 2437 |
//#region modules/ai/assets/js/editor/components/prompt-history/context/prompt-history-context.js |
| 2438 |
var import_prop_types$5, PromptHistoryContext, DIALOG_CONTAINER_SELECTOR, getContainer, getContainerHeight, getContentHeight, setContentHeight, PromptHistoryProvider, usePromptHistoryContext; |
| 2439 |
var init_prompt_history_context = __esmMin((() => { |
| 2440 |
init_slicedToArray(); |
| 2441 |
import_prop_types$5 = /* @__PURE__ */ __toESM(require_prop_types()); |
| 2442 |
init_history_types(); |
| 2443 |
init_helpers(); |
| 2444 |
PromptHistoryContext = (0, react.createContext)({}); |
| 2445 |
DIALOG_CONTAINER_SELECTOR = ".e-ai-dialog-content"; |
| 2446 |
getContainer = function getContainer() { |
| 2447 |
return document.querySelector(DIALOG_CONTAINER_SELECTOR); |
| 2448 |
}; |
| 2449 |
getContainerHeight = function getContainerHeight() { |
| 2450 |
var contentContainer = document.querySelector(DIALOG_CONTAINER_SELECTOR); |
| 2451 |
return contentContainer === null || contentContainer === void 0 ? void 0 : contentContainer.clientHeight; |
| 2452 |
}; |
| 2453 |
getContentHeight = function getContentHeight() { |
| 2454 |
return document.querySelector(DIALOG_CONTAINER_SELECTOR).children[0].clientHeight + 50; |
| 2455 |
}; |
| 2456 |
setContentHeight = function setContentHeight(height) { |
| 2457 |
var contentContainer = document.querySelector(DIALOG_CONTAINER_SELECTOR); |
| 2458 |
if ("auto" === height) { |
| 2459 |
contentContainer.style.height = "auto"; |
| 2460 |
return; |
| 2461 |
} |
| 2462 |
contentContainer.style.height = "".concat(height, "px"); |
| 2463 |
}; |
| 2464 |
PromptHistoryProvider = function PromptHistoryProvider(_ref) { |
| 2465 |
var historyType = _ref.historyType; |
| 2466 |
var children = _ref.children; |
| 2467 |
var showHistoryState = (0, react.useState)(false); |
| 2468 |
return /*#__PURE__*/ react.default.createElement(PromptHistoryContext.Provider, { value: { |
| 2469 |
historyType, |
| 2470 |
showHistoryState |
| 2471 |
} }, children); |
| 2472 |
}; |
| 2473 |
PromptHistoryProvider.propTypes = { |
| 2474 |
historyType: import_prop_types$5.default.oneOf(Object.values(HISTORY_TYPES)).isRequired, |
| 2475 |
children: import_prop_types$5.default.node |
| 2476 |
}; |
| 2477 |
usePromptHistoryContext = function usePromptHistoryContext() { |
| 2478 |
var _useContext = (0, react.useContext)(PromptHistoryContext); |
| 2479 |
var historyType = _useContext.historyType; |
| 2480 |
var showHistoryState = _useContext.showHistoryState; |
| 2481 |
var _showHistoryState = _slicedToArray(showHistoryState, 2); |
| 2482 |
var showHistory = _showHistoryState[0]; |
| 2483 |
var setShowHistory = _showHistoryState[1]; |
| 2484 |
var _useState2 = _slicedToArray((0, react.useState)(false), 2); |
| 2485 |
var showModalWrapper = _useState2[0]; |
| 2486 |
var setShowModalWrapper = _useState2[1]; |
| 2487 |
var _useState4 = _slicedToArray((0, react.useState)(false), 2); |
| 2488 |
var showPromptHistory = _useState4[0]; |
| 2489 |
var setShowPromptHistory = _useState4[1]; |
| 2490 |
var handleFullScreenHistoryState = function handleFullScreenHistoryState() { |
| 2491 |
if (showHistory) { |
| 2492 |
setShowModalWrapper(true); |
| 2493 |
setTimeout(function() { |
| 2494 |
return setShowPromptHistory(true); |
| 2495 |
}, 200); |
| 2496 |
return; |
| 2497 |
} |
| 2498 |
setShowPromptHistory(false); |
| 2499 |
setTimeout(function() { |
| 2500 |
return setShowModalWrapper(false); |
| 2501 |
}, 500); |
| 2502 |
}; |
| 2503 |
var handleDefaultHistoryState = function handleDefaultHistoryState() { |
| 2504 |
if (showHistory) { |
| 2505 |
var currentHeight = getContentHeight(); |
| 2506 |
setContentHeight(currentHeight); |
| 2507 |
setTimeout(function() { |
| 2508 |
if (currentHeight < vh(61)) { |
| 2509 |
setContentHeight(vh(61)); |
| 2510 |
setTimeout(function() { |
| 2511 |
return setShowModalWrapper(true); |
| 2512 |
}, 200); |
| 2513 |
setTimeout(function() { |
| 2514 |
return setShowPromptHistory(true); |
| 2515 |
}, 300); |
| 2516 |
return; |
| 2517 |
} |
| 2518 |
setShowModalWrapper(true); |
| 2519 |
setShowPromptHistory(true); |
| 2520 |
}, 20); |
| 2521 |
return; |
| 2522 |
} |
| 2523 |
setShowPromptHistory(false); |
| 2524 |
setTimeout(function() { |
| 2525 |
setShowModalWrapper(false); |
| 2526 |
setContentHeight(getContentHeight()); |
| 2527 |
setTimeout(function() { |
| 2528 |
return setContentHeight("auto"); |
| 2529 |
}, 300); |
| 2530 |
}, 500); |
| 2531 |
}; |
| 2532 |
(0, react.useEffect)(function() { |
| 2533 |
if (showHistory === showModalWrapper && showHistory === showPromptHistory) return; |
| 2534 |
if (historyType === HISTORY_TYPES.IMAGE) return handleFullScreenHistoryState(); |
| 2535 |
handleDefaultHistoryState(); |
| 2536 |
}, [showHistory]); |
| 2537 |
return { |
| 2538 |
historyType, |
| 2539 |
isOpen: showPromptHistory, |
| 2540 |
isModalOpen: showModalWrapper, |
| 2541 |
showHistory, |
| 2542 |
onOpen: function onOpen() { |
| 2543 |
setShowHistory(true); |
| 2544 |
}, |
| 2545 |
onClose: function onClose() { |
| 2546 |
setShowHistory(false); |
| 2547 |
}, |
| 2548 |
getContainer, |
| 2549 |
getContainerHeight |
| 2550 |
}; |
| 2551 |
}; |
| 2552 |
})); |
| 2553 |
|
| 2554 |
//#endregion |
| 2555 |
//#region modules/ai/assets/js/editor/components/prompt-history/context/prompt-history-action-context.js |
| 2556 |
function _createForOfIteratorHelper$1(r, e) { |
| 2557 |
var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; |
| 2558 |
if (!t) { |
| 2559 |
if (Array.isArray(r) || (t = _unsupportedIterableToArray$1(r)) || e && r && "number" == typeof r.length) { |
| 2560 |
t && (r = t); |
| 2561 |
var _n = 0; |
| 2562 |
var F = function F() {}; |
| 2563 |
return { |
| 2564 |
s: F, |
| 2565 |
n: function n() { |
| 2566 |
return _n >= r.length ? { done: !0 } : { |
| 2567 |
done: !1, |
| 2568 |
value: r[_n++] |
| 2569 |
}; |
| 2570 |
}, |
| 2571 |
e: function e(r) { |
| 2572 |
throw r; |
| 2573 |
}, |
| 2574 |
f: F |
| 2575 |
}; |
| 2576 |
} |
| 2577 |
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); |
| 2578 |
} |
| 2579 |
var o; |
| 2580 |
var a = !0; |
| 2581 |
var u = !1; |
| 2582 |
return { |
| 2583 |
s: function s() { |
| 2584 |
t = t.call(r); |
| 2585 |
}, |
| 2586 |
n: function n() { |
| 2587 |
var r = t.next(); |
| 2588 |
return a = r.done, r; |
| 2589 |
}, |
| 2590 |
e: function e(r) { |
| 2591 |
u = !0, o = r; |
| 2592 |
}, |
| 2593 |
f: function f() { |
| 2594 |
try { |
| 2595 |
a || null == t.return || t.return(); |
| 2596 |
} finally { |
| 2597 |
if (u) throw o; |
| 2598 |
} |
| 2599 |
} |
| 2600 |
}; |
| 2601 |
} |
| 2602 |
function _unsupportedIterableToArray$1(r, a) { |
| 2603 |
if (r) { |
| 2604 |
if ("string" == typeof r) return _arrayLikeToArray$1(r, a); |
| 2605 |
var t = {}.toString.call(r).slice(8, -1); |
| 2606 |
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; |
| 2607 |
} |
| 2608 |
} |
| 2609 |
function _arrayLikeToArray$1(r, a) { |
| 2610 |
(null == a || a > r.length) && (a = r.length); |
| 2611 |
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; |
| 2612 |
return n; |
| 2613 |
} |
| 2614 |
var import_prop_types$4, PromptHistoryActionContext, initialActionValue, ACTION_TYPES, ENABLED_ACTIONS_BY_TYPE, PromptHistoryActionProvider, usePromptHistoryAction, useSubscribeOnPromptHistoryAction; |
| 2615 |
var init_prompt_history_action_context = __esmMin((() => { |
| 2616 |
init_slicedToArray(); |
| 2617 |
init_defineProperty$1(); |
| 2618 |
import_prop_types$4 = /* @__PURE__ */ __toESM(require_prop_types()); |
| 2619 |
init_history_types(); |
| 2620 |
init_prompt_history_context(); |
| 2621 |
__name(_createForOfIteratorHelper$1, "_createForOfIteratorHelper"); |
| 2622 |
__name(_unsupportedIterableToArray$1, "_unsupportedIterableToArray"); |
| 2623 |
__name(_arrayLikeToArray$1, "_arrayLikeToArray"); |
| 2624 |
PromptHistoryActionContext = (0, react.createContext)({}); |
| 2625 |
initialActionValue = { |
| 2626 |
type: "", |
| 2627 |
id: "", |
| 2628 |
data: null |
| 2629 |
}; |
| 2630 |
ACTION_TYPES = Object.freeze({ |
| 2631 |
REUSE: "reuse", |
| 2632 |
EDIT: "edit", |
| 2633 |
RESTORE: "restore", |
| 2634 |
REMOVE: "remove" |
| 2635 |
}); |
| 2636 |
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)); |
| 2637 |
PromptHistoryActionProvider = function PromptHistoryActionProvider(_ref) { |
| 2638 |
var children = _ref.children; |
| 2639 |
var _useState2 = _slicedToArray((0, react.useState)(initialActionValue), 2); |
| 2640 |
var state = _useState2[0]; |
| 2641 |
var dispatch = _useState2[1]; |
| 2642 |
return /*#__PURE__*/ react.default.createElement(PromptHistoryActionContext.Provider, { value: { |
| 2643 |
state, |
| 2644 |
dispatch |
| 2645 |
} }, children); |
| 2646 |
}; |
| 2647 |
PromptHistoryActionProvider.propTypes = { children: import_prop_types$4.default.node }; |
| 2648 |
usePromptHistoryAction = function usePromptHistoryAction() { |
| 2649 |
var _useContext = (0, react.useContext)(PromptHistoryActionContext); |
| 2650 |
var state = _useContext.state; |
| 2651 |
var dispatch = _useContext.dispatch; |
| 2652 |
var _usePromptHistoryCont = usePromptHistoryContext(); |
| 2653 |
var historyType = _usePromptHistoryCont.historyType; |
| 2654 |
var onClose = _usePromptHistoryCont.onClose; |
| 2655 |
var closeModalAfterAction = function closeModalAfterAction(action) { |
| 2656 |
return function() { |
| 2657 |
action.apply(void 0, arguments); |
| 2658 |
onClose(); |
| 2659 |
}; |
| 2660 |
}; |
| 2661 |
return { |
| 2662 |
promptHistoryAction: state, |
| 2663 |
onPromptReuse: closeModalAfterAction(function onPromptReuse(id, data) { |
| 2664 |
return dispatch({ |
| 2665 |
type: ACTION_TYPES.REUSE, |
| 2666 |
id, |
| 2667 |
data |
| 2668 |
}); |
| 2669 |
}), |
| 2670 |
onResultEdit: closeModalAfterAction(function onResultEdit(id, data) { |
| 2671 |
return dispatch({ |
| 2672 |
type: ACTION_TYPES.EDIT, |
| 2673 |
id, |
| 2674 |
data |
| 2675 |
}); |
| 2676 |
}), |
| 2677 |
onImagesRestore: closeModalAfterAction(function onImagesRestore(id, data) { |
| 2678 |
return dispatch({ |
| 2679 |
type: ACTION_TYPES.RESTORE, |
| 2680 |
id, |
| 2681 |
data |
| 2682 |
}); |
| 2683 |
}), |
| 2684 |
getAllowedActions: function getAllowedActions() { |
| 2685 |
return ENABLED_ACTIONS_BY_TYPE[historyType] || {}; |
| 2686 |
} |
| 2687 |
}; |
| 2688 |
}; |
| 2689 |
useSubscribeOnPromptHistoryAction = function useSubscribeOnPromptHistoryAction(actions) { |
| 2690 |
var state = (0, react.useContext)(PromptHistoryActionContext).state; |
| 2691 |
(0, react.useEffect)(function() { |
| 2692 |
if (!state.type) return; |
| 2693 |
var _iterator = _createForOfIteratorHelper$1(actions); |
| 2694 |
var _step; |
| 2695 |
try { |
| 2696 |
for (_iterator.s(); !(_step = _iterator.n()).done;) { |
| 2697 |
var action = _step.value; |
| 2698 |
if (state.type === (action === null || action === void 0 ? void 0 : action.type)) action === null || action === void 0 || action.handler(state); |
| 2699 |
} |
| 2700 |
} catch (err) { |
| 2701 |
_iterator.e(err); |
| 2702 |
} finally { |
| 2703 |
_iterator.f(); |
| 2704 |
} |
| 2705 |
}, [state]); |
| 2706 |
}; |
| 2707 |
})); |
| 2708 |
|
| 2709 |
//#endregion |
| 2710 |
//#region modules/ai/assets/js/editor/icons/bulb-icon.js |
| 2711 |
var BulbIcon; |
| 2712 |
var init_bulb_icon = __esmMin((() => { |
| 2713 |
init_extends(); |
| 2714 |
BulbIcon = react.default.forwardRef(function(props, ref) { |
| 2715 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.SvgIcon, _extends$1({}, props, { ref }), /*#__PURE__*/ react.default.createElement("svg", { |
| 2716 |
width: "22", |
| 2717 |
height: "22", |
| 2718 |
viewBox: "0 0 22 22", |
| 2719 |
fill: "none", |
| 2720 |
xmlns: "http://www.w3.org/2000/svg" |
| 2721 |
}, /*#__PURE__*/ react.default.createElement("g", { clipPath: "url(#clip0_10743_8902)" }, /*#__PURE__*/ react.default.createElement("path", { |
| 2722 |
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", |
| 2723 |
stroke: "#2563EB", |
| 2724 |
strokeWidth: "1.5", |
| 2725 |
strokeLinecap: "round", |
| 2726 |
strokeLinejoin: "round" |
| 2727 |
}), /*#__PURE__*/ react.default.createElement("path", { |
| 2728 |
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", |
| 2729 |
stroke: "#2563EB", |
| 2730 |
strokeWidth: "1.5", |
| 2731 |
strokeLinecap: "round", |
| 2732 |
strokeLinejoin: "round" |
| 2733 |
}), /*#__PURE__*/ react.default.createElement("path", { |
| 2734 |
d: "M10.0833 16.5H11.9166", |
| 2735 |
stroke: "#2563EB", |
| 2736 |
strokeWidth: "1.5", |
| 2737 |
strokeLinecap: "round", |
| 2738 |
strokeLinejoin: "round" |
| 2739 |
})), /*#__PURE__*/ react.default.createElement("defs", null, /*#__PURE__*/ react.default.createElement("clipPath", { id: "clip0_10743_8902" }, /*#__PURE__*/ react.default.createElement("rect", { |
| 2740 |
width: "22", |
| 2741 |
height: "22", |
| 2742 |
fill: "white" |
| 2743 |
}))))); |
| 2744 |
}); |
| 2745 |
})); |
| 2746 |
|
| 2747 |
//#endregion |
| 2748 |
//#region modules/ai/assets/js/editor/hooks/use-introduction.js |
| 2749 |
function useIntroduction(key) { |
| 2750 |
var _window$elementor$con; |
| 2751 |
var _window$elementorAdmi; |
| 2752 |
var _globalConfig$introdu; |
| 2753 |
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; |
| 2754 |
var _useState2 = _slicedToArray((0, react.useState)(!!(globalConfig !== null && globalConfig !== void 0 && (_globalConfig$introdu = globalConfig.introduction) !== null && _globalConfig$introdu !== void 0 && _globalConfig$introdu[key])), 2); |
| 2755 |
var isViewed = _useState2[0]; |
| 2756 |
var setIsViewed = _useState2[1]; |
| 2757 |
function markAsViewed() { |
| 2758 |
if (!key) return Promise.reject(); |
| 2759 |
return new Promise(function(resolve, reject) { |
| 2760 |
if (isViewed) reject(); |
| 2761 |
setIsViewed(true); |
| 2762 |
elementorCommon.ajax.addRequest("introduction_viewed", { |
| 2763 |
data: { introductionKey: key }, |
| 2764 |
error: function error() { |
| 2765 |
setIsViewed(false); |
| 2766 |
reject(); |
| 2767 |
}, |
| 2768 |
success: function success() { |
| 2769 |
setIsViewed(true); |
| 2770 |
if (globalConfig !== null && globalConfig !== void 0 && globalConfig.introduction) globalConfig.introduction[key] = true; |
| 2771 |
resolve(); |
| 2772 |
} |
| 2773 |
}); |
| 2774 |
}); |
| 2775 |
} |
| 2776 |
return { |
| 2777 |
isViewed, |
| 2778 |
markAsViewed |
| 2779 |
}; |
| 2780 |
} |
| 2781 |
var init_use_introduction = __esmMin((() => { |
| 2782 |
init_slicedToArray(); |
| 2783 |
})); |
| 2784 |
|
| 2785 |
//#endregion |
| 2786 |
//#region modules/ai/assets/js/editor/components/voice-promotion-alert.js |
| 2787 |
function ownKeys$30(e, r) { |
| 2788 |
var t = Object.keys(e); |
| 2789 |
if (Object.getOwnPropertySymbols) { |
| 2790 |
var o = Object.getOwnPropertySymbols(e); |
| 2791 |
r && (o = o.filter(function(r) { |
| 2792 |
return Object.getOwnPropertyDescriptor(e, r).enumerable; |
| 2793 |
})), t.push.apply(t, o); |
| 2794 |
} |
| 2795 |
return t; |
| 2796 |
} |
| 2797 |
function _objectSpread$29(e) { |
| 2798 |
for (var r = 1; r < arguments.length; r++) { |
| 2799 |
var t = null != arguments[r] ? arguments[r] : {}; |
| 2800 |
r % 2 ? ownKeys$30(Object(t), !0).forEach(function(r) { |
| 2801 |
_defineProperty$1(e, r, t[r]); |
| 2802 |
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$30(Object(t)).forEach(function(r) { |
| 2803 |
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); |
| 2804 |
}); |
| 2805 |
} |
| 2806 |
return e; |
| 2807 |
} |
| 2808 |
var import_prop_types$3, VoicePromotionAlert; |
| 2809 |
var init_voice_promotion_alert = __esmMin((() => { |
| 2810 |
init_defineProperty$1(); |
| 2811 |
init_bulb_icon(); |
| 2812 |
init_use_introduction(); |
| 2813 |
import_prop_types$3 = /* @__PURE__ */ __toESM(require_prop_types()); |
| 2814 |
__name(ownKeys$30, "ownKeys"); |
| 2815 |
__name(_objectSpread$29, "_objectSpread"); |
| 2816 |
VoicePromotionAlert = function VoicePromotionAlert(props) { |
| 2817 |
var _useIntroduction = useIntroduction(props.introductionKey); |
| 2818 |
var isViewed = _useIntroduction.isViewed; |
| 2819 |
var markAsViewed = _useIntroduction.markAsViewed; |
| 2820 |
if (isViewed) return null; |
| 2821 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, { |
| 2822 |
sx: _objectSpread$29({ mt: 2 }, props.sx), |
| 2823 |
alignItems: "top" |
| 2824 |
}, /*#__PURE__*/ react.default.createElement(_elementor_ui.Alert, { |
| 2825 |
severity: "info", |
| 2826 |
variant: "standard", |
| 2827 |
icon: /*#__PURE__*/ react.default.createElement(BulbIcon, { sx: { alignSelf: "flex-start" } }), |
| 2828 |
onClose: markAsViewed |
| 2829 |
}, (0, _wordpress_i18n.__)("Get improved results from AI by adding personal context.", "elementor"), /*#__PURE__*/ react.default.createElement(_elementor_ui.Link, { |
| 2830 |
onClick: function onClick() { |
| 2831 |
return $e.route("panel/global/menu"); |
| 2832 |
}, |
| 2833 |
className: "elementor-clickable", |
| 2834 |
style: { textDecoration: "none" }, |
| 2835 |
color: "info.main", |
| 2836 |
href: "#" |
| 2837 |
}, (0, _wordpress_i18n.__)("Let’s do it", "elementor")))); |
| 2838 |
}; |
| 2839 |
VoicePromotionAlert.propTypes = { |
| 2840 |
sx: import_prop_types$3.default.object, |
| 2841 |
introductionKey: import_prop_types$3.default.string |
| 2842 |
}; |
| 2843 |
})); |
| 2844 |
|
| 2845 |
//#endregion |
| 2846 |
//#region modules/ai/assets/js/editor/pages/form-text/index.js |
| 2847 |
init_asyncToGenerator(); |
| 2848 |
init_slicedToArray(); |
| 2849 |
init_actions_data(); |
| 2850 |
init_prompt_history_action_context(); |
| 2851 |
init_requests_ids(); |
| 2852 |
init_voice_promotion_alert(); |
| 2853 |
var promptActions = [ |
| 2854 |
{ |
| 2855 |
label: (0, _wordpress_i18n.__)("Simplify language", "elementor"), |
| 2856 |
icon: /*#__PURE__*/ react.default.createElement(_elementor_icons.MessageIcon, { fontSize: "small" }), |
| 2857 |
value: "Simplify the language of the following message" |
| 2858 |
}, |
| 2859 |
{ |
| 2860 |
label: (0, _wordpress_i18n.__)("Make it longer", "elementor"), |
| 2861 |
icon: /*#__PURE__*/ react.default.createElement(_elementor_icons.ExpandIcon, { fontSize: "small" }), |
| 2862 |
value: "Make the following message longer" |
| 2863 |
}, |
| 2864 |
{ |
| 2865 |
label: (0, _wordpress_i18n.__)("Make it shorter", "elementor"), |
| 2866 |
icon: /*#__PURE__*/ react.default.createElement(_elementor_icons.ShrinkIcon, { fontSize: "small" }), |
| 2867 |
value: "Make the following message shorter" |
| 2868 |
}, |
| 2869 |
{ |
| 2870 |
label: (0, _wordpress_i18n.__)("Fix spelling & grammar", "elementor"), |
| 2871 |
icon: /*#__PURE__*/ react.default.createElement(_elementor_icons.AIIcon, { fontSize: "small" }), |
| 2872 |
value: "Fix the spelling and grammar of the following message" |
| 2873 |
} |
| 2874 |
]; |
| 2875 |
var promptInstructions = [{ |
| 2876 |
label: (0, _wordpress_i18n.__)("Change tone", "elementor"), |
| 2877 |
options: vocalTones, |
| 2878 |
getInstruction: function getInstruction(value) { |
| 2879 |
return "Change the tone of the following message to ".concat(value); |
| 2880 |
} |
| 2881 |
}, { |
| 2882 |
label: (0, _wordpress_i18n.__)("Translate to", "elementor"), |
| 2883 |
options: translateLanguages, |
| 2884 |
getInstruction: function getInstruction(value) { |
| 2885 |
return "Translate the following message to ".concat(value); |
| 2886 |
} |
| 2887 |
}]; |
| 2888 |
var FormText = function FormText(_ref) { |
| 2889 |
var _initialValue$result; |
| 2890 |
var _initialValue$credits; |
| 2891 |
var _additionalOptions$in; |
| 2892 |
var type = _ref.type; |
| 2893 |
var onClose = _ref.onClose; |
| 2894 |
var getControlValue = _ref.getControlValue; |
| 2895 |
var setControlValue = _ref.setControlValue; |
| 2896 |
var additionalOptions = _ref.additionalOptions; |
| 2897 |
var credits = _ref.credits; |
| 2898 |
var children = _ref.children; |
| 2899 |
var initialValue = getControlValue() === (additionalOptions === null || additionalOptions === void 0 ? void 0 : additionalOptions.defaultValue) ? "" : getControlValue(); |
| 2900 |
var _useTextPrompt = useTextPrompt({ |
| 2901 |
result: (_initialValue$result = initialValue === null || initialValue === void 0 ? void 0 : initialValue.result) !== null && _initialValue$result !== void 0 ? _initialValue$result : initialValue, |
| 2902 |
credits: (_initialValue$credits = initialValue === null || initialValue === void 0 ? void 0 : initialValue.credits) !== null && _initialValue$credits !== void 0 ? _initialValue$credits : credits, |
| 2903 |
responseId: initialValue === null || initialValue === void 0 ? void 0 : initialValue.responseId |
| 2904 |
}); |
| 2905 |
var data = _useTextPrompt.data; |
| 2906 |
var isLoading = _useTextPrompt.isLoading; |
| 2907 |
var txtGenErr = _useTextPrompt.error; |
| 2908 |
var setResult = _useTextPrompt.setResult; |
| 2909 |
var reset = _useTextPrompt.reset; |
| 2910 |
var send = _useTextPrompt.send; |
| 2911 |
var sendUsageData = _useTextPrompt.sendUsageData; |
| 2912 |
var error = txtGenErr || (additionalOptions === null || additionalOptions === void 0 ? void 0 : additionalOptions.initError); |
| 2913 |
var _useState2 = _slicedToArray((0, react.useState)(""), 2); |
| 2914 |
var prompt = _useState2[0]; |
| 2915 |
var setPrompt = _useState2[1]; |
| 2916 |
var setGenerate = useRequestIds().setGenerate; |
| 2917 |
useSubscribeOnPromptHistoryAction([{ |
| 2918 |
type: ACTION_TYPES.REUSE, |
| 2919 |
handler: function handler(action) { |
| 2920 |
reset(); |
| 2921 |
setPrompt(action.data); |
| 2922 |
} |
| 2923 |
}, { |
| 2924 |
type: ACTION_TYPES.EDIT, |
| 2925 |
handler: function handler(action) { |
| 2926 |
setResult(action.data); |
| 2927 |
} |
| 2928 |
}]); |
| 2929 |
var searchField = (0, react.useRef)(null); |
| 2930 |
var resultField = (0, react.useRef)(null); |
| 2931 |
var lastRun = (0, react.useRef)((_additionalOptions$in = additionalOptions.initRetry) !== null && _additionalOptions$in !== void 0 ? _additionalOptions$in : function() {}); |
| 2932 |
var autocompleteItems = "textarea" === type ? textareaAutocomplete : textAutocomplete; |
| 2933 |
var showSuggestions = !prompt; |
| 2934 |
var handleSubmit = function handleSubmit(event) { |
| 2935 |
event.preventDefault(); |
| 2936 |
setGenerate(); |
| 2937 |
lastRun.current = function() { |
| 2938 |
return send({ prompt }); |
| 2939 |
}; |
| 2940 |
lastRun.current(); |
| 2941 |
}; |
| 2942 |
var handleCustomInstruction = /*#__PURE__*/ function() { |
| 2943 |
var _ref2 = _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee(instruction) { |
| 2944 |
return import_regenerator$2.default.wrap(function(_context) { |
| 2945 |
while (1) switch (_context.prev = _context.next) { |
| 2946 |
case 0: |
| 2947 |
setGenerate(); |
| 2948 |
lastRun.current = function() { |
| 2949 |
return send({ |
| 2950 |
input: resultField.current.value, |
| 2951 |
instruction |
| 2952 |
}); |
| 2953 |
}; |
| 2954 |
lastRun.current(); |
| 2955 |
case 1: |
| 2956 |
case "end": return _context.stop(); |
| 2957 |
} |
| 2958 |
}, _callee); |
| 2959 |
})); |
| 2960 |
return function handleCustomInstruction(_x) { |
| 2961 |
return _ref2.apply(this, arguments); |
| 2962 |
}; |
| 2963 |
}(); |
| 2964 |
var handleSuggestion = function handleSuggestion(suggestion) { |
| 2965 |
setPrompt(suggestion + " "); |
| 2966 |
searchField.current.focus(); |
| 2967 |
}; |
| 2968 |
var applyPrompt = function applyPrompt() { |
| 2969 |
sendUsageData(); |
| 2970 |
setControlValue(resultField.current.value); |
| 2971 |
onClose(); |
| 2972 |
}; |
| 2973 |
if (isLoading) return /*#__PURE__*/ react.default.createElement(Loader, null); |
| 2974 |
return /*#__PURE__*/ react.default.createElement(react.default.Fragment, null, error && /*#__PURE__*/ react.default.createElement(PromptErrorMessage, { |
| 2975 |
error, |
| 2976 |
onRetry: lastRun.current, |
| 2977 |
sx: { mb: 2.5 } |
| 2978 |
}), children, !data.result && /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, { |
| 2979 |
component: "form", |
| 2980 |
onSubmit: handleSubmit |
| 2981 |
}, /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, { sx: { mb: 2.5 } }, /*#__PURE__*/ react.default.createElement(PromptSearch, { |
| 2982 |
ref: searchField, |
| 2983 |
placeholder: (0, _wordpress_i18n.__)("Describe the text and tone you want to use...", "elementor"), |
| 2984 |
name: "prompt", |
| 2985 |
value: prompt, |
| 2986 |
onChange: function onChange(event) { |
| 2987 |
return setPrompt(event.target.value); |
| 2988 |
} |
| 2989 |
})), showSuggestions && /*#__PURE__*/ react.default.createElement(PromptSuggestions, { |
| 2990 |
suggestions: autocompleteItems, |
| 2991 |
onSelect: handleSuggestion, |
| 2992 |
suggestionFilter: function suggestionFilter(suggestion) { |
| 2993 |
return suggestion + "..."; |
| 2994 |
} |
| 2995 |
}, /*#__PURE__*/ react.default.createElement(PromptLibraryLink, { libraryLink: "https://go.elementor.com/ai-prompt-library-text/" })), additionalOptions.hideAiContext ? null : /*#__PURE__*/ react.default.createElement(VoicePromotionAlert, { |
| 2996 |
introductionKey: "ai-context-text-promotion", |
| 2997 |
sx: { mb: 2 } |
| 2998 |
}), /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, { |
| 2999 |
direction: "row", |
| 3000 |
alignItems: "center", |
| 3001 |
sx: { |
| 3002 |
pb: 1.5, |
| 3003 |
mt: 2 |
| 3004 |
} |
| 3005 |
}, /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, { |
| 3006 |
direction: "row", |
| 3007 |
justifyContent: "flex-end", |
| 3008 |
flexGrow: 1 |
| 3009 |
}, /*#__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, { |
| 3010 |
fullWidth: true, |
| 3011 |
ref: resultField, |
| 3012 |
value: data.result, |
| 3013 |
helperText: (0, _wordpress_i18n.__)("Text generated by AI may be inaccurate or offensive.", "elementor"), |
| 3014 |
onChange: function onChange(event) { |
| 3015 |
return setResult(event.target.value); |
| 3016 |
} |
| 3017 |
}), /*#__PURE__*/ react.default.createElement(_elementor_ui.Grid, { |
| 3018 |
container: true, |
| 3019 |
spacing: 1, |
| 3020 |
sx: { mt: 2.5 } |
| 3021 |
}, promptActions.map(function(_ref3) { |
| 3022 |
var label = _ref3.label; |
| 3023 |
var icon = _ref3.icon; |
| 3024 |
var value = _ref3.value; |
| 3025 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Grid, { |
| 3026 |
item: true, |
| 3027 |
key: label |
| 3028 |
}, /*#__PURE__*/ react.default.createElement(PromptAction, { |
| 3029 |
label, |
| 3030 |
icon, |
| 3031 |
onClick: function onClick() { |
| 3032 |
return handleCustomInstruction(value); |
| 3033 |
} |
| 3034 |
})); |
| 3035 |
})), /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, { |
| 3036 |
direction: "row", |
| 3037 |
alignItems: "center", |
| 3038 |
spacing: 1, |
| 3039 |
sx: { mt: 2.5 } |
| 3040 |
}, promptInstructions.map(function(_ref4) { |
| 3041 |
var label = _ref4.label; |
| 3042 |
var options = _ref4.options; |
| 3043 |
var getInstruction = _ref4.getInstruction; |
| 3044 |
return /*#__PURE__*/ react.default.createElement(PromptActionSelection, { |
| 3045 |
key: label, |
| 3046 |
label, |
| 3047 |
options, |
| 3048 |
onChange: function onChange(event) { |
| 3049 |
return handleCustomInstruction(getInstruction(event.target.value)); |
| 3050 |
} |
| 3051 |
}); |
| 3052 |
})), additionalOptions.hideAiContext ? null : /*#__PURE__*/ react.default.createElement(VoicePromotionAlert, { |
| 3053 |
introductionKey: "ai-context-text-promotion", |
| 3054 |
sx: { mb: 2 } |
| 3055 |
}), /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, { |
| 3056 |
direction: "row", |
| 3057 |
alignItems: "center", |
| 3058 |
sx: { my: 1 } |
| 3059 |
}, /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, { |
| 3060 |
direction: "row", |
| 3061 |
gap: 1, |
| 3062 |
justifyContent: "flex-end", |
| 3063 |
flexGrow: 1 |
| 3064 |
}, /*#__PURE__*/ react.default.createElement(_elementor_ui.Button, { |
| 3065 |
size: "small", |
| 3066 |
color: "secondary", |
| 3067 |
variant: "text", |
| 3068 |
onClick: reset |
| 3069 |
}, (0, _wordpress_i18n.__)("New prompt", "elementor")), /*#__PURE__*/ react.default.createElement(_elementor_ui.Button, { |
| 3070 |
size: "small", |
| 3071 |
variant: "contained", |
| 3072 |
color: "primary", |
| 3073 |
onClick: applyPrompt |
| 3074 |
}, (0, _wordpress_i18n.__)("Use text", "elementor")))))); |
| 3075 |
}; |
| 3076 |
FormText.propTypes = { |
| 3077 |
type: import_prop_types$8.default.string.isRequired, |
| 3078 |
controlType: import_prop_types$8.default.string, |
| 3079 |
onClose: import_prop_types$8.default.func.isRequired, |
| 3080 |
getControlValue: import_prop_types$8.default.func.isRequired, |
| 3081 |
setControlValue: import_prop_types$8.default.func.isRequired, |
| 3082 |
additionalOptions: import_prop_types$8.default.object, |
| 3083 |
credits: import_prop_types$8.default.number, |
| 3084 |
usagePercentage: import_prop_types$8.default.number, |
| 3085 |
children: import_prop_types$8.default.node |
| 3086 |
}; |
| 3087 |
|
| 3088 |
//#endregion |
| 3089 |
//#region modules/ai/assets/js/editor/pages/connect/index.js |
| 3090 |
var Connect = function Connect(_ref) { |
| 3091 |
var connectUrl = _ref.connectUrl; |
| 3092 |
var onSuccess = _ref.onSuccess; |
| 3093 |
var approveButtonRef = (0, react.useRef)(); |
| 3094 |
(0, react.useEffect)(function() { |
| 3095 |
if (!jQuery.fn.elementorConnect) return; |
| 3096 |
jQuery(approveButtonRef.current).elementorConnect({ |
| 3097 |
success: function success(_, data) { |
| 3098 |
return onSuccess(data); |
| 3099 |
}, |
| 3100 |
error: function error() { |
| 3101 |
throw new Error("Elementor AI: Failed to connect."); |
| 3102 |
} |
| 3103 |
}); |
| 3104 |
}, []); |
| 3105 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, { |
| 3106 |
alignItems: "center", |
| 3107 |
gap: 2 |
| 3108 |
}, /*#__PURE__*/ react.default.createElement(_elementor_icons.AIIcon, { sx: { |
| 3109 |
color: "text.primary", |
| 3110 |
fontSize: "60px", |
| 3111 |
mb: 1 |
| 3112 |
} }), /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, { |
| 3113 |
variant: "h4", |
| 3114 |
sx: { color: "text.primary" } |
| 3115 |
}, (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, { |
| 3116 |
variant: "caption", |
| 3117 |
sx: { |
| 3118 |
maxWidth: 520, |
| 3119 |
textAlign: "center" |
| 3120 |
} |
| 3121 |
}, " ", (0, _wordpress_i18n.__)("By clicking \"Connect\", I approve the ", "elementor"), /*#__PURE__*/ react.default.createElement(_elementor_ui.Link, { |
| 3122 |
href: "https://go.elementor.com/ai-terms/", |
| 3123 |
target: "_blank", |
| 3124 |
color: "info.main" |
| 3125 |
}, (0, _wordpress_i18n.__)("Terms of Service", "elementor")), " & ", /*#__PURE__*/ react.default.createElement(_elementor_ui.Link, { |
| 3126 |
href: "https://go.elementor.com/ai-privacy-policy/", |
| 3127 |
target: "_blank", |
| 3128 |
color: "info.main" |
| 3129 |
}, (0, _wordpress_i18n.__)("Privacy Policy", "elementor")), (0, _wordpress_i18n.__)(" of the Elementor AI service.", "elementor")), /*#__PURE__*/ react.default.createElement(_elementor_ui.Button, { |
| 3130 |
ref: approveButtonRef, |
| 3131 |
href: connectUrl, |
| 3132 |
variant: "contained", |
| 3133 |
sx: { |
| 3134 |
mt: 1, |
| 3135 |
"&:hover": { color: "primary.contrastText" } |
| 3136 |
} |
| 3137 |
}, (0, _wordpress_i18n.__)("Connect", "elementor"))); |
| 3138 |
}; |
| 3139 |
Connect.propTypes = { |
| 3140 |
connectUrl: import_prop_types$8.default.string.isRequired, |
| 3141 |
onSuccess: import_prop_types$8.default.func.isRequired |
| 3142 |
}; |
| 3143 |
|
| 3144 |
//#endregion |
| 3145 |
//#region modules/ai/assets/js/editor/pages/get-started/index.js |
| 3146 |
init_asyncToGenerator(); |
| 3147 |
init_slicedToArray(); |
| 3148 |
init_api(); |
| 3149 |
var GetStarted = function GetStarted(_ref) { |
| 3150 |
var onSuccess = _ref.onSuccess; |
| 3151 |
var _useState2 = _slicedToArray((0, react.useState)(false), 2); |
| 3152 |
var isTermsChecked = _useState2[0]; |
| 3153 |
var setIsTermsChecked = _useState2[1]; |
| 3154 |
var onGetStartedClick = /*#__PURE__*/ function() { |
| 3155 |
var _ref2 = _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee() { |
| 3156 |
return import_regenerator$2.default.wrap(function(_context) { |
| 3157 |
while (1) switch (_context.prev = _context.next) { |
| 3158 |
case 0: |
| 3159 |
_context.next = 1; |
| 3160 |
return setGetStarted(); |
| 3161 |
case 1: onSuccess(); |
| 3162 |
case 2: |
| 3163 |
case "end": return _context.stop(); |
| 3164 |
} |
| 3165 |
}, _callee); |
| 3166 |
})); |
| 3167 |
return function onGetStartedClick() { |
| 3168 |
return _ref2.apply(this, arguments); |
| 3169 |
}; |
| 3170 |
}(); |
| 3171 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, { |
| 3172 |
alignItems: "center", |
| 3173 |
gap: 1.5 |
| 3174 |
}, /*#__PURE__*/ react.default.createElement(_elementor_icons.AIIcon, { sx: { |
| 3175 |
color: "text.primary", |
| 3176 |
fontSize: "60px", |
| 3177 |
mb: 1 |
| 3178 |
} }), /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, { |
| 3179 |
variant: "h4", |
| 3180 |
sx: { color: "text.primary" } |
| 3181 |
}, (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, { |
| 3182 |
direction: "row", |
| 3183 |
gap: 1.5, |
| 3184 |
alignItems: "flex-start" |
| 3185 |
}, /*#__PURE__*/ react.default.createElement(_elementor_ui.Checkbox, { |
| 3186 |
id: "e-ai-terms-approval", |
| 3187 |
color: "secondary", |
| 3188 |
checked: isTermsChecked, |
| 3189 |
onClick: function onClick() { |
| 3190 |
return setIsTermsChecked(function(prevState) { |
| 3191 |
return !prevState; |
| 3192 |
}); |
| 3193 |
} |
| 3194 |
}), /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, null, /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, { |
| 3195 |
variant: "caption", |
| 3196 |
sx: { maxWidth: 520 }, |
| 3197 |
component: "label", |
| 3198 |
htmlFor: "e-ai-terms-approval" |
| 3199 |
}, " ", (0, _wordpress_i18n.__)("I approve the ", "elementor"), /*#__PURE__*/ react.default.createElement(_elementor_ui.Link, { |
| 3200 |
href: "https://go.elementor.com/ai-terms/", |
| 3201 |
target: "_blank", |
| 3202 |
color: "info.main" |
| 3203 |
}, (0, _wordpress_i18n.__)("Terms of Service", "elementor")), " & ", /*#__PURE__*/ react.default.createElement(_elementor_ui.Link, { |
| 3204 |
href: "https://go.elementor.com/ai-privacy-policy/", |
| 3205 |
target: "_blank", |
| 3206 |
color: "info.main" |
| 3207 |
}, (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, { |
| 3208 |
disabled: !isTermsChecked, |
| 3209 |
variant: "contained", |
| 3210 |
onClick: onGetStartedClick, |
| 3211 |
sx: { |
| 3212 |
mt: 1, |
| 3213 |
"&:hover": { color: "primary.contrastText" } |
| 3214 |
} |
| 3215 |
}, (0, _wordpress_i18n.__)("Get Started", "elementor"))); |
| 3216 |
}; |
| 3217 |
GetStarted.propTypes = { onSuccess: import_prop_types$8.default.func.isRequired }; |
| 3218 |
|
| 3219 |
//#endregion |
| 3220 |
//#region modules/ai/assets/js/editor/hooks/use-user-info.js |
| 3221 |
init_defineProperty$1(); |
| 3222 |
init_asyncToGenerator(); |
| 3223 |
init_slicedToArray(); |
| 3224 |
init_api(); |
| 3225 |
function ownKeys$29(e, r) { |
| 3226 |
var t = Object.keys(e); |
| 3227 |
if (Object.getOwnPropertySymbols) { |
| 3228 |
var o = Object.getOwnPropertySymbols(e); |
| 3229 |
r && (o = o.filter(function(r) { |
| 3230 |
return Object.getOwnPropertyDescriptor(e, r).enumerable; |
| 3231 |
})), t.push.apply(t, o); |
| 3232 |
} |
| 3233 |
return t; |
| 3234 |
} |
| 3235 |
__name(ownKeys$29, "ownKeys"); |
| 3236 |
function _objectSpread$28(e) { |
| 3237 |
for (var r = 1; r < arguments.length; r++) { |
| 3238 |
var t = null != arguments[r] ? arguments[r] : {}; |
| 3239 |
r % 2 ? ownKeys$29(Object(t), !0).forEach(function(r) { |
| 3240 |
_defineProperty$1(e, r, t[r]); |
| 3241 |
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$29(Object(t)).forEach(function(r) { |
| 3242 |
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); |
| 3243 |
}); |
| 3244 |
} |
| 3245 |
return e; |
| 3246 |
} |
| 3247 |
__name(_objectSpread$28, "_objectSpread"); |
| 3248 |
var useUserInfo = function useUserInfo() { |
| 3249 |
var immediately = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false; |
| 3250 |
var _useState2 = _slicedToArray((0, react.useState)(false), 2); |
| 3251 |
var isLoaded = _useState2[0]; |
| 3252 |
var setIsLoaded = _useState2[1]; |
| 3253 |
var _useState4 = _slicedToArray((0, react.useState)(false), 2); |
| 3254 |
var isLoading = _useState4[0]; |
| 3255 |
var setIsLoading = _useState4[1]; |
| 3256 |
var _useState6 = _slicedToArray((0, react.useState)({ |
| 3257 |
is_connected: false, |
| 3258 |
is_get_started: false, |
| 3259 |
connect_url: "", |
| 3260 |
usage: { |
| 3261 |
hasAiSubscription: false, |
| 3262 |
quota: 0, |
| 3263 |
usedQuota: 0 |
| 3264 |
} |
| 3265 |
}), 2); |
| 3266 |
var userInfo = _useState6[0]; |
| 3267 |
var setUserInfo = _useState6[1]; |
| 3268 |
var credits = userInfo.usage.quota - userInfo.usage.usedQuota; |
| 3269 |
var usagePercentage = userInfo.usage.quota ? userInfo.usage.usedQuota / userInfo.usage.quota * 100 : 0; |
| 3270 |
var fetchData = /*#__PURE__*/ function() { |
| 3271 |
var _ref = _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee() { |
| 3272 |
var userInfoResult; |
| 3273 |
return import_regenerator$2.default.wrap(function(_context) { |
| 3274 |
while (1) switch (_context.prev = _context.next) { |
| 3275 |
case 0: |
| 3276 |
setIsLoading(true); |
| 3277 |
_context.next = 1; |
| 3278 |
return getUserInformation(immediately); |
| 3279 |
case 1: |
| 3280 |
userInfoResult = _context.sent; |
| 3281 |
setUserInfo(function(prevState) { |
| 3282 |
return _objectSpread$28(_objectSpread$28({}, prevState), userInfoResult); |
| 3283 |
}); |
| 3284 |
setIsLoaded(true); |
| 3285 |
setIsLoading(false); |
| 3286 |
case 2: |
| 3287 |
case "end": return _context.stop(); |
| 3288 |
} |
| 3289 |
}, _callee); |
| 3290 |
})); |
| 3291 |
return function fetchData() { |
| 3292 |
return _ref.apply(this, arguments); |
| 3293 |
}; |
| 3294 |
}(); |
| 3295 |
if (!isLoaded && !isLoading) fetchData(); |
| 3296 |
return { |
| 3297 |
isLoading, |
| 3298 |
isLoaded, |
| 3299 |
isConnected: userInfo.is_connected, |
| 3300 |
isGetStarted: userInfo.is_get_started, |
| 3301 |
connectUrl: userInfo.connect_url, |
| 3302 |
builderUrl: userInfo.usage.builderUrl, |
| 3303 |
hasSubscription: userInfo.usage.hasAiSubscription, |
| 3304 |
credits: credits < 0 ? 0 : credits, |
| 3305 |
usagePercentage: Math.round(usagePercentage), |
| 3306 |
fetchData |
| 3307 |
}; |
| 3308 |
}; |
| 3309 |
useUserInfo.propTypes = { immediately: import_prop_types$8.default.bool }; |
| 3310 |
|
| 3311 |
//#endregion |
| 3312 |
//#region modules/ai/assets/js/editor/components/dialog-header.js |
| 3313 |
init_extends(); |
| 3314 |
var StyledElementorLogo = (0, _elementor_ui.styled)(function ElementorLogo(props) { |
| 3315 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.SvgIcon, _extends$1({ viewBox: "0 0 32 32" }, props), /*#__PURE__*/ react.default.createElement("path", { |
| 3316 |
fillRule: "evenodd", |
| 3317 |
clipRule: "evenodd", |
| 3318 |
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" |
| 3319 |
})); |
| 3320 |
})(function(_ref) { |
| 3321 |
var theme = _ref.theme; |
| 3322 |
return { |
| 3323 |
width: theme.spacing(3), |
| 3324 |
height: theme.spacing(3), |
| 3325 |
"& path": { fill: theme.palette.text.primary } |
| 3326 |
}; |
| 3327 |
}); |
| 3328 |
var DialogHeader$1 = function DialogHeader(props) { |
| 3329 |
var hideAiBetaLogo = props.hideAiBetaLogo; |
| 3330 |
var onClose = props.onClose; |
| 3331 |
var children = props.children; |
| 3332 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.AppBar, { |
| 3333 |
sx: { fontWeight: "normal" }, |
| 3334 |
color: "transparent", |
| 3335 |
position: "relative" |
| 3336 |
}, /*#__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, { |
| 3337 |
component: "span", |
| 3338 |
variant: "subtitle2", |
| 3339 |
sx: { |
| 3340 |
fontWeight: "bold", |
| 3341 |
textTransform: "uppercase" |
| 3342 |
} |
| 3343 |
}, (0, _wordpress_i18n.__)("AI", "elementor")), /*#__PURE__*/ react.default.createElement(_elementor_ui.Chip, { |
| 3344 |
label: (0, _wordpress_i18n.__)("Beta", "elementor"), |
| 3345 |
color: "default", |
| 3346 |
size: "small", |
| 3347 |
sx: { ml: 1 } |
| 3348 |
})), /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, { |
| 3349 |
direction: "row", |
| 3350 |
spacing: 1, |
| 3351 |
alignItems: "center", |
| 3352 |
sx: { ml: hideAiBetaLogo ? 0 : "auto" } |
| 3353 |
}, children, /*#__PURE__*/ react.default.createElement(_elementor_ui.IconButton, { |
| 3354 |
size: "small", |
| 3355 |
"aria-label": "close", |
| 3356 |
onClick: onClose, |
| 3357 |
sx: { "&.MuiButtonBase-root": { mr: -1 } } |
| 3358 |
}, /*#__PURE__*/ react.default.createElement(_elementor_icons.XIcon, null))))); |
| 3359 |
}; |
| 3360 |
DialogHeader$1.propTypes = { |
| 3361 |
onClose: import_prop_types$8.default.func.isRequired, |
| 3362 |
hideAiBetaLogo: import_prop_types$8.default.bool, |
| 3363 |
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]) |
| 3364 |
}; |
| 3365 |
|
| 3366 |
//#endregion |
| 3367 |
//#region modules/ai/assets/js/editor/components/wizard-dialog.js |
| 3368 |
init_extends(); |
| 3369 |
init_defineProperty$1(); |
| 3370 |
init_objectWithoutProperties$1(); |
| 3371 |
var _excluded$31 = ["sx"]; |
| 3372 |
function ownKeys$28(e, r) { |
| 3373 |
var t = Object.keys(e); |
| 3374 |
if (Object.getOwnPropertySymbols) { |
| 3375 |
var o = Object.getOwnPropertySymbols(e); |
| 3376 |
r && (o = o.filter(function(r) { |
| 3377 |
return Object.getOwnPropertyDescriptor(e, r).enumerable; |
| 3378 |
})), t.push.apply(t, o); |
| 3379 |
} |
| 3380 |
return t; |
| 3381 |
} |
| 3382 |
__name(ownKeys$28, "ownKeys"); |
| 3383 |
function _objectSpread$27(e) { |
| 3384 |
for (var r = 1; r < arguments.length; r++) { |
| 3385 |
var t = null != arguments[r] ? arguments[r] : {}; |
| 3386 |
r % 2 ? ownKeys$28(Object(t), !0).forEach(function(r) { |
| 3387 |
_defineProperty$1(e, r, t[r]); |
| 3388 |
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$28(Object(t)).forEach(function(r) { |
| 3389 |
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); |
| 3390 |
}); |
| 3391 |
} |
| 3392 |
return e; |
| 3393 |
} |
| 3394 |
__name(_objectSpread$27, "_objectSpread"); |
| 3395 |
var WizardDialog = function WizardDialog(props) { |
| 3396 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Dialog, { |
| 3397 |
open: true, |
| 3398 |
onClose: props.onClose, |
| 3399 |
fullWidth: true, |
| 3400 |
hideBackdrop: true, |
| 3401 |
maxWidth: "lg", |
| 3402 |
PaperProps: { sx: { height: "88vh" } }, |
| 3403 |
sx: { zIndex: 9999 } |
| 3404 |
}, props.children); |
| 3405 |
}; |
| 3406 |
WizardDialog.propTypes = { |
| 3407 |
onClose: import_prop_types$8.default.func.isRequired, |
| 3408 |
children: import_prop_types$8.default.node.isRequired |
| 3409 |
}; |
| 3410 |
var WizardDialogContent = function WizardDialogContent(_ref) { |
| 3411 |
var _ref$sx = _ref.sx; |
| 3412 |
var sx = _ref$sx === void 0 ? {} : _ref$sx; |
| 3413 |
var props = _objectWithoutProperties$1(_ref, _excluded$31); |
| 3414 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.DialogContent, _extends$1({}, props, { sx: _objectSpread$27({ |
| 3415 |
display: "flex", |
| 3416 |
flexDirection: "column", |
| 3417 |
justifyContent: "center" |
| 3418 |
}, sx) })); |
| 3419 |
}; |
| 3420 |
WizardDialogContent.propTypes = { sx: import_prop_types$8.default.object }; |
| 3421 |
WizardDialog.Header = DialogHeader$1; |
| 3422 |
WizardDialog.Content = WizardDialogContent; |
| 3423 |
|
| 3424 |
//#endregion |
| 3425 |
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/typeof.js |
| 3426 |
function _typeof(o) { |
| 3427 |
"@babel/helpers - typeof"; |
| 3428 |
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) { |
| 3429 |
return typeof o; |
| 3430 |
} : function(o) { |
| 3431 |
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; |
| 3432 |
}, _typeof(o); |
| 3433 |
} |
| 3434 |
var init_typeof = __esmMin((() => {})); |
| 3435 |
|
| 3436 |
//#endregion |
| 3437 |
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPrimitive.js |
| 3438 |
function toPrimitive(t, r) { |
| 3439 |
if ("object" != _typeof(t) || !t) return t; |
| 3440 |
var e = t[Symbol.toPrimitive]; |
| 3441 |
if (void 0 !== e) { |
| 3442 |
var i = e.call(t, r || "default"); |
| 3443 |
if ("object" != _typeof(i)) return i; |
| 3444 |
throw new TypeError("@@toPrimitive must return a primitive value."); |
| 3445 |
} |
| 3446 |
return ("string" === r ? String : Number)(t); |
| 3447 |
} |
| 3448 |
var init_toPrimitive = __esmMin((() => { |
| 3449 |
init_typeof(); |
| 3450 |
})); |
| 3451 |
|
| 3452 |
//#endregion |
| 3453 |
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPropertyKey.js |
| 3454 |
function toPropertyKey(t) { |
| 3455 |
var i = toPrimitive(t, "string"); |
| 3456 |
return "symbol" == _typeof(i) ? i : i + ""; |
| 3457 |
} |
| 3458 |
var init_toPropertyKey = __esmMin((() => { |
| 3459 |
init_typeof(); |
| 3460 |
init_toPrimitive(); |
| 3461 |
})); |
| 3462 |
|
| 3463 |
//#endregion |
| 3464 |
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/defineProperty.js |
| 3465 |
function _defineProperty(e, r, t) { |
| 3466 |
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, { |
| 3467 |
value: t, |
| 3468 |
enumerable: !0, |
| 3469 |
configurable: !0, |
| 3470 |
writable: !0 |
| 3471 |
}) : e[r] = t, e; |
| 3472 |
} |
| 3473 |
var init_defineProperty = __esmMin((() => { |
| 3474 |
init_toPropertyKey(); |
| 3475 |
})); |
| 3476 |
|
| 3477 |
//#endregion |
| 3478 |
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/objectSpread2.js |
| 3479 |
function ownKeys$27(e, r) { |
| 3480 |
var t = Object.keys(e); |
| 3481 |
if (Object.getOwnPropertySymbols) { |
| 3482 |
var o = Object.getOwnPropertySymbols(e); |
| 3483 |
r && (o = o.filter(function(r) { |
| 3484 |
return Object.getOwnPropertyDescriptor(e, r).enumerable; |
| 3485 |
})), t.push.apply(t, o); |
| 3486 |
} |
| 3487 |
return t; |
| 3488 |
} |
| 3489 |
function _objectSpread2(e) { |
| 3490 |
for (var r = 1; r < arguments.length; r++) { |
| 3491 |
var t = null != arguments[r] ? arguments[r] : {}; |
| 3492 |
r % 2 ? ownKeys$27(Object(t), !0).forEach(function(r) { |
| 3493 |
_defineProperty(e, r, t[r]); |
| 3494 |
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$27(Object(t)).forEach(function(r) { |
| 3495 |
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); |
| 3496 |
}); |
| 3497 |
} |
| 3498 |
return e; |
| 3499 |
} |
| 3500 |
var init_objectSpread2 = __esmMin((() => { |
| 3501 |
init_defineProperty(); |
| 3502 |
__name(ownKeys$27, "ownKeys"); |
| 3503 |
})); |
| 3504 |
|
| 3505 |
//#endregion |
| 3506 |
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/objectWithoutPropertiesLoose.js |
| 3507 |
function _objectWithoutPropertiesLoose(r, e) { |
| 3508 |
if (null == r) return {}; |
| 3509 |
var t = {}; |
| 3510 |
for (var n in r) if ({}.hasOwnProperty.call(r, n)) { |
| 3511 |
if (e.includes(n)) continue; |
| 3512 |
t[n] = r[n]; |
| 3513 |
} |
| 3514 |
return t; |
| 3515 |
} |
| 3516 |
var init_objectWithoutPropertiesLoose = __esmMin((() => {})); |
| 3517 |
|
| 3518 |
//#endregion |
| 3519 |
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/objectWithoutProperties.js |
| 3520 |
function _objectWithoutProperties(e, t) { |
| 3521 |
if (null == e) return {}; |
| 3522 |
var o; |
| 3523 |
var r; |
| 3524 |
var i = _objectWithoutPropertiesLoose(e, t); |
| 3525 |
if (Object.getOwnPropertySymbols) { |
| 3526 |
var s = Object.getOwnPropertySymbols(e); |
| 3527 |
for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); |
| 3528 |
} |
| 3529 |
return i; |
| 3530 |
} |
| 3531 |
var init_objectWithoutProperties = __esmMin((() => { |
| 3532 |
init_objectWithoutPropertiesLoose(); |
| 3533 |
})); |
| 3534 |
|
| 3535 |
//#endregion |
| 3536 |
//#region node_modules/react-draggable/node_modules/clsx/dist/clsx.js |
| 3537 |
var require_clsx = /* @__PURE__ */ __commonJSMin(((exports, module) => { |
| 3538 |
function r(e) { |
| 3539 |
var o; |
| 3540 |
var t; |
| 3541 |
var f = ""; |
| 3542 |
if ("string" == typeof e || "number" == typeof e) f += e; |
| 3543 |
else if ("object" == typeof e) if (Array.isArray(e)) { |
| 3544 |
var n = e.length; |
| 3545 |
for (o = 0; o < n; o++) e[o] && (t = r(e[o])) && (f && (f += " "), f += t); |
| 3546 |
} else for (t in e) e[t] && (f && (f += " "), f += t); |
| 3547 |
return f; |
| 3548 |
} |
| 3549 |
function e() { |
| 3550 |
for (var e, o, t = 0, f = "", n = arguments.length; t < n; t++) (e = arguments[t]) && (o = r(e)) && (f && (f += " "), f += o); |
| 3551 |
return f; |
| 3552 |
} |
| 3553 |
module.exports = e, module.exports.clsx = e; |
| 3554 |
})); |
| 3555 |
|
| 3556 |
//#endregion |
| 3557 |
//#region node_modules/react-draggable/build/cjs/utils/shims.js |
| 3558 |
var require_shims = /* @__PURE__ */ __commonJSMin(((exports) => { |
| 3559 |
Object.defineProperty(exports, "__esModule", { value: true }); |
| 3560 |
exports.dontSetMe = dontSetMe; |
| 3561 |
exports.findInArray = findInArray; |
| 3562 |
exports.int = int; |
| 3563 |
exports.isFunction = isFunction; |
| 3564 |
exports.isNum = isNum; |
| 3565 |
function findInArray(array, callback) { |
| 3566 |
for (let i = 0, length = array.length; i < length; i++) if (callback.apply(callback, [ |
| 3567 |
array[i], |
| 3568 |
i, |
| 3569 |
array |
| 3570 |
])) return array[i]; |
| 3571 |
} |
| 3572 |
function isFunction(func) { |
| 3573 |
return typeof func === "function" || Object.prototype.toString.call(func) === "[object Function]"; |
| 3574 |
} |
| 3575 |
function isNum(num) { |
| 3576 |
return typeof num === "number" && !isNaN(num); |
| 3577 |
} |
| 3578 |
function int(a) { |
| 3579 |
return parseInt(a, 10); |
| 3580 |
} |
| 3581 |
function dontSetMe(props, propName, componentName) { |
| 3582 |
if (props[propName]) return /* @__PURE__ */ new Error(`Invalid prop ${propName} passed to ${componentName} - do not set this, set it on the child.`); |
| 3583 |
} |
| 3584 |
})); |
| 3585 |
|
| 3586 |
//#endregion |
| 3587 |
//#region node_modules/react-draggable/build/cjs/utils/getPrefix.js |
| 3588 |
var require_getPrefix = /* @__PURE__ */ __commonJSMin(((exports) => { |
| 3589 |
Object.defineProperty(exports, "__esModule", { value: true }); |
| 3590 |
exports.browserPrefixToKey = browserPrefixToKey; |
| 3591 |
exports.browserPrefixToStyle = browserPrefixToStyle; |
| 3592 |
exports.default = void 0; |
| 3593 |
exports.getPrefix = getPrefix; |
| 3594 |
var prefixes = [ |
| 3595 |
"Moz", |
| 3596 |
"Webkit", |
| 3597 |
"O", |
| 3598 |
"ms" |
| 3599 |
]; |
| 3600 |
function getPrefix() { |
| 3601 |
var _window$document; |
| 3602 |
let prop = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "transform"; |
| 3603 |
if (typeof window === "undefined") return ""; |
| 3604 |
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; |
| 3605 |
if (!style) return ""; |
| 3606 |
if (prop in style) return ""; |
| 3607 |
for (let i = 0; i < prefixes.length; i++) if (browserPrefixToKey(prop, prefixes[i]) in style) return prefixes[i]; |
| 3608 |
return ""; |
| 3609 |
} |
| 3610 |
function browserPrefixToKey(prop, prefix) { |
| 3611 |
return prefix ? `${prefix}${kebabToTitleCase(prop)}` : prop; |
| 3612 |
} |
| 3613 |
function browserPrefixToStyle(prop, prefix) { |
| 3614 |
return prefix ? `-${prefix.toLowerCase()}-${prop}` : prop; |
| 3615 |
} |
| 3616 |
function kebabToTitleCase(str) { |
| 3617 |
let out = ""; |
| 3618 |
let shouldCapitalize = true; |
| 3619 |
for (let i = 0; i < str.length; i++) if (shouldCapitalize) { |
| 3620 |
out += str[i].toUpperCase(); |
| 3621 |
shouldCapitalize = false; |
| 3622 |
} else if (str[i] === "-") shouldCapitalize = true; |
| 3623 |
else out += str[i]; |
| 3624 |
return out; |
| 3625 |
} |
| 3626 |
exports.default = getPrefix(); |
| 3627 |
})); |
| 3628 |
|
| 3629 |
//#endregion |
| 3630 |
//#region node_modules/react-draggable/build/cjs/utils/domFns.js |
| 3631 |
var require_domFns = /* @__PURE__ */ __commonJSMin(((exports) => { |
| 3632 |
init_objectSpread2(); |
| 3633 |
Object.defineProperty(exports, "__esModule", { value: true }); |
| 3634 |
exports.addClassName = addClassName; |
| 3635 |
exports.addEvent = addEvent; |
| 3636 |
exports.addUserSelectStyles = addUserSelectStyles; |
| 3637 |
exports.createCSSTransform = createCSSTransform; |
| 3638 |
exports.createSVGTransform = createSVGTransform; |
| 3639 |
exports.getTouch = getTouch; |
| 3640 |
exports.getTouchIdentifier = getTouchIdentifier; |
| 3641 |
exports.getTranslation = getTranslation; |
| 3642 |
exports.innerHeight = innerHeight; |
| 3643 |
exports.innerWidth = innerWidth; |
| 3644 |
exports.matchesSelector = matchesSelector; |
| 3645 |
exports.matchesSelectorAndParentsTo = matchesSelectorAndParentsTo; |
| 3646 |
exports.offsetXYFromParent = offsetXYFromParent; |
| 3647 |
exports.outerHeight = outerHeight; |
| 3648 |
exports.outerWidth = outerWidth; |
| 3649 |
exports.removeClassName = removeClassName; |
| 3650 |
exports.removeEvent = removeEvent; |
| 3651 |
exports.scheduleRemoveUserSelectStyles = scheduleRemoveUserSelectStyles; |
| 3652 |
var _shims = require_shims(); |
| 3653 |
var _getPrefix = _interopRequireWildcard(require_getPrefix()); |
| 3654 |
function _interopRequireWildcard(e, t) { |
| 3655 |
if ("function" == typeof WeakMap) { |
| 3656 |
var r = /* @__PURE__ */ new WeakMap(); |
| 3657 |
var n = /* @__PURE__ */ new WeakMap(); |
| 3658 |
} |
| 3659 |
return (_interopRequireWildcard = function(e, t) { |
| 3660 |
if (!t && e && e.__esModule) return e; |
| 3661 |
var o; |
| 3662 |
var i; |
| 3663 |
var f = { |
| 3664 |
__proto__: null, |
| 3665 |
default: e |
| 3666 |
}; |
| 3667 |
if (null === e || "object" != typeof e && "function" != typeof e) return f; |
| 3668 |
if (o = t ? n : r) { |
| 3669 |
if (o.has(e)) return o.get(e); |
| 3670 |
o.set(e, f); |
| 3671 |
} |
| 3672 |
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]); |
| 3673 |
return f; |
| 3674 |
})(e, t); |
| 3675 |
} |
| 3676 |
var matchesSelectorFunc = ""; |
| 3677 |
function matchesSelector(el, selector) { |
| 3678 |
if (!matchesSelectorFunc) matchesSelectorFunc = (0, _shims.findInArray)([ |
| 3679 |
"matches", |
| 3680 |
"webkitMatchesSelector", |
| 3681 |
"mozMatchesSelector", |
| 3682 |
"msMatchesSelector", |
| 3683 |
"oMatchesSelector" |
| 3684 |
], function(method) { |
| 3685 |
return (0, _shims.isFunction)(el[method]); |
| 3686 |
}); |
| 3687 |
if (!(0, _shims.isFunction)(el[matchesSelectorFunc])) return false; |
| 3688 |
return el[matchesSelectorFunc](selector); |
| 3689 |
} |
| 3690 |
function matchesSelectorAndParentsTo(el, selector, baseNode) { |
| 3691 |
let node = el; |
| 3692 |
do { |
| 3693 |
if (matchesSelector(node, selector)) return true; |
| 3694 |
if (node === baseNode) return false; |
| 3695 |
node = node.parentNode; |
| 3696 |
} while (node); |
| 3697 |
return false; |
| 3698 |
} |
| 3699 |
function addEvent(el, event, handler, inputOptions) { |
| 3700 |
if (!el) return; |
| 3701 |
const options = _objectSpread2({ capture: true }, inputOptions); |
| 3702 |
if (el.addEventListener) el.addEventListener(event, handler, options); |
| 3703 |
else if (el.attachEvent) el.attachEvent("on" + event, handler); |
| 3704 |
else el["on" + event] = handler; |
| 3705 |
} |
| 3706 |
function removeEvent(el, event, handler, inputOptions) { |
| 3707 |
if (!el) return; |
| 3708 |
const options = _objectSpread2({ capture: true }, inputOptions); |
| 3709 |
if (el.removeEventListener) el.removeEventListener(event, handler, options); |
| 3710 |
else if (el.detachEvent) el.detachEvent("on" + event, handler); |
| 3711 |
else el["on" + event] = null; |
| 3712 |
} |
| 3713 |
function outerHeight(node) { |
| 3714 |
let height = node.clientHeight; |
| 3715 |
const computedStyle = node.ownerDocument.defaultView.getComputedStyle(node); |
| 3716 |
height += (0, _shims.int)(computedStyle.borderTopWidth); |
| 3717 |
height += (0, _shims.int)(computedStyle.borderBottomWidth); |
| 3718 |
return height; |
| 3719 |
} |
| 3720 |
function outerWidth(node) { |
| 3721 |
let width = node.clientWidth; |
| 3722 |
const computedStyle = node.ownerDocument.defaultView.getComputedStyle(node); |
| 3723 |
width += (0, _shims.int)(computedStyle.borderLeftWidth); |
| 3724 |
width += (0, _shims.int)(computedStyle.borderRightWidth); |
| 3725 |
return width; |
| 3726 |
} |
| 3727 |
function innerHeight(node) { |
| 3728 |
let height = node.clientHeight; |
| 3729 |
const computedStyle = node.ownerDocument.defaultView.getComputedStyle(node); |
| 3730 |
height -= (0, _shims.int)(computedStyle.paddingTop); |
| 3731 |
height -= (0, _shims.int)(computedStyle.paddingBottom); |
| 3732 |
return height; |
| 3733 |
} |
| 3734 |
function innerWidth(node) { |
| 3735 |
let width = node.clientWidth; |
| 3736 |
const computedStyle = node.ownerDocument.defaultView.getComputedStyle(node); |
| 3737 |
width -= (0, _shims.int)(computedStyle.paddingLeft); |
| 3738 |
width -= (0, _shims.int)(computedStyle.paddingRight); |
| 3739 |
return width; |
| 3740 |
} |
| 3741 |
function offsetXYFromParent(evt, offsetParent, scale) { |
| 3742 |
const offsetParentRect = offsetParent === offsetParent.ownerDocument.body ? { |
| 3743 |
left: 0, |
| 3744 |
top: 0 |
| 3745 |
} : offsetParent.getBoundingClientRect(); |
| 3746 |
return { |
| 3747 |
x: (evt.clientX + offsetParent.scrollLeft - offsetParentRect.left) / scale, |
| 3748 |
y: (evt.clientY + offsetParent.scrollTop - offsetParentRect.top) / scale |
| 3749 |
}; |
| 3750 |
} |
| 3751 |
function createCSSTransform(controlPos, positionOffset) { |
| 3752 |
const translation = getTranslation(controlPos, positionOffset, "px"); |
| 3753 |
return { [(0, _getPrefix.browserPrefixToKey)("transform", _getPrefix.default)]: translation }; |
| 3754 |
} |
| 3755 |
function createSVGTransform(controlPos, positionOffset) { |
| 3756 |
return getTranslation(controlPos, positionOffset, ""); |
| 3757 |
} |
| 3758 |
function getTranslation(_ref, positionOffset, unitSuffix) { |
| 3759 |
let { x, y } = _ref; |
| 3760 |
let translation = `translate(${x}${unitSuffix},${y}${unitSuffix})`; |
| 3761 |
if (positionOffset) translation = `translate(${`${typeof positionOffset.x === "string" ? positionOffset.x : positionOffset.x + unitSuffix}`}, ${`${typeof positionOffset.y === "string" ? positionOffset.y : positionOffset.y + unitSuffix}`})` + translation; |
| 3762 |
return translation; |
| 3763 |
} |
| 3764 |
function getTouch(e, identifier) { |
| 3765 |
return e.targetTouches && (0, _shims.findInArray)(e.targetTouches, (t) => identifier === t.identifier) || e.changedTouches && (0, _shims.findInArray)(e.changedTouches, (t) => identifier === t.identifier); |
| 3766 |
} |
| 3767 |
function getTouchIdentifier(e) { |
| 3768 |
if (e.targetTouches && e.targetTouches[0]) return e.targetTouches[0].identifier; |
| 3769 |
if (e.changedTouches && e.changedTouches[0]) return e.changedTouches[0].identifier; |
| 3770 |
} |
| 3771 |
function addUserSelectStyles(doc) { |
| 3772 |
if (!doc) return; |
| 3773 |
let styleEl = doc.getElementById("react-draggable-style-el"); |
| 3774 |
if (!styleEl) { |
| 3775 |
styleEl = doc.createElement("style"); |
| 3776 |
styleEl.type = "text/css"; |
| 3777 |
styleEl.id = "react-draggable-style-el"; |
| 3778 |
styleEl.innerHTML = ".react-draggable-transparent-selection *::-moz-selection {all: inherit;}\n"; |
| 3779 |
styleEl.innerHTML += ".react-draggable-transparent-selection *::selection {all: inherit;}\n"; |
| 3780 |
doc.getElementsByTagName("head")[0].appendChild(styleEl); |
| 3781 |
} |
| 3782 |
if (doc.body) addClassName(doc.body, "react-draggable-transparent-selection"); |
| 3783 |
} |
| 3784 |
function scheduleRemoveUserSelectStyles(doc) { |
| 3785 |
if (window.requestAnimationFrame) window.requestAnimationFrame(() => { |
| 3786 |
removeUserSelectStyles(doc); |
| 3787 |
}); |
| 3788 |
else removeUserSelectStyles(doc); |
| 3789 |
} |
| 3790 |
function removeUserSelectStyles(doc) { |
| 3791 |
if (!doc) return; |
| 3792 |
try { |
| 3793 |
if (doc.body) removeClassName(doc.body, "react-draggable-transparent-selection"); |
| 3794 |
if (doc.selection) doc.selection.empty(); |
| 3795 |
else { |
| 3796 |
const selection = (doc.defaultView || window).getSelection(); |
| 3797 |
if (selection && selection.type !== "Caret") selection.removeAllRanges(); |
| 3798 |
} |
| 3799 |
} catch (e) {} |
| 3800 |
} |
| 3801 |
function addClassName(el, className) { |
| 3802 |
if (el.classList) el.classList.add(className); |
| 3803 |
else if (!el.className.match(new RegExp(`(?:^|\\s)${className}(?!\\S)`))) el.className += ` ${className}`; |
| 3804 |
} |
| 3805 |
function removeClassName(el, className) { |
| 3806 |
if (el.classList) el.classList.remove(className); |
| 3807 |
else el.className = el.className.replace(new RegExp(`(?:^|\\s)${className}(?!\\S)`, "g"), ""); |
| 3808 |
} |
| 3809 |
})); |
| 3810 |
|
| 3811 |
//#endregion |
| 3812 |
//#region node_modules/react-draggable/build/cjs/utils/positionFns.js |
| 3813 |
var require_positionFns = /* @__PURE__ */ __commonJSMin(((exports) => { |
| 3814 |
Object.defineProperty(exports, "__esModule", { value: true }); |
| 3815 |
exports.canDragX = canDragX; |
| 3816 |
exports.canDragY = canDragY; |
| 3817 |
exports.createCoreData = createCoreData; |
| 3818 |
exports.createDraggableData = createDraggableData; |
| 3819 |
exports.getBoundPosition = getBoundPosition; |
| 3820 |
exports.getControlPosition = getControlPosition; |
| 3821 |
exports.snapToGrid = snapToGrid; |
| 3822 |
var _shims = require_shims(); |
| 3823 |
var _domFns = require_domFns(); |
| 3824 |
function getBoundPosition(draggable, x, y) { |
| 3825 |
if (!draggable.props.bounds) return [x, y]; |
| 3826 |
let { bounds } = draggable.props; |
| 3827 |
bounds = typeof bounds === "string" ? bounds : cloneBounds(bounds); |
| 3828 |
const node = findDOMNode(draggable); |
| 3829 |
if (typeof bounds === "string") { |
| 3830 |
const { ownerDocument } = node; |
| 3831 |
const ownerWindow = ownerDocument.defaultView; |
| 3832 |
let boundNode; |
| 3833 |
if (bounds === "parent") boundNode = node.parentNode; |
| 3834 |
else boundNode = node.getRootNode().querySelector(bounds); |
| 3835 |
if (!(boundNode instanceof ownerWindow.HTMLElement)) throw new Error("Bounds selector \"" + bounds + "\" could not find an element."); |
| 3836 |
const boundNodeEl = boundNode; |
| 3837 |
const nodeStyle = ownerWindow.getComputedStyle(node); |
| 3838 |
const boundNodeStyle = ownerWindow.getComputedStyle(boundNodeEl); |
| 3839 |
bounds = { |
| 3840 |
left: -node.offsetLeft + (0, _shims.int)(boundNodeStyle.paddingLeft) + (0, _shims.int)(nodeStyle.marginLeft), |
| 3841 |
top: -node.offsetTop + (0, _shims.int)(boundNodeStyle.paddingTop) + (0, _shims.int)(nodeStyle.marginTop), |
| 3842 |
right: (0, _domFns.innerWidth)(boundNodeEl) - (0, _domFns.outerWidth)(node) - node.offsetLeft + (0, _shims.int)(boundNodeStyle.paddingRight) - (0, _shims.int)(nodeStyle.marginRight), |
| 3843 |
bottom: (0, _domFns.innerHeight)(boundNodeEl) - (0, _domFns.outerHeight)(node) - node.offsetTop + (0, _shims.int)(boundNodeStyle.paddingBottom) - (0, _shims.int)(nodeStyle.marginBottom) |
| 3844 |
}; |
| 3845 |
} |
| 3846 |
if ((0, _shims.isNum)(bounds.right)) x = Math.min(x, bounds.right); |
| 3847 |
if ((0, _shims.isNum)(bounds.bottom)) y = Math.min(y, bounds.bottom); |
| 3848 |
if ((0, _shims.isNum)(bounds.left)) x = Math.max(x, bounds.left); |
| 3849 |
if ((0, _shims.isNum)(bounds.top)) y = Math.max(y, bounds.top); |
| 3850 |
return [x, y]; |
| 3851 |
} |
| 3852 |
function snapToGrid(grid, pendingX, pendingY) { |
| 3853 |
return [Math.round(pendingX / grid[0]) * grid[0], Math.round(pendingY / grid[1]) * grid[1]]; |
| 3854 |
} |
| 3855 |
function canDragX(draggable) { |
| 3856 |
return draggable.props.axis === "both" || draggable.props.axis === "x"; |
| 3857 |
} |
| 3858 |
function canDragY(draggable) { |
| 3859 |
return draggable.props.axis === "both" || draggable.props.axis === "y"; |
| 3860 |
} |
| 3861 |
function getControlPosition(e, touchIdentifier, draggableCore) { |
| 3862 |
const touchObj = typeof touchIdentifier === "number" ? (0, _domFns.getTouch)(e, touchIdentifier) : null; |
| 3863 |
if (typeof touchIdentifier === "number" && !touchObj) return null; |
| 3864 |
const node = findDOMNode(draggableCore); |
| 3865 |
const offsetParent = draggableCore.props.offsetParent || node.offsetParent || node.ownerDocument.body; |
| 3866 |
return (0, _domFns.offsetXYFromParent)(touchObj || e, offsetParent, draggableCore.props.scale); |
| 3867 |
} |
| 3868 |
function createCoreData(draggable, x, y) { |
| 3869 |
const isStart = !(0, _shims.isNum)(draggable.lastX); |
| 3870 |
const node = findDOMNode(draggable); |
| 3871 |
if (isStart) return { |
| 3872 |
node, |
| 3873 |
deltaX: 0, |
| 3874 |
deltaY: 0, |
| 3875 |
lastX: x, |
| 3876 |
lastY: y, |
| 3877 |
x, |
| 3878 |
y |
| 3879 |
}; |
| 3880 |
else return { |
| 3881 |
node, |
| 3882 |
deltaX: x - draggable.lastX, |
| 3883 |
deltaY: y - draggable.lastY, |
| 3884 |
lastX: draggable.lastX, |
| 3885 |
lastY: draggable.lastY, |
| 3886 |
x, |
| 3887 |
y |
| 3888 |
}; |
| 3889 |
} |
| 3890 |
function createDraggableData(draggable, coreData) { |
| 3891 |
const scale = draggable.props.scale; |
| 3892 |
return { |
| 3893 |
node: coreData.node, |
| 3894 |
x: draggable.state.x + coreData.deltaX / scale, |
| 3895 |
y: draggable.state.y + coreData.deltaY / scale, |
| 3896 |
deltaX: coreData.deltaX / scale, |
| 3897 |
deltaY: coreData.deltaY / scale, |
| 3898 |
lastX: draggable.state.x, |
| 3899 |
lastY: draggable.state.y |
| 3900 |
}; |
| 3901 |
} |
| 3902 |
function cloneBounds(bounds) { |
| 3903 |
return { |
| 3904 |
left: bounds.left, |
| 3905 |
top: bounds.top, |
| 3906 |
right: bounds.right, |
| 3907 |
bottom: bounds.bottom |
| 3908 |
}; |
| 3909 |
} |
| 3910 |
function findDOMNode(draggable) { |
| 3911 |
const node = draggable.findDOMNode(); |
| 3912 |
if (!node) throw new Error("<DraggableCore>: Unmounted during event!"); |
| 3913 |
return node; |
| 3914 |
} |
| 3915 |
})); |
| 3916 |
|
| 3917 |
//#endregion |
| 3918 |
//#region node_modules/react-draggable/build/cjs/utils/log.js |
| 3919 |
var require_log = /* @__PURE__ */ __commonJSMin(((exports) => { |
| 3920 |
Object.defineProperty(exports, "__esModule", { value: true }); |
| 3921 |
exports.default = log; |
| 3922 |
function log() {} |
| 3923 |
})); |
| 3924 |
|
| 3925 |
//#endregion |
| 3926 |
//#region node_modules/react-draggable/build/cjs/DraggableCore.js |
| 3927 |
var require_DraggableCore = /* @__PURE__ */ __commonJSMin(((exports) => { |
| 3928 |
Object.defineProperty(exports, "__esModule", { value: true }); |
| 3929 |
exports.default = void 0; |
| 3930 |
var React$139 = _interopRequireWildcard((globalThis.React)); |
| 3931 |
var _propTypes = _interopRequireDefault(require_prop_types()); |
| 3932 |
var _reactDom$1 = _interopRequireDefault((globalThis.ReactDOM)); |
| 3933 |
var _domFns = require_domFns(); |
| 3934 |
var _positionFns = require_positionFns(); |
| 3935 |
var _shims = require_shims(); |
| 3936 |
var _log = _interopRequireDefault(require_log()); |
| 3937 |
function _interopRequireDefault(e) { |
| 3938 |
return e && e.__esModule ? e : { default: e }; |
| 3939 |
} |
| 3940 |
function _interopRequireWildcard(e, t) { |
| 3941 |
if ("function" == typeof WeakMap) { |
| 3942 |
var r = /* @__PURE__ */ new WeakMap(); |
| 3943 |
var n = /* @__PURE__ */ new WeakMap(); |
| 3944 |
} |
| 3945 |
return (_interopRequireWildcard = function(e, t) { |
| 3946 |
if (!t && e && e.__esModule) return e; |
| 3947 |
var o; |
| 3948 |
var i; |
| 3949 |
var f = { |
| 3950 |
__proto__: null, |
| 3951 |
default: e |
| 3952 |
}; |
| 3953 |
if (null === e || "object" != typeof e && "function" != typeof e) return f; |
| 3954 |
if (o = t ? n : r) { |
| 3955 |
if (o.has(e)) return o.get(e); |
| 3956 |
o.set(e, f); |
| 3957 |
} |
| 3958 |
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]); |
| 3959 |
return f; |
| 3960 |
})(e, t); |
| 3961 |
} |
| 3962 |
function _defineProperty(e, r, t) { |
| 3963 |
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { |
| 3964 |
value: t, |
| 3965 |
enumerable: !0, |
| 3966 |
configurable: !0, |
| 3967 |
writable: !0 |
| 3968 |
}) : e[r] = t, e; |
| 3969 |
} |
| 3970 |
function _toPropertyKey(t) { |
| 3971 |
var i = _toPrimitive(t, "string"); |
| 3972 |
return "symbol" == typeof i ? i : i + ""; |
| 3973 |
} |
| 3974 |
function _toPrimitive(t, r) { |
| 3975 |
if ("object" != typeof t || !t) return t; |
| 3976 |
var e = t[Symbol.toPrimitive]; |
| 3977 |
if (void 0 !== e) { |
| 3978 |
var i = e.call(t, r || "default"); |
| 3979 |
if ("object" != typeof i) return i; |
| 3980 |
throw new TypeError("@@toPrimitive must return a primitive value."); |
| 3981 |
} |
| 3982 |
return ("string" === r ? String : Number)(t); |
| 3983 |
} |
| 3984 |
var eventsFor = { |
| 3985 |
touch: { |
| 3986 |
start: "touchstart", |
| 3987 |
move: "touchmove", |
| 3988 |
stop: "touchend" |
| 3989 |
}, |
| 3990 |
mouse: { |
| 3991 |
start: "mousedown", |
| 3992 |
move: "mousemove", |
| 3993 |
stop: "mouseup" |
| 3994 |
} |
| 3995 |
}; |
| 3996 |
var dragEventFor = eventsFor.mouse; |
| 3997 |
var DraggableCore = class extends React$139.Component { |
| 3998 |
constructor() { |
| 3999 |
super(...arguments); |
| 4000 |
_defineProperty(this, "dragging", false); |
| 4001 |
_defineProperty(this, "lastX", NaN); |
| 4002 |
_defineProperty(this, "lastY", NaN); |
| 4003 |
_defineProperty(this, "touchIdentifier", null); |
| 4004 |
_defineProperty(this, "mounted", false); |
| 4005 |
_defineProperty(this, "handleDragStart", (e) => { |
| 4006 |
this.props.onMouseDown(e); |
| 4007 |
if (!this.props.allowAnyClick && typeof e.button === "number" && e.button !== 0) return false; |
| 4008 |
const thisNode = this.findDOMNode(); |
| 4009 |
if (!thisNode || !thisNode.ownerDocument || !thisNode.ownerDocument.body) throw new Error("<DraggableCore> not mounted on DragStart!"); |
| 4010 |
const { ownerDocument } = thisNode; |
| 4011 |
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; |
| 4012 |
if (e.type === "touchstart" && !this.props.allowMobileScroll) e.preventDefault(); |
| 4013 |
const touchIdentifier = (0, _domFns.getTouchIdentifier)(e); |
| 4014 |
this.touchIdentifier = touchIdentifier; |
| 4015 |
const position = (0, _positionFns.getControlPosition)(e, touchIdentifier, this); |
| 4016 |
if (position == null) return; |
| 4017 |
const { x, y } = position; |
| 4018 |
const coreEvent = (0, _positionFns.createCoreData)(this, x, y); |
| 4019 |
(0, _log.default)("DraggableCore: handleDragStart: %j", coreEvent); |
| 4020 |
(0, _log.default)("calling", this.props.onStart); |
| 4021 |
if (this.props.onStart(e, coreEvent) === false || this.mounted === false) return; |
| 4022 |
if (this.props.enableUserSelectHack) (0, _domFns.addUserSelectStyles)(ownerDocument); |
| 4023 |
this.dragging = true; |
| 4024 |
this.lastX = x; |
| 4025 |
this.lastY = y; |
| 4026 |
(0, _domFns.addEvent)(ownerDocument, dragEventFor.move, this.handleDrag); |
| 4027 |
(0, _domFns.addEvent)(ownerDocument, dragEventFor.stop, this.handleDragStop); |
| 4028 |
}); |
| 4029 |
_defineProperty(this, "handleDrag", (e) => { |
| 4030 |
const position = (0, _positionFns.getControlPosition)(e, this.touchIdentifier, this); |
| 4031 |
if (position == null) return; |
| 4032 |
let { x, y } = position; |
| 4033 |
if (Array.isArray(this.props.grid)) { |
| 4034 |
let deltaX = x - this.lastX; |
| 4035 |
let deltaY = y - this.lastY; |
| 4036 |
[deltaX, deltaY] = (0, _positionFns.snapToGrid)(this.props.grid, deltaX, deltaY); |
| 4037 |
if (!deltaX && !deltaY) return; |
| 4038 |
x = this.lastX + deltaX, y = this.lastY + deltaY; |
| 4039 |
} |
| 4040 |
const coreEvent = (0, _positionFns.createCoreData)(this, x, y); |
| 4041 |
(0, _log.default)("DraggableCore: handleDrag: %j", coreEvent); |
| 4042 |
if (this.props.onDrag(e, coreEvent) === false || this.mounted === false) { |
| 4043 |
try { |
| 4044 |
this.handleDragStop(new MouseEvent("mouseup")); |
| 4045 |
} catch (err) { |
| 4046 |
const event = document.createEvent("MouseEvents"); |
| 4047 |
event.initMouseEvent("mouseup", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null); |
| 4048 |
this.handleDragStop(event); |
| 4049 |
} |
| 4050 |
return; |
| 4051 |
} |
| 4052 |
this.lastX = x; |
| 4053 |
this.lastY = y; |
| 4054 |
}); |
| 4055 |
_defineProperty(this, "handleDragStop", (e) => { |
| 4056 |
if (!this.dragging) return; |
| 4057 |
const position = (0, _positionFns.getControlPosition)(e, this.touchIdentifier, this); |
| 4058 |
if (position == null) return; |
| 4059 |
let { x, y } = position; |
| 4060 |
if (Array.isArray(this.props.grid)) { |
| 4061 |
let deltaX = x - this.lastX || 0; |
| 4062 |
let deltaY = y - this.lastY || 0; |
| 4063 |
[deltaX, deltaY] = (0, _positionFns.snapToGrid)(this.props.grid, deltaX, deltaY); |
| 4064 |
x = this.lastX + deltaX, y = this.lastY + deltaY; |
| 4065 |
} |
| 4066 |
const coreEvent = (0, _positionFns.createCoreData)(this, x, y); |
| 4067 |
if (this.props.onStop(e, coreEvent) === false || this.mounted === false) return false; |
| 4068 |
const thisNode = this.findDOMNode(); |
| 4069 |
if (thisNode) { |
| 4070 |
if (this.props.enableUserSelectHack) (0, _domFns.scheduleRemoveUserSelectStyles)(thisNode.ownerDocument); |
| 4071 |
} |
| 4072 |
(0, _log.default)("DraggableCore: handleDragStop: %j", coreEvent); |
| 4073 |
this.dragging = false; |
| 4074 |
this.lastX = NaN; |
| 4075 |
this.lastY = NaN; |
| 4076 |
if (thisNode) { |
| 4077 |
(0, _log.default)("DraggableCore: Removing handlers"); |
| 4078 |
(0, _domFns.removeEvent)(thisNode.ownerDocument, dragEventFor.move, this.handleDrag); |
| 4079 |
(0, _domFns.removeEvent)(thisNode.ownerDocument, dragEventFor.stop, this.handleDragStop); |
| 4080 |
} |
| 4081 |
}); |
| 4082 |
_defineProperty(this, "onMouseDown", (e) => { |
| 4083 |
dragEventFor = eventsFor.mouse; |
| 4084 |
return this.handleDragStart(e); |
| 4085 |
}); |
| 4086 |
_defineProperty(this, "onMouseUp", (e) => { |
| 4087 |
dragEventFor = eventsFor.mouse; |
| 4088 |
return this.handleDragStop(e); |
| 4089 |
}); |
| 4090 |
_defineProperty(this, "onTouchStart", (e) => { |
| 4091 |
dragEventFor = eventsFor.touch; |
| 4092 |
return this.handleDragStart(e); |
| 4093 |
}); |
| 4094 |
_defineProperty(this, "onTouchEnd", (e) => { |
| 4095 |
dragEventFor = eventsFor.touch; |
| 4096 |
return this.handleDragStop(e); |
| 4097 |
}); |
| 4098 |
} |
| 4099 |
componentDidMount() { |
| 4100 |
this.mounted = true; |
| 4101 |
const thisNode = this.findDOMNode(); |
| 4102 |
if (thisNode) (0, _domFns.addEvent)(thisNode, eventsFor.touch.start, this.onTouchStart, { passive: false }); |
| 4103 |
} |
| 4104 |
componentWillUnmount() { |
| 4105 |
this.mounted = false; |
| 4106 |
const thisNode = this.findDOMNode(); |
| 4107 |
if (thisNode) { |
| 4108 |
const { ownerDocument } = thisNode; |
| 4109 |
(0, _domFns.removeEvent)(ownerDocument, eventsFor.mouse.move, this.handleDrag); |
| 4110 |
(0, _domFns.removeEvent)(ownerDocument, eventsFor.touch.move, this.handleDrag); |
| 4111 |
(0, _domFns.removeEvent)(ownerDocument, eventsFor.mouse.stop, this.handleDragStop); |
| 4112 |
(0, _domFns.removeEvent)(ownerDocument, eventsFor.touch.stop, this.handleDragStop); |
| 4113 |
(0, _domFns.removeEvent)(thisNode, eventsFor.touch.start, this.onTouchStart, { passive: false }); |
| 4114 |
if (this.props.enableUserSelectHack) (0, _domFns.scheduleRemoveUserSelectStyles)(ownerDocument); |
| 4115 |
} |
| 4116 |
} |
| 4117 |
findDOMNode() { |
| 4118 |
var _this$props; |
| 4119 |
var _this$props2; |
| 4120 |
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); |
| 4121 |
} |
| 4122 |
render() { |
| 4123 |
return /*#__PURE__*/ React$139.cloneElement(React$139.Children.only(this.props.children), { |
| 4124 |
onMouseDown: this.onMouseDown, |
| 4125 |
onMouseUp: this.onMouseUp, |
| 4126 |
onTouchEnd: this.onTouchEnd |
| 4127 |
}); |
| 4128 |
} |
| 4129 |
}; |
| 4130 |
exports.default = DraggableCore; |
| 4131 |
_defineProperty(DraggableCore, "displayName", "DraggableCore"); |
| 4132 |
_defineProperty(DraggableCore, "propTypes", { |
| 4133 |
/** |
| 4134 |
* `allowAnyClick` allows dragging using any mouse button. |
| 4135 |
* By default, we only accept the left button. |
| 4136 |
* |
| 4137 |
* Defaults to `false`. |
| 4138 |
*/ |
| 4139 |
allowAnyClick: _propTypes.default.bool, |
| 4140 |
/** |
| 4141 |
* `allowMobileScroll` turns off cancellation of the 'touchstart' event |
| 4142 |
* on mobile devices. Only enable this if you are having trouble with click |
| 4143 |
* events. Prefer using 'handle' / 'cancel' instead. |
| 4144 |
* |
| 4145 |
* Defaults to `false`. |
| 4146 |
*/ |
| 4147 |
allowMobileScroll: _propTypes.default.bool, |
| 4148 |
children: _propTypes.default.node.isRequired, |
| 4149 |
/** |
| 4150 |
* `disabled`, if true, stops the <Draggable> from dragging. All handlers, |
| 4151 |
* with the exception of `onMouseDown`, will not fire. |
| 4152 |
*/ |
| 4153 |
disabled: _propTypes.default.bool, |
| 4154 |
/** |
| 4155 |
* By default, we add 'user-select:none' attributes to the document body |
| 4156 |
* to prevent ugly text selection during drag. If this is causing problems |
| 4157 |
* for your app, set this to `false`. |
| 4158 |
*/ |
| 4159 |
enableUserSelectHack: _propTypes.default.bool, |
| 4160 |
/** |
| 4161 |
* `offsetParent`, if set, uses the passed DOM node to compute drag offsets |
| 4162 |
* instead of using the parent node. |
| 4163 |
*/ |
| 4164 |
offsetParent: function(props, propName) { |
| 4165 |
if (props[propName] && props[propName].nodeType !== 1) throw new Error("Draggable's offsetParent must be a DOM Node."); |
| 4166 |
}, |
| 4167 |
/** |
| 4168 |
* `grid` specifies the x and y that dragging should snap to. |
| 4169 |
*/ |
| 4170 |
grid: _propTypes.default.arrayOf(_propTypes.default.number), |
| 4171 |
/** |
| 4172 |
* `handle` specifies a selector to be used as the handle that initiates drag. |
| 4173 |
* |
| 4174 |
* Example: |
| 4175 |
* |
| 4176 |
* ```jsx |
| 4177 |
* let App = React.createClass({ |
| 4178 |
* render: function () { |
| 4179 |
* return ( |
| 4180 |
* <Draggable handle=".handle"> |
| 4181 |
* <div> |
| 4182 |
* <div className="handle">Click me to drag</div> |
| 4183 |
* <div>This is some other content</div> |
| 4184 |
* </div> |
| 4185 |
* </Draggable> |
| 4186 |
* ); |
| 4187 |
* } |
| 4188 |
* }); |
| 4189 |
* ``` |
| 4190 |
*/ |
| 4191 |
handle: _propTypes.default.string, |
| 4192 |
/** |
| 4193 |
* `cancel` specifies a selector to be used to prevent drag initialization. |
| 4194 |
* |
| 4195 |
* Example: |
| 4196 |
* |
| 4197 |
* ```jsx |
| 4198 |
* let App = React.createClass({ |
| 4199 |
* render: function () { |
| 4200 |
* return( |
| 4201 |
* <Draggable cancel=".cancel"> |
| 4202 |
* <div> |
| 4203 |
* <div className="cancel">You can't drag from here</div> |
| 4204 |
* <div>Dragging here works fine</div> |
| 4205 |
* </div> |
| 4206 |
* </Draggable> |
| 4207 |
* ); |
| 4208 |
* } |
| 4209 |
* }); |
| 4210 |
* ``` |
| 4211 |
*/ |
| 4212 |
cancel: _propTypes.default.string, |
| 4213 |
nodeRef: _propTypes.default.object, |
| 4214 |
/** |
| 4215 |
* Called when dragging starts. |
| 4216 |
* If this function returns the boolean false, dragging will be canceled. |
| 4217 |
*/ |
| 4218 |
onStart: _propTypes.default.func, |
| 4219 |
/** |
| 4220 |
* Called while dragging. |
| 4221 |
* If this function returns the boolean false, dragging will be canceled. |
| 4222 |
*/ |
| 4223 |
onDrag: _propTypes.default.func, |
| 4224 |
/** |
| 4225 |
* Called when dragging stops. |
| 4226 |
* If this function returns the boolean false, the drag will remain active. |
| 4227 |
*/ |
| 4228 |
onStop: _propTypes.default.func, |
| 4229 |
/** |
| 4230 |
* A workaround option which can be passed if onMouseDown needs to be accessed, |
| 4231 |
* since it'll always be blocked (as there is internal use of onMouseDown) |
| 4232 |
*/ |
| 4233 |
onMouseDown: _propTypes.default.func, |
| 4234 |
/** |
| 4235 |
* `scale`, if set, applies scaling while dragging an element |
| 4236 |
*/ |
| 4237 |
scale: _propTypes.default.number, |
| 4238 |
/** |
| 4239 |
* These properties should be defined on the child, not here. |
| 4240 |
*/ |
| 4241 |
className: _shims.dontSetMe, |
| 4242 |
style: _shims.dontSetMe, |
| 4243 |
transform: _shims.dontSetMe |
| 4244 |
}); |
| 4245 |
_defineProperty(DraggableCore, "defaultProps", { |
| 4246 |
allowAnyClick: false, |
| 4247 |
allowMobileScroll: false, |
| 4248 |
disabled: false, |
| 4249 |
enableUserSelectHack: true, |
| 4250 |
onStart: function() {}, |
| 4251 |
onDrag: function() {}, |
| 4252 |
onStop: function() {}, |
| 4253 |
onMouseDown: function() {}, |
| 4254 |
scale: 1 |
| 4255 |
}); |
| 4256 |
})); |
| 4257 |
|
| 4258 |
//#endregion |
| 4259 |
//#region node_modules/react-draggable/build/cjs/Draggable.js |
| 4260 |
var require_Draggable = /* @__PURE__ */ __commonJSMin(((exports) => { |
| 4261 |
init_objectSpread2(); |
| 4262 |
init_objectWithoutProperties(); |
| 4263 |
var _excluded = [ |
| 4264 |
"axis", |
| 4265 |
"bounds", |
| 4266 |
"children", |
| 4267 |
"defaultPosition", |
| 4268 |
"defaultClassName", |
| 4269 |
"defaultClassNameDragging", |
| 4270 |
"defaultClassNameDragged", |
| 4271 |
"position", |
| 4272 |
"positionOffset", |
| 4273 |
"scale" |
| 4274 |
]; |
| 4275 |
Object.defineProperty(exports, "__esModule", { value: true }); |
| 4276 |
Object.defineProperty(exports, "DraggableCore", { |
| 4277 |
enumerable: true, |
| 4278 |
get: function() { |
| 4279 |
return _DraggableCore.default; |
| 4280 |
} |
| 4281 |
}); |
| 4282 |
exports.default = void 0; |
| 4283 |
var React$138 = _interopRequireWildcard((globalThis.React)); |
| 4284 |
var _propTypes = _interopRequireDefault(require_prop_types()); |
| 4285 |
var _reactDom = _interopRequireDefault((globalThis.ReactDOM)); |
| 4286 |
var _clsx = require_clsx(); |
| 4287 |
var _domFns = require_domFns(); |
| 4288 |
var _positionFns = require_positionFns(); |
| 4289 |
var _shims = require_shims(); |
| 4290 |
var _DraggableCore = _interopRequireDefault(require_DraggableCore()); |
| 4291 |
var _log = _interopRequireDefault(require_log()); |
| 4292 |
function _interopRequireDefault(e) { |
| 4293 |
return e && e.__esModule ? e : { default: e }; |
| 4294 |
} |
| 4295 |
function _interopRequireWildcard(e, t) { |
| 4296 |
if ("function" == typeof WeakMap) { |
| 4297 |
var r = /* @__PURE__ */ new WeakMap(); |
| 4298 |
var n = /* @__PURE__ */ new WeakMap(); |
| 4299 |
} |
| 4300 |
return (_interopRequireWildcard = function(e, t) { |
| 4301 |
if (!t && e && e.__esModule) return e; |
| 4302 |
var o; |
| 4303 |
var i; |
| 4304 |
var f = { |
| 4305 |
__proto__: null, |
| 4306 |
default: e |
| 4307 |
}; |
| 4308 |
if (null === e || "object" != typeof e && "function" != typeof e) return f; |
| 4309 |
if (o = t ? n : r) { |
| 4310 |
if (o.has(e)) return o.get(e); |
| 4311 |
o.set(e, f); |
| 4312 |
} |
| 4313 |
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]); |
| 4314 |
return f; |
| 4315 |
})(e, t); |
| 4316 |
} |
| 4317 |
function _extends() { |
| 4318 |
return _extends = Object.assign ? Object.assign.bind() : function(n) { |
| 4319 |
for (var e = 1; e < arguments.length; e++) { |
| 4320 |
var t = arguments[e]; |
| 4321 |
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); |
| 4322 |
} |
| 4323 |
return n; |
| 4324 |
}, _extends.apply(null, arguments); |
| 4325 |
} |
| 4326 |
function _defineProperty(e, r, t) { |
| 4327 |
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { |
| 4328 |
value: t, |
| 4329 |
enumerable: !0, |
| 4330 |
configurable: !0, |
| 4331 |
writable: !0 |
| 4332 |
}) : e[r] = t, e; |
| 4333 |
} |
| 4334 |
function _toPropertyKey(t) { |
| 4335 |
var i = _toPrimitive(t, "string"); |
| 4336 |
return "symbol" == typeof i ? i : i + ""; |
| 4337 |
} |
| 4338 |
function _toPrimitive(t, r) { |
| 4339 |
if ("object" != typeof t || !t) return t; |
| 4340 |
var e = t[Symbol.toPrimitive]; |
| 4341 |
if (void 0 !== e) { |
| 4342 |
var i = e.call(t, r || "default"); |
| 4343 |
if ("object" != typeof i) return i; |
| 4344 |
throw new TypeError("@@toPrimitive must return a primitive value."); |
| 4345 |
} |
| 4346 |
return ("string" === r ? String : Number)(t); |
| 4347 |
} |
| 4348 |
var Draggable = class extends React$138.Component { |
| 4349 |
static getDerivedStateFromProps(_ref, _ref2) { |
| 4350 |
let { position } = _ref; |
| 4351 |
let { prevPropsPosition } = _ref2; |
| 4352 |
if (position && (!prevPropsPosition || position.x !== prevPropsPosition.x || position.y !== prevPropsPosition.y)) { |
| 4353 |
(0, _log.default)("Draggable: getDerivedStateFromProps %j", { |
| 4354 |
position, |
| 4355 |
prevPropsPosition |
| 4356 |
}); |
| 4357 |
return { |
| 4358 |
x: position.x, |
| 4359 |
y: position.y, |
| 4360 |
prevPropsPosition: _objectSpread2({}, position) |
| 4361 |
}; |
| 4362 |
} |
| 4363 |
return null; |
| 4364 |
} |
| 4365 |
constructor(props) { |
| 4366 |
super(props); |
| 4367 |
_defineProperty(this, "onDragStart", (e, coreData) => { |
| 4368 |
(0, _log.default)("Draggable: onDragStart: %j", coreData); |
| 4369 |
if (this.props.onStart(e, (0, _positionFns.createDraggableData)(this, coreData)) === false) return false; |
| 4370 |
this.setState({ |
| 4371 |
dragging: true, |
| 4372 |
dragged: true |
| 4373 |
}); |
| 4374 |
}); |
| 4375 |
_defineProperty(this, "onDrag", (e, coreData) => { |
| 4376 |
if (!this.state.dragging) return false; |
| 4377 |
(0, _log.default)("Draggable: onDrag: %j", coreData); |
| 4378 |
const uiData = (0, _positionFns.createDraggableData)(this, coreData); |
| 4379 |
const newState = { |
| 4380 |
x: uiData.x, |
| 4381 |
y: uiData.y, |
| 4382 |
slackX: 0, |
| 4383 |
slackY: 0 |
| 4384 |
}; |
| 4385 |
if (this.props.bounds) { |
| 4386 |
const { x, y } = newState; |
| 4387 |
newState.x += this.state.slackX; |
| 4388 |
newState.y += this.state.slackY; |
| 4389 |
const [newStateX, newStateY] = (0, _positionFns.getBoundPosition)(this, newState.x, newState.y); |
| 4390 |
newState.x = newStateX; |
| 4391 |
newState.y = newStateY; |
| 4392 |
newState.slackX = this.state.slackX + (x - newState.x); |
| 4393 |
newState.slackY = this.state.slackY + (y - newState.y); |
| 4394 |
uiData.x = newState.x; |
| 4395 |
uiData.y = newState.y; |
| 4396 |
uiData.deltaX = newState.x - this.state.x; |
| 4397 |
uiData.deltaY = newState.y - this.state.y; |
| 4398 |
} |
| 4399 |
if (this.props.onDrag(e, uiData) === false) return false; |
| 4400 |
this.setState(newState); |
| 4401 |
}); |
| 4402 |
_defineProperty(this, "onDragStop", (e, coreData) => { |
| 4403 |
if (!this.state.dragging) return false; |
| 4404 |
if (this.props.onStop(e, (0, _positionFns.createDraggableData)(this, coreData)) === false) return false; |
| 4405 |
(0, _log.default)("Draggable: onDragStop: %j", coreData); |
| 4406 |
const newState = { |
| 4407 |
dragging: false, |
| 4408 |
slackX: 0, |
| 4409 |
slackY: 0 |
| 4410 |
}; |
| 4411 |
if (Boolean(this.props.position)) { |
| 4412 |
const { x, y } = this.props.position; |
| 4413 |
newState.x = x; |
| 4414 |
newState.y = y; |
| 4415 |
} |
| 4416 |
this.setState(newState); |
| 4417 |
}); |
| 4418 |
this.state = { |
| 4419 |
dragging: false, |
| 4420 |
dragged: false, |
| 4421 |
x: props.position ? props.position.x : props.defaultPosition.x, |
| 4422 |
y: props.position ? props.position.y : props.defaultPosition.y, |
| 4423 |
prevPropsPosition: _objectSpread2({}, props.position), |
| 4424 |
slackX: 0, |
| 4425 |
slackY: 0, |
| 4426 |
isElementSVG: false |
| 4427 |
}; |
| 4428 |
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."); |
| 4429 |
} |
| 4430 |
componentDidMount() { |
| 4431 |
if (typeof window.SVGElement !== "undefined" && this.findDOMNode() instanceof window.SVGElement) this.setState({ isElementSVG: true }); |
| 4432 |
} |
| 4433 |
componentWillUnmount() { |
| 4434 |
if (this.state.dragging) this.setState({ dragging: false }); |
| 4435 |
} |
| 4436 |
findDOMNode() { |
| 4437 |
var _this$props$nodeRef$c; |
| 4438 |
var _this$props; |
| 4439 |
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); |
| 4440 |
} |
| 4441 |
render() { |
| 4442 |
const _this$props2 = this.props, { axis, bounds, children, defaultPosition, defaultClassName, defaultClassNameDragging, defaultClassNameDragged, position, positionOffset, scale } = _this$props2, draggableCoreProps = _objectWithoutProperties(_this$props2, _excluded); |
| 4443 |
let style = {}; |
| 4444 |
let svgTransform = null; |
| 4445 |
const draggable = !Boolean(position) || this.state.dragging; |
| 4446 |
const validPosition = position || defaultPosition; |
| 4447 |
const transformOpts = { |
| 4448 |
x: (0, _positionFns.canDragX)(this) && draggable ? this.state.x : validPosition.x, |
| 4449 |
y: (0, _positionFns.canDragY)(this) && draggable ? this.state.y : validPosition.y |
| 4450 |
}; |
| 4451 |
if (this.state.isElementSVG) svgTransform = (0, _domFns.createSVGTransform)(transformOpts, positionOffset); |
| 4452 |
else style = (0, _domFns.createCSSTransform)(transformOpts, positionOffset); |
| 4453 |
const className = (0, _clsx.clsx)(children.props.className || "", defaultClassName, { |
| 4454 |
[defaultClassNameDragging]: this.state.dragging, |
| 4455 |
[defaultClassNameDragged]: this.state.dragged |
| 4456 |
}); |
| 4457 |
return /*#__PURE__*/ React$138.createElement(_DraggableCore.default, _extends({}, draggableCoreProps, { |
| 4458 |
onStart: this.onDragStart, |
| 4459 |
onDrag: this.onDrag, |
| 4460 |
onStop: this.onDragStop |
| 4461 |
}), /*#__PURE__*/ React$138.cloneElement(React$138.Children.only(children), { |
| 4462 |
className, |
| 4463 |
style: _objectSpread2(_objectSpread2({}, children.props.style), style), |
| 4464 |
transform: svgTransform |
| 4465 |
})); |
| 4466 |
} |
| 4467 |
}; |
| 4468 |
exports.default = Draggable; |
| 4469 |
_defineProperty(Draggable, "displayName", "Draggable"); |
| 4470 |
_defineProperty(Draggable, "propTypes", _objectSpread2(_objectSpread2({}, _DraggableCore.default.propTypes), {}, { |
| 4471 |
/** |
| 4472 |
* `axis` determines which axis the draggable can move. |
| 4473 |
* |
| 4474 |
* Note that all callbacks will still return data as normal. This only |
| 4475 |
* controls flushing to the DOM. |
| 4476 |
* |
| 4477 |
* 'both' allows movement horizontally and vertically. |
| 4478 |
* 'x' limits movement to horizontal axis. |
| 4479 |
* 'y' limits movement to vertical axis. |
| 4480 |
* 'none' limits all movement. |
| 4481 |
* |
| 4482 |
* Defaults to 'both'. |
| 4483 |
*/ |
| 4484 |
axis: _propTypes.default.oneOf([ |
| 4485 |
"both", |
| 4486 |
"x", |
| 4487 |
"y", |
| 4488 |
"none" |
| 4489 |
]), |
| 4490 |
/** |
| 4491 |
* `bounds` determines the range of movement available to the element. |
| 4492 |
* Available values are: |
| 4493 |
* |
| 4494 |
* 'parent' restricts movement within the Draggable's parent node. |
| 4495 |
* |
| 4496 |
* Alternatively, pass an object with the following properties, all of which are optional: |
| 4497 |
* |
| 4498 |
* {left: LEFT_BOUND, right: RIGHT_BOUND, bottom: BOTTOM_BOUND, top: TOP_BOUND} |
| 4499 |
* |
| 4500 |
* All values are in px. |
| 4501 |
* |
| 4502 |
* Example: |
| 4503 |
* |
| 4504 |
* ```jsx |
| 4505 |
* let App = React.createClass({ |
| 4506 |
* render: function () { |
| 4507 |
* return ( |
| 4508 |
* <Draggable bounds={{right: 300, bottom: 300}}> |
| 4509 |
* <div>Content</div> |
| 4510 |
* </Draggable> |
| 4511 |
* ); |
| 4512 |
* } |
| 4513 |
* }); |
| 4514 |
* ``` |
| 4515 |
*/ |
| 4516 |
bounds: _propTypes.default.oneOfType([ |
| 4517 |
_propTypes.default.shape({ |
| 4518 |
left: _propTypes.default.number, |
| 4519 |
right: _propTypes.default.number, |
| 4520 |
top: _propTypes.default.number, |
| 4521 |
bottom: _propTypes.default.number |
| 4522 |
}), |
| 4523 |
_propTypes.default.string, |
| 4524 |
_propTypes.default.oneOf([false]) |
| 4525 |
]), |
| 4526 |
defaultClassName: _propTypes.default.string, |
| 4527 |
defaultClassNameDragging: _propTypes.default.string, |
| 4528 |
defaultClassNameDragged: _propTypes.default.string, |
| 4529 |
/** |
| 4530 |
* `defaultPosition` specifies the x and y that the dragged item should start at |
| 4531 |
* |
| 4532 |
* Example: |
| 4533 |
* |
| 4534 |
* ```jsx |
| 4535 |
* let App = React.createClass({ |
| 4536 |
* render: function () { |
| 4537 |
* return ( |
| 4538 |
* <Draggable defaultPosition={{x: 25, y: 25}}> |
| 4539 |
* <div>I start with transformX: 25px and transformY: 25px;</div> |
| 4540 |
* </Draggable> |
| 4541 |
* ); |
| 4542 |
* } |
| 4543 |
* }); |
| 4544 |
* ``` |
| 4545 |
*/ |
| 4546 |
defaultPosition: _propTypes.default.shape({ |
| 4547 |
x: _propTypes.default.number, |
| 4548 |
y: _propTypes.default.number |
| 4549 |
}), |
| 4550 |
positionOffset: _propTypes.default.shape({ |
| 4551 |
x: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]), |
| 4552 |
y: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]) |
| 4553 |
}), |
| 4554 |
/** |
| 4555 |
* `position`, if present, defines the current position of the element. |
| 4556 |
* |
| 4557 |
* This is similar to how form elements in React work - if no `position` is supplied, the component |
| 4558 |
* is uncontrolled. |
| 4559 |
* |
| 4560 |
* Example: |
| 4561 |
* |
| 4562 |
* ```jsx |
| 4563 |
* let App = React.createClass({ |
| 4564 |
* render: function () { |
| 4565 |
* return ( |
| 4566 |
* <Draggable position={{x: 25, y: 25}}> |
| 4567 |
* <div>I start with transformX: 25px and transformY: 25px;</div> |
| 4568 |
* </Draggable> |
| 4569 |
* ); |
| 4570 |
* } |
| 4571 |
* }); |
| 4572 |
* ``` |
| 4573 |
*/ |
| 4574 |
position: _propTypes.default.shape({ |
| 4575 |
x: _propTypes.default.number, |
| 4576 |
y: _propTypes.default.number |
| 4577 |
}), |
| 4578 |
/** |
| 4579 |
* These properties should be defined on the child, not here. |
| 4580 |
*/ |
| 4581 |
className: _shims.dontSetMe, |
| 4582 |
style: _shims.dontSetMe, |
| 4583 |
transform: _shims.dontSetMe |
| 4584 |
})); |
| 4585 |
_defineProperty(Draggable, "defaultProps", _objectSpread2(_objectSpread2({}, _DraggableCore.default.defaultProps), {}, { |
| 4586 |
axis: "both", |
| 4587 |
bounds: false, |
| 4588 |
defaultClassName: "react-draggable", |
| 4589 |
defaultClassNameDragging: "react-draggable-dragging", |
| 4590 |
defaultClassNameDragged: "react-draggable-dragged", |
| 4591 |
defaultPosition: { |
| 4592 |
x: 0, |
| 4593 |
y: 0 |
| 4594 |
}, |
| 4595 |
scale: 1 |
| 4596 |
})); |
| 4597 |
})); |
| 4598 |
|
| 4599 |
//#endregion |
| 4600 |
//#region node_modules/react-draggable/build/cjs/cjs.js |
| 4601 |
var require_cjs = /* @__PURE__ */ __commonJSMin(((exports, module) => { |
| 4602 |
var { default: Draggable, DraggableCore } = require_Draggable(); |
| 4603 |
module.exports = Draggable; |
| 4604 |
module.exports.default = Draggable; |
| 4605 |
module.exports.DraggableCore = DraggableCore; |
| 4606 |
})); |
| 4607 |
|
| 4608 |
//#endregion |
| 4609 |
//#region modules/ai/assets/js/editor/components/prompt-dialog.js |
| 4610 |
init_extends(); |
| 4611 |
init_defineProperty$1(); |
| 4612 |
init_slicedToArray(); |
| 4613 |
var import_cjs = /* @__PURE__ */ __toESM(require_cjs()); |
| 4614 |
function ownKeys$26(e, r) { |
| 4615 |
var t = Object.keys(e); |
| 4616 |
if (Object.getOwnPropertySymbols) { |
| 4617 |
var o = Object.getOwnPropertySymbols(e); |
| 4618 |
r && (o = o.filter(function(r) { |
| 4619 |
return Object.getOwnPropertyDescriptor(e, r).enumerable; |
| 4620 |
})), t.push.apply(t, o); |
| 4621 |
} |
| 4622 |
return t; |
| 4623 |
} |
| 4624 |
__name(ownKeys$26, "ownKeys"); |
| 4625 |
function _objectSpread$26(e) { |
| 4626 |
for (var r = 1; r < arguments.length; r++) { |
| 4627 |
var t = null != arguments[r] ? arguments[r] : {}; |
| 4628 |
r % 2 ? ownKeys$26(Object(t), !0).forEach(function(r) { |
| 4629 |
_defineProperty$1(e, r, t[r]); |
| 4630 |
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$26(Object(t)).forEach(function(r) { |
| 4631 |
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); |
| 4632 |
}); |
| 4633 |
} |
| 4634 |
return e; |
| 4635 |
} |
| 4636 |
__name(_objectSpread$26, "_objectSpread"); |
| 4637 |
var DraggablePaper = function DraggablePaper(props) { |
| 4638 |
var _useState2 = _slicedToArray((0, react.useState)({ |
| 4639 |
x: 0, |
| 4640 |
y: 0 |
| 4641 |
}), 2); |
| 4642 |
var position = _useState2[0]; |
| 4643 |
var setPosition = _useState2[1]; |
| 4644 |
var paperRef = (0, react.useRef)(null); |
| 4645 |
var timeout = (0, react.useRef)(null); |
| 4646 |
var onDrag = function onDrag(_e, _ref) { |
| 4647 |
var x = _ref.x; |
| 4648 |
var y = _ref.y; |
| 4649 |
return setPosition({ |
| 4650 |
x, |
| 4651 |
y |
| 4652 |
}); |
| 4653 |
}; |
| 4654 |
var handlePositionBoundaries = function handlePositionBoundaries() { |
| 4655 |
clearTimeout(timeout.current); |
| 4656 |
timeout.current = setTimeout(function() { |
| 4657 |
var _paperRef$current; |
| 4658 |
var dialogTop = (_paperRef$current = paperRef.current) === null || _paperRef$current === void 0 ? void 0 : _paperRef$current.getBoundingClientRect().top; |
| 4659 |
if (dialogTop < 0) setPosition(function(prev) { |
| 4660 |
return _objectSpread$26(_objectSpread$26({}, prev), {}, { y: prev.y - dialogTop }); |
| 4661 |
}); |
| 4662 |
}, 50); |
| 4663 |
}; |
| 4664 |
(0, react.useEffect)(function() { |
| 4665 |
var resizeObserver = new ResizeObserver(handlePositionBoundaries); |
| 4666 |
resizeObserver.observe(paperRef.current); |
| 4667 |
return function() { |
| 4668 |
resizeObserver.disconnect(); |
| 4669 |
}; |
| 4670 |
}, []); |
| 4671 |
return /*#__PURE__*/ react.default.createElement(import_cjs.default, { |
| 4672 |
position, |
| 4673 |
onDrag, |
| 4674 |
handle: ".MuiAppBar-root", |
| 4675 |
cancel: "[class*=\"MuiDialogContent-root\"]", |
| 4676 |
bounds: "parent" |
| 4677 |
}, /*#__PURE__*/ react.default.createElement(_elementor_ui.Paper, _extends$1({}, props, { ref: paperRef }))); |
| 4678 |
}; |
| 4679 |
var PromptDialog = function PromptDialog(props) { |
| 4680 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Dialog, _extends$1({ |
| 4681 |
scroll: "paper", |
| 4682 |
open: true, |
| 4683 |
fullWidth: true, |
| 4684 |
hideBackdrop: true, |
| 4685 |
PaperComponent: DraggablePaper, |
| 4686 |
disableScrollLock: true, |
| 4687 |
sx: { "& .MuiDialog-container": { |
| 4688 |
alignItems: "flex-start", |
| 4689 |
mt: "18vh" |
| 4690 |
} }, |
| 4691 |
PaperProps: { sx: { |
| 4692 |
m: 0, |
| 4693 |
maxHeight: "76vh" |
| 4694 |
} } |
| 4695 |
}, props), props.children); |
| 4696 |
}; |
| 4697 |
PromptDialog.propTypes = { |
| 4698 |
onClose: import_prop_types$8.default.func.isRequired, |
| 4699 |
children: import_prop_types$8.default.node, |
| 4700 |
maxWidth: import_prop_types$8.default.oneOf([ |
| 4701 |
"xs", |
| 4702 |
"sm", |
| 4703 |
"md", |
| 4704 |
"lg", |
| 4705 |
"xl", |
| 4706 |
false |
| 4707 |
]) |
| 4708 |
}; |
| 4709 |
PromptDialog.Header = DialogHeader$1; |
| 4710 |
PromptDialog.Content = _elementor_ui.DialogContent; |
| 4711 |
|
| 4712 |
//#endregion |
| 4713 |
//#region modules/ai/assets/js/editor/components/upgrade-chip.js |
| 4714 |
init_slicedToArray(); |
| 4715 |
var popoverId$1 = "e-ai-upgrade-popover"; |
| 4716 |
var StyledContent$3 = (0, _elementor_ui.styled)(_elementor_ui.Paper)(function(_ref) { |
| 4717 |
var theme = _ref.theme; |
| 4718 |
return { |
| 4719 |
position: "relative", |
| 4720 |
"[data-popper-placement=\"top\"] &": { marginBottom: theme.spacing(2.5) }, |
| 4721 |
"[data-popper-placement=\"bottom\"] &": { marginTop: theme.spacing(2.5) }, |
| 4722 |
padding: theme.spacing(3), |
| 4723 |
boxShadow: theme.shadows[4], |
| 4724 |
zIndex: "9999" |
| 4725 |
}; |
| 4726 |
}); |
| 4727 |
var StyledArrow$1 = (0, _elementor_ui.styled)(_elementor_ui.Box)(function(_ref2) { |
| 4728 |
var theme = _ref2.theme; |
| 4729 |
return { |
| 4730 |
width: theme.spacing(5), |
| 4731 |
height: theme.spacing(2.5), |
| 4732 |
position: "absolute", |
| 4733 |
overflow: "hidden", |
| 4734 |
left: "50% !important", |
| 4735 |
transform: "translateX(-50%) rotate(var(--rotate, 0deg)) !important", |
| 4736 |
"[data-popper-placement=\"top\"] &": { top: "100%" }, |
| 4737 |
"[data-popper-placement=\"bottom\"] &": { |
| 4738 |
"--rotate": "180deg", |
| 4739 |
top: "calc(".concat(theme.spacing(2.5), " * -1)") |
| 4740 |
}, |
| 4741 |
"&::after": { |
| 4742 |
backgroundColor: theme.palette.background.paper, |
| 4743 |
content: "\"\"", |
| 4744 |
display: "block", |
| 4745 |
position: "absolute", |
| 4746 |
width: theme.spacing(2.5), |
| 4747 |
height: theme.spacing(2.5), |
| 4748 |
top: 0, |
| 4749 |
left: "50%", |
| 4750 |
transform: "translateX(-50%) translateY(-50%) rotate(45deg)", |
| 4751 |
boxShadow: "1px 1px 5px 0px rgba(0, 0, 0, 0.2)", |
| 4752 |
backgroundImage: "linear-gradient(rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.05))" |
| 4753 |
} |
| 4754 |
}; |
| 4755 |
}); |
| 4756 |
var upgradeBullets = [ |
| 4757 |
(0, _wordpress_i18n.__)("Get spot-on suggestions from AI Copilot and AI Context with appropriate designs, layouts, and content for your business.", "elementor"), |
| 4758 |
(0, _wordpress_i18n.__)("Generate professional texts about any topic, in any tone.", "elementor"), |
| 4759 |
(0, _wordpress_i18n.__)("Effortlessly create or enhance stunning images and bring your ideas to life.", "elementor"), |
| 4760 |
(0, _wordpress_i18n.__)("Unleash infinite possibilities with the custom code generator.", "elementor"), |
| 4761 |
(0, _wordpress_i18n.__)("Access 30-days of AI History with the AI Starter plan and 90-days with the Power plan.", "elementor") |
| 4762 |
]; |
| 4763 |
var Chip$2 = (0, _elementor_ui.styled)(_elementor_ui.Chip)(function() { |
| 4764 |
return { |
| 4765 |
"& .MuiChip-label": { lineHeight: 1.5 }, |
| 4766 |
"& .MuiSvgIcon-root.MuiChip-icon": { fontSize: "1.25rem" } |
| 4767 |
}; |
| 4768 |
}); |
| 4769 |
var UpgradeChip = function UpgradeChip(_ref3) { |
| 4770 |
var _ref3$hasSubscription = _ref3.hasSubscription; |
| 4771 |
var hasSubscription = _ref3$hasSubscription === void 0 ? false : _ref3$hasSubscription; |
| 4772 |
var _ref3$usagePercentage = _ref3.usagePercentage; |
| 4773 |
var usagePercentage = _ref3$usagePercentage === void 0 ? 0 : _ref3$usagePercentage; |
| 4774 |
var _useState2 = _slicedToArray((0, react.useState)(false), 2); |
| 4775 |
var isPopoverOpen = _useState2[0]; |
| 4776 |
var setIsPopoverOpen = _useState2[1]; |
| 4777 |
var anchorEl = (0, react.useRef)(null); |
| 4778 |
var arrowEl = (0, react.useRef)(null); |
| 4779 |
var showPopover = function showPopover() { |
| 4780 |
return setIsPopoverOpen(true); |
| 4781 |
}; |
| 4782 |
var hidePopover = function hidePopover() { |
| 4783 |
return setIsPopoverOpen(false); |
| 4784 |
}; |
| 4785 |
var actionUrl = "https://go.elementor.com/ai-popup-purchase-dropdown/"; |
| 4786 |
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/"; |
| 4787 |
var actionLabel = hasSubscription ? (0, _wordpress_i18n.__)("Upgrade Elementor AI", "elementor") : (0, _wordpress_i18n.__)("Get Elementor AI", "elementor"); |
| 4788 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, { |
| 4789 |
component: "span", |
| 4790 |
"aria-owns": isPopoverOpen ? popoverId$1 : void 0, |
| 4791 |
"aria-haspopup": "true", |
| 4792 |
onMouseEnter: showPopover, |
| 4793 |
onMouseLeave: hidePopover, |
| 4794 |
ref: anchorEl, |
| 4795 |
display: "flex", |
| 4796 |
alignItems: "center" |
| 4797 |
}, /*#__PURE__*/ react.default.createElement(Chip$2, { |
| 4798 |
color: "promotion", |
| 4799 |
label: (0, _wordpress_i18n.__)("Upgrade", "elementor"), |
| 4800 |
icon: /*#__PURE__*/ react.default.createElement(_elementor_icons.AIIcon, null), |
| 4801 |
size: "small" |
| 4802 |
}), /*#__PURE__*/ react.default.createElement(_elementor_ui.Popper, { |
| 4803 |
open: isPopoverOpen, |
| 4804 |
anchorEl: anchorEl.current, |
| 4805 |
sx: { |
| 4806 |
zIndex: "170001", |
| 4807 |
maxWidth: 300 |
| 4808 |
}, |
| 4809 |
modifiers: [{ |
| 4810 |
name: "arrow", |
| 4811 |
enabled: true, |
| 4812 |
options: { element: arrowEl.current } |
| 4813 |
}] |
| 4814 |
}, /*#__PURE__*/ react.default.createElement(StyledContent$3, null, /*#__PURE__*/ react.default.createElement(StyledArrow$1, { ref: arrowEl }), /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, { |
| 4815 |
variant: "h5", |
| 4816 |
color: "text.primary" |
| 4817 |
}, (0, _wordpress_i18n.__)("Unlimited access to Elementor AI", "elementor")), /*#__PURE__*/ react.default.createElement(_elementor_ui.List, { sx: { mb: 1 } }, upgradeBullets.map(function(bullet, index) { |
| 4818 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.ListItem, { |
| 4819 |
key: index, |
| 4820 |
disableGutters: true, |
| 4821 |
sx: { alignItems: "flex-start" } |
| 4822 |
}, /*#__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))); |
| 4823 |
})), /*#__PURE__*/ react.default.createElement(_elementor_ui.Button, { |
| 4824 |
variant: "contained", |
| 4825 |
color: "promotion", |
| 4826 |
size: "small", |
| 4827 |
href: actionUrl, |
| 4828 |
target: "_blank", |
| 4829 |
startIcon: /*#__PURE__*/ react.default.createElement(_elementor_icons.AIIcon, null), |
| 4830 |
sx: { "&:hover": { color: "promotion.contrastText" } } |
| 4831 |
}, actionLabel)))); |
| 4832 |
}; |
| 4833 |
UpgradeChip.propTypes = { |
| 4834 |
hasSubscription: import_prop_types$8.default.bool, |
| 4835 |
usagePercentage: import_prop_types$8.default.number |
| 4836 |
}; |
| 4837 |
|
| 4838 |
//#endregion |
| 4839 |
//#region node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js |
| 4840 |
init_arrayLikeToArray(); |
| 4841 |
function _arrayWithoutHoles(r) { |
| 4842 |
if (Array.isArray(r)) return _arrayLikeToArray$2(r); |
| 4843 |
} |
| 4844 |
|
| 4845 |
//#endregion |
| 4846 |
//#region node_modules/@babel/runtime/helpers/esm/iterableToArray.js |
| 4847 |
function _iterableToArray(r) { |
| 4848 |
if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); |
| 4849 |
} |
| 4850 |
|
| 4851 |
//#endregion |
| 4852 |
//#region node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js |
| 4853 |
function _nonIterableSpread() { |
| 4854 |
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); |
| 4855 |
} |
| 4856 |
|
| 4857 |
//#endregion |
| 4858 |
//#region node_modules/@babel/runtime/helpers/esm/toConsumableArray.js |
| 4859 |
init_unsupportedIterableToArray(); |
| 4860 |
function _toConsumableArray(r) { |
| 4861 |
return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray$2(r) || _nonIterableSpread(); |
| 4862 |
} |
| 4863 |
|
| 4864 |
//#endregion |
| 4865 |
//#region modules/ai/assets/js/editor/pages/form-media/context/location-context.js |
| 4866 |
init_slicedToArray(); |
| 4867 |
init_defineProperty$1(); |
| 4868 |
function ownKeys$25(e, r) { |
| 4869 |
var t = Object.keys(e); |
| 4870 |
if (Object.getOwnPropertySymbols) { |
| 4871 |
var o = Object.getOwnPropertySymbols(e); |
| 4872 |
r && (o = o.filter(function(r) { |
| 4873 |
return Object.getOwnPropertyDescriptor(e, r).enumerable; |
| 4874 |
})), t.push.apply(t, o); |
| 4875 |
} |
| 4876 |
return t; |
| 4877 |
} |
| 4878 |
__name(ownKeys$25, "ownKeys"); |
| 4879 |
function _objectSpread$25(e) { |
| 4880 |
for (var r = 1; r < arguments.length; r++) { |
| 4881 |
var t = null != arguments[r] ? arguments[r] : {}; |
| 4882 |
r % 2 ? ownKeys$25(Object(t), !0).forEach(function(r) { |
| 4883 |
_defineProperty$1(e, r, t[r]); |
| 4884 |
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$25(Object(t)).forEach(function(r) { |
| 4885 |
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); |
| 4886 |
}); |
| 4887 |
} |
| 4888 |
return e; |
| 4889 |
} |
| 4890 |
__name(_objectSpread$25, "_objectSpread"); |
| 4891 |
var RoutesContext = (0, react.createContext)(null); |
| 4892 |
var NAVIGATE = "NAVIGATE"; |
| 4893 |
var BACK = "BACK"; |
| 4894 |
var initialValue$1 = { |
| 4895 |
current: "", |
| 4896 |
history: [] |
| 4897 |
}; |
| 4898 |
var reducer$2 = function reducer(state, _ref) { |
| 4899 |
var type = _ref.type; |
| 4900 |
var payload = _ref.payload; |
| 4901 |
switch (type) { |
| 4902 |
case NAVIGATE: return _objectSpread$25(_objectSpread$25({}, state), {}, { |
| 4903 |
current: payload, |
| 4904 |
history: [].concat(_toConsumableArray(state.history), [payload]) |
| 4905 |
}); |
| 4906 |
case BACK: return _objectSpread$25(_objectSpread$25({}, state), {}, { |
| 4907 |
current: state.history[state.history.length - 2], |
| 4908 |
history: state.history.slice(0, state.history.length - 1) |
| 4909 |
}); |
| 4910 |
default: return state; |
| 4911 |
} |
| 4912 |
}; |
| 4913 |
var LocationProvider = function LocationProvider(_ref2) { |
| 4914 |
var children = _ref2.children; |
| 4915 |
var _useReducer2 = _slicedToArray((0, react.useReducer)(reducer$2, initialValue$1), 2); |
| 4916 |
var state = _useReducer2[0]; |
| 4917 |
var dispatch = _useReducer2[1]; |
| 4918 |
return /*#__PURE__*/ react.default.createElement(RoutesContext.Provider, { value: { |
| 4919 |
state, |
| 4920 |
dispatch |
| 4921 |
} }, children); |
| 4922 |
}; |
| 4923 |
LocationProvider.propTypes = { children: import_prop_types$8.default.node }; |
| 4924 |
var useLocation = function useLocation() { |
| 4925 |
var current = (arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}).current; |
| 4926 |
var _useContext = (0, react.useContext)(RoutesContext); |
| 4927 |
var state = _useContext.state; |
| 4928 |
var dispatch = _useContext.dispatch; |
| 4929 |
var navigate = function navigate(location) { |
| 4930 |
dispatch({ |
| 4931 |
type: NAVIGATE, |
| 4932 |
payload: location |
| 4933 |
}); |
| 4934 |
}; |
| 4935 |
var back = function back() { |
| 4936 |
dispatch({ type: BACK }); |
| 4937 |
}; |
| 4938 |
(0, react.useEffect)(function() { |
| 4939 |
if (current) navigate(current); |
| 4940 |
}, []); |
| 4941 |
return { |
| 4942 |
current: state.current, |
| 4943 |
history: state.history, |
| 4944 |
navigate, |
| 4945 |
back |
| 4946 |
}; |
| 4947 |
}; |
| 4948 |
|
| 4949 |
//#endregion |
| 4950 |
//#region modules/ai/assets/js/editor/components/ui/panel.js |
| 4951 |
init_extends(); |
| 4952 |
init_defineProperty$1(); |
| 4953 |
init_objectWithoutProperties$1(); |
| 4954 |
var _excluded$30 = ["sx"]; |
| 4955 |
function ownKeys$24(e, r) { |
| 4956 |
var t = Object.keys(e); |
| 4957 |
if (Object.getOwnPropertySymbols) { |
| 4958 |
var o = Object.getOwnPropertySymbols(e); |
| 4959 |
r && (o = o.filter(function(r) { |
| 4960 |
return Object.getOwnPropertyDescriptor(e, r).enumerable; |
| 4961 |
})), t.push.apply(t, o); |
| 4962 |
} |
| 4963 |
return t; |
| 4964 |
} |
| 4965 |
__name(ownKeys$24, "ownKeys"); |
| 4966 |
function _objectSpread$24(e) { |
| 4967 |
for (var r = 1; r < arguments.length; r++) { |
| 4968 |
var t = null != arguments[r] ? arguments[r] : {}; |
| 4969 |
r % 2 ? ownKeys$24(Object(t), !0).forEach(function(r) { |
| 4970 |
_defineProperty$1(e, r, t[r]); |
| 4971 |
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$24(Object(t)).forEach(function(r) { |
| 4972 |
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); |
| 4973 |
}); |
| 4974 |
} |
| 4975 |
return e; |
| 4976 |
} |
| 4977 |
__name(_objectSpread$24, "_objectSpread"); |
| 4978 |
var Panel = function Panel(_ref) { |
| 4979 |
var _ref$sx = _ref.sx; |
| 4980 |
var sx = _ref$sx === void 0 ? {} : _ref$sx; |
| 4981 |
var props = _objectWithoutProperties$1(_ref, _excluded$30); |
| 4982 |
return /*#__PURE__*/ react.default.createElement(react.default.Fragment, null, /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, _extends$1({ sx: _objectSpread$24({ |
| 4983 |
p: 4, |
| 4984 |
width: 360, |
| 4985 |
flexShrink: 0, |
| 4986 |
height: "100%", |
| 4987 |
overflowY: "auto" |
| 4988 |
}, sx) }, props), props.children), /*#__PURE__*/ react.default.createElement(_elementor_ui.Divider, { orientation: "vertical" })); |
| 4989 |
}; |
| 4990 |
Panel.propTypes = { |
| 4991 |
children: import_prop_types$8.default.node, |
| 4992 |
sx: import_prop_types$8.default.object |
| 4993 |
}; |
| 4994 |
|
| 4995 |
//#endregion |
| 4996 |
//#region modules/ai/assets/js/editor/pages/form-media/components/generate-loader.js |
| 4997 |
var GenerateLoader = function GenerateLoader() { |
| 4998 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, { |
| 4999 |
alignItems: "center", |
| 5000 |
justifyContent: "center", |
| 5001 |
gap: 2, |
| 5002 |
width: "100%" |
| 5003 |
}, /*#__PURE__*/ react.default.createElement(_elementor_icons.AIIcon, { sx: { |
| 5004 |
color: "text.primary", |
| 5005 |
fontSize: "60px", |
| 5006 |
mb: 1 |
| 5007 |
} }), /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, { |
| 5008 |
variant: "h5", |
| 5009 |
sx: { color: "text.primary" } |
| 5010 |
}, (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: { |
| 5011 |
px: 1.5, |
| 5012 |
py: 2.5, |
| 5013 |
width: "100%", |
| 5014 |
maxWidth: 600 |
| 5015 |
} }, /*#__PURE__*/ react.default.createElement(_elementor_ui.LinearProgress, { color: "inherit" }))); |
| 5016 |
}; |
| 5017 |
|
| 5018 |
//#endregion |
| 5019 |
//#region modules/ai/assets/js/editor/icons/chevron-left-icon.js |
| 5020 |
init_extends(); |
| 5021 |
var ChevronLeftIcon = react.default.forwardRef(function(props, ref) { |
| 5022 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.SvgIcon, _extends$1({ viewBox: "0 0 24 24" }, props, { ref }), /*#__PURE__*/ react.default.createElement("path", { |
| 5023 |
fillRule: "evenodd", |
| 5024 |
clipRule: "evenodd", |
| 5025 |
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" |
| 5026 |
})); |
| 5027 |
}); |
| 5028 |
|
| 5029 |
//#endregion |
| 5030 |
//#region modules/ai/assets/js/editor/pages/form-media/components/back-button.js |
| 5031 |
init_extends(); |
| 5032 |
init_objectWithoutProperties$1(); |
| 5033 |
var _excluded$29 = ["children"]; |
| 5034 |
var StyledChevronLeftIcon$1 = (0, _elementor_ui.withDirection)(ChevronLeftIcon); |
| 5035 |
var BackButton$1 = function BackButton(_ref) { |
| 5036 |
var children = _ref.children; |
| 5037 |
var props = _objectWithoutProperties$1(_ref, _excluded$29); |
| 5038 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Button, _extends$1({ |
| 5039 |
size: "small", |
| 5040 |
variant: "text", |
| 5041 |
color: "secondary", |
| 5042 |
startIcon: /*#__PURE__*/ react.default.createElement(StyledChevronLeftIcon$1, null) |
| 5043 |
}, props), children || (0, _wordpress_i18n.__)("Back", "elementor")); |
| 5044 |
}; |
| 5045 |
BackButton$1.propTypes = { children: import_prop_types$8.default.node }; |
| 5046 |
|
| 5047 |
//#endregion |
| 5048 |
//#region modules/ai/assets/js/editor/pages/form-media/context/global-settings-context.js |
| 5049 |
var GlobalSettingsContext = (0, react.createContext)({}); |
| 5050 |
var GlobalSettingsProvider = function GlobalSettingsProvider(_ref) { |
| 5051 |
var settings = _ref.settings; |
| 5052 |
var children = _ref.children; |
| 5053 |
return /*#__PURE__*/ react.default.createElement(GlobalSettingsContext.Provider, { value: settings }, children); |
| 5054 |
}; |
| 5055 |
GlobalSettingsProvider.propTypes = { |
| 5056 |
settings: import_prop_types$8.default.object, |
| 5057 |
children: import_prop_types$8.default.node |
| 5058 |
}; |
| 5059 |
var useGlobalSettings = function useGlobalSettings() { |
| 5060 |
return (0, react.useContext)(GlobalSettingsContext); |
| 5061 |
}; |
| 5062 |
|
| 5063 |
//#endregion |
| 5064 |
//#region modules/ai/assets/js/editor/components/upgrade-banner.js |
| 5065 |
init_extends(); |
| 5066 |
init_objectWithoutProperties$1(); |
| 5067 |
var _excluded$28 = ["onClose"]; |
| 5068 |
var UpgradeBanner = function UpgradeBanner(_ref) { |
| 5069 |
var onClose = _ref.onClose; |
| 5070 |
var props = _objectWithoutProperties$1(_ref, _excluded$28); |
| 5071 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Alert, _extends$1({ |
| 5072 |
icon: false, |
| 5073 |
action: /*#__PURE__*/ react.default.createElement(_elementor_ui.AlertAction, { onClick: function onClick() { |
| 5074 |
return window.open("https://go.elementor.com/ai-banner-free-upgrade/", "_blank"); |
| 5075 |
} }, (0, _wordpress_i18n.__)("Upgrade", "elementor")), |
| 5076 |
variant: "filled", |
| 5077 |
color: "promotion", |
| 5078 |
onClose |
| 5079 |
}, props), (0, _wordpress_i18n.__)("You’re using a limited license. Get maximum access to Elementor AI.", "elementor")); |
| 5080 |
}; |
| 5081 |
UpgradeBanner.propTypes = { |
| 5082 |
onClose: import_prop_types$8.default.func, |
| 5083 |
sx: import_prop_types$8.default.object |
| 5084 |
}; |
| 5085 |
|
| 5086 |
//#endregion |
| 5087 |
//#region modules/ai/assets/js/editor/helpers/features-enum.js |
| 5088 |
var FREE_TRIAL_FEATURES_NAMES = { |
| 5089 |
TEXT: (0, _wordpress_i18n.__)("Text", "elementor"), |
| 5090 |
IMAGES: (0, _wordpress_i18n.__)("Images", "elementor"), |
| 5091 |
CODE: (0, _wordpress_i18n.__)("Code", "elementor"), |
| 5092 |
CONTAINERS: (0, _wordpress_i18n.__)("Containers", "elementor"), |
| 5093 |
ANIMATION: (0, _wordpress_i18n.__)("Animation", "elementor") |
| 5094 |
}; |
| 5095 |
|
| 5096 |
//#endregion |
| 5097 |
//#region modules/ai/assets/js/editor/components/usage-limit-alert.js |
| 5098 |
init_objectWithoutProperties$1(); |
| 5099 |
init_extends(); |
| 5100 |
init_defineProperty$1(); |
| 5101 |
var _excluded$27 = [ |
| 5102 |
"onClose", |
| 5103 |
"usagePercentage", |
| 5104 |
"hasSubscription", |
| 5105 |
"feature" |
| 5106 |
]; |
| 5107 |
var KEY_SUBSCRIPTION = "subscription"; |
| 5108 |
var KEY_NO_SUBSCRIPTION = "noSubscription"; |
| 5109 |
var getUsageTitle = function getUsageTitle(percentage) { |
| 5110 |
return (0, _wordpress_i18n.sprintf)((0, _wordpress_i18n.__)("You’ve used %s of credits for this AI feature.", "elementor"), percentage); |
| 5111 |
}; |
| 5112 |
var CREDITS_95_USAGE_TITLE = getUsageTitle("95%"); |
| 5113 |
var CREDITS_80_USAGE_TITLE = getUsageTitle("80%"); |
| 5114 |
var CREDITS_75_USAGE_TITLE = getUsageTitle("75%"); |
| 5115 |
var DESCRIPTION_SUBSCRIPTION = (0, _wordpress_i18n.__)("Get maximum access.", "elementor"); |
| 5116 |
var FEATURES = Object.keys(FREE_TRIAL_FEATURES_NAMES); |
| 5117 |
var getDescriptionNoSubscription = function getDescriptionNoSubscription(excludedFeature) { |
| 5118 |
var featuresList = FEATURES.filter(function(feature) { |
| 5119 |
return feature !== excludedFeature; |
| 5120 |
}).map(function(feature) { |
| 5121 |
return FREE_TRIAL_FEATURES_NAMES[feature]; |
| 5122 |
}).join(", "); |
| 5123 |
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); |
| 5124 |
}; |
| 5125 |
var alertConfigs = [ |
| 5126 |
{ |
| 5127 |
threshold: 95, |
| 5128 |
title: _defineProperty$1(_defineProperty$1({}, KEY_SUBSCRIPTION, CREDITS_95_USAGE_TITLE), KEY_NO_SUBSCRIPTION, CREDITS_95_USAGE_TITLE), |
| 5129 |
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/"), |
| 5130 |
color: "error" |
| 5131 |
}, |
| 5132 |
{ |
| 5133 |
threshold: 80, |
| 5134 |
title: _defineProperty$1(_defineProperty$1({}, KEY_SUBSCRIPTION, CREDITS_80_USAGE_TITLE), KEY_NO_SUBSCRIPTION, CREDITS_80_USAGE_TITLE), |
| 5135 |
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/"), |
| 5136 |
color: "warning" |
| 5137 |
}, |
| 5138 |
{ |
| 5139 |
threshold: 75, |
| 5140 |
title: _defineProperty$1(_defineProperty$1({}, KEY_SUBSCRIPTION, CREDITS_75_USAGE_TITLE), KEY_NO_SUBSCRIPTION, CREDITS_75_USAGE_TITLE), |
| 5141 |
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/"), |
| 5142 |
color: "warning" |
| 5143 |
} |
| 5144 |
]; |
| 5145 |
var UpgradeButton = function UpgradeButton(props) { |
| 5146 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Button, _extends$1({ |
| 5147 |
color: "inherit", |
| 5148 |
variant: "outlined", |
| 5149 |
sx: { border: "2px solid" } |
| 5150 |
}, props), (0, _wordpress_i18n.__)("Upgrade now", "elementor")); |
| 5151 |
}; |
| 5152 |
var UsageLimitAlert = function UsageLimitAlert(_ref) { |
| 5153 |
_ref.onClose; |
| 5154 |
var usagePercentage = _ref.usagePercentage; |
| 5155 |
var hasSubscription = _ref.hasSubscription; |
| 5156 |
var feature = _ref.feature; |
| 5157 |
var props = _objectWithoutProperties$1(_ref, _excluded$27); |
| 5158 |
var config = alertConfigs.find(function(_ref2) { |
| 5159 |
return usagePercentage >= _ref2.threshold; |
| 5160 |
}); |
| 5161 |
if (!config) return null; |
| 5162 |
var subscriptionType = hasSubscription ? KEY_SUBSCRIPTION : KEY_NO_SUBSCRIPTION; |
| 5163 |
var description = _defineProperty$1(_defineProperty$1({}, KEY_SUBSCRIPTION, DESCRIPTION_SUBSCRIPTION), KEY_NO_SUBSCRIPTION, getDescriptionNoSubscription(feature)); |
| 5164 |
var title = config.title; |
| 5165 |
var url = config.url; |
| 5166 |
var color = config.color; |
| 5167 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Alert, _extends$1({ |
| 5168 |
severity: "warning", |
| 5169 |
action: /*#__PURE__*/ react.default.createElement(UpgradeButton, { onClick: function handleUpgradeClick() { |
| 5170 |
return window.open(url[subscriptionType], "_blank"); |
| 5171 |
} }), |
| 5172 |
color |
| 5173 |
}, props), /*#__PURE__*/ react.default.createElement(_elementor_ui.AlertTitle, null, title[subscriptionType]), description[subscriptionType]); |
| 5174 |
}; |
| 5175 |
UsageLimitAlert.propTypes = { |
| 5176 |
onClose: import_prop_types$8.default.func, |
| 5177 |
usagePercentage: import_prop_types$8.default.number, |
| 5178 |
hasSubscription: import_prop_types$8.default.bool, |
| 5179 |
feature: import_prop_types$8.default.string |
| 5180 |
}; |
| 5181 |
|
| 5182 |
//#endregion |
| 5183 |
//#region modules/ai/assets/js/editor/hooks/use-upgrade-message.js |
| 5184 |
init_use_introduction(); |
| 5185 |
var USAGE_PERCENTAGE_THRESHOLD = 75; |
| 5186 |
var useUpgradeMessage = function useUpgradeMessage(_ref) { |
| 5187 |
var usagePercentage = _ref.usagePercentage; |
| 5188 |
var hasSubscription = _ref.hasSubscription; |
| 5189 |
var _useIntroduction = useIntroduction("e-ai-upgrade-message"); |
| 5190 |
var isBannerViewed = _useIntroduction.isViewed; |
| 5191 |
var markBannerAsViewed = _useIntroduction.markAsViewed; |
| 5192 |
var isFreeUser = !hasSubscription; |
| 5193 |
return { |
| 5194 |
showBadge: usagePercentage >= 75 || isFreeUser, |
| 5195 |
showBanner: !isBannerViewed && isFreeUser && usagePercentage < 75, |
| 5196 |
markBannerAsViewed |
| 5197 |
}; |
| 5198 |
}; |
| 5199 |
|
| 5200 |
//#endregion |
| 5201 |
//#region modules/ai/assets/js/editor/components/usage-messages.js |
| 5202 |
var UsageMessages = function UsageMessages(_ref) { |
| 5203 |
var hasSubscription = _ref.hasSubscription; |
| 5204 |
var usagePercentage = _ref.usagePercentage; |
| 5205 |
var sx = _ref.sx; |
| 5206 |
var feature = _ref.feature; |
| 5207 |
var _useUpgradeMessage = useUpgradeMessage({ |
| 5208 |
usagePercentage, |
| 5209 |
hasSubscription |
| 5210 |
}); |
| 5211 |
var showBanner = _useUpgradeMessage.showBanner; |
| 5212 |
var markBannerAsViewed = _useUpgradeMessage.markBannerAsViewed; |
| 5213 |
return /*#__PURE__*/ react.default.createElement(react.default.Fragment, null, showBanner && /*#__PURE__*/ react.default.createElement(UpgradeBanner, { |
| 5214 |
onClose: markBannerAsViewed, |
| 5215 |
sx |
| 5216 |
}), /*#__PURE__*/ react.default.createElement(UsageLimitAlert, { |
| 5217 |
hasSubscription, |
| 5218 |
usagePercentage, |
| 5219 |
sx, |
| 5220 |
feature |
| 5221 |
})); |
| 5222 |
}; |
| 5223 |
UsageMessages.propTypes = { |
| 5224 |
hasSubscription: import_prop_types$8.default.bool, |
| 5225 |
usagePercentage: import_prop_types$8.default.number, |
| 5226 |
sx: import_prop_types$8.default.object, |
| 5227 |
feature: import_prop_types$8.default.string |
| 5228 |
}; |
| 5229 |
|
| 5230 |
//#endregion |
| 5231 |
//#region modules/ai/assets/js/editor/pages/form-media/components/view.js |
| 5232 |
init_extends(); |
| 5233 |
init_defineProperty$1(); |
| 5234 |
init_objectWithoutProperties$1(); |
| 5235 |
init_loader(); |
| 5236 |
init_prompt_error_message(); |
| 5237 |
var _excluded$26 = ["sx"]; |
| 5238 |
var _excluded2$5 = ["primary", "secondary"]; |
| 5239 |
var _excluded3$2 = ["primary", "secondary"]; |
| 5240 |
var _excluded4$1 = ["children"]; |
| 5241 |
var _excluded5$1 = [ |
| 5242 |
"isLoading", |
| 5243 |
"isGenerating", |
| 5244 |
"children" |
| 5245 |
]; |
| 5246 |
var _excluded6 = ["sx"]; |
| 5247 |
function ownKeys$23(e, r) { |
| 5248 |
var t = Object.keys(e); |
| 5249 |
if (Object.getOwnPropertySymbols) { |
| 5250 |
var o = Object.getOwnPropertySymbols(e); |
| 5251 |
r && (o = o.filter(function(r) { |
| 5252 |
return Object.getOwnPropertyDescriptor(e, r).enumerable; |
| 5253 |
})), t.push.apply(t, o); |
| 5254 |
} |
| 5255 |
return t; |
| 5256 |
} |
| 5257 |
__name(ownKeys$23, "ownKeys"); |
| 5258 |
function _objectSpread$23(e) { |
| 5259 |
for (var r = 1; r < arguments.length; r++) { |
| 5260 |
var t = null != arguments[r] ? arguments[r] : {}; |
| 5261 |
r % 2 ? ownKeys$23(Object(t), !0).forEach(function(r) { |
| 5262 |
_defineProperty$1(e, r, t[r]); |
| 5263 |
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$23(Object(t)).forEach(function(r) { |
| 5264 |
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); |
| 5265 |
}); |
| 5266 |
} |
| 5267 |
return e; |
| 5268 |
} |
| 5269 |
__name(_objectSpread$23, "_objectSpread"); |
| 5270 |
var ViewBackButton = function ViewBackButton(_ref) { |
| 5271 |
var _ref$sx = _ref.sx; |
| 5272 |
var sx = _ref$sx === void 0 ? {} : _ref$sx; |
| 5273 |
var props = _objectWithoutProperties$1(_ref, _excluded$26); |
| 5274 |
var back = useLocation().back; |
| 5275 |
if (useGlobalSettings().hideBackButton) return null; |
| 5276 |
return /*#__PURE__*/ react.default.createElement(BackButton$1, _extends$1({ onClick: function onClick(e) { |
| 5277 |
e.preventDefault(); |
| 5278 |
back(); |
| 5279 |
} }, props, { sx: _objectSpread$23({ |
| 5280 |
mb: 1, |
| 5281 |
alignSelf: "flex-start" |
| 5282 |
}, sx) })); |
| 5283 |
}; |
| 5284 |
ViewBackButton.propTypes = { sx: import_prop_types$8.default.object }; |
| 5285 |
var PanelHeading = function PanelHeading(_ref2) { |
| 5286 |
var primary = _ref2.primary; |
| 5287 |
var secondary = _ref2.secondary; |
| 5288 |
var props = _objectWithoutProperties$1(_ref2, _excluded2$5); |
| 5289 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, _extends$1({ |
| 5290 |
spacing: 1, |
| 5291 |
sx: { mb: 3 } |
| 5292 |
}, props), /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, { variant: "h4" }, primary), secondary && /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, { |
| 5293 |
variant: "body1", |
| 5294 |
color: "secondary" |
| 5295 |
}, secondary)); |
| 5296 |
}; |
| 5297 |
PanelHeading.propTypes = { |
| 5298 |
primary: import_prop_types$8.default.string.isRequired, |
| 5299 |
secondary: import_prop_types$8.default.string |
| 5300 |
}; |
| 5301 |
var ContentHeading = function ContentHeading(_ref3) { |
| 5302 |
var primary = _ref3.primary; |
| 5303 |
var secondary = _ref3.secondary; |
| 5304 |
var props = _objectWithoutProperties$1(_ref3, _excluded3$2); |
| 5305 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, _extends$1({ |
| 5306 |
gap: 1.5, |
| 5307 |
sx: { mb: 3 } |
| 5308 |
}, props), /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, { variant: "h6" }, primary), secondary && /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, { |
| 5309 |
variant: "subtitle1", |
| 5310 |
color: "secondary" |
| 5311 |
}, secondary)); |
| 5312 |
}; |
| 5313 |
ContentHeading.propTypes = { |
| 5314 |
primary: import_prop_types$8.default.string.isRequired, |
| 5315 |
secondary: import_prop_types$8.default.string |
| 5316 |
}; |
| 5317 |
var View = function View(_ref4) { |
| 5318 |
var children = _ref4.children; |
| 5319 |
var props = _objectWithoutProperties$1(_ref4, _excluded4$1); |
| 5320 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, _extends$1({ |
| 5321 |
className: "e-ai-dialog-content", |
| 5322 |
display: "flex", |
| 5323 |
sx: { |
| 5324 |
overflowY: "auto", |
| 5325 |
position: "relative" |
| 5326 |
}, |
| 5327 |
height: "100%" |
| 5328 |
}, props), children); |
| 5329 |
}; |
| 5330 |
var Content = function Content(_ref5) { |
| 5331 |
var _ref5$isLoading = _ref5.isLoading; |
| 5332 |
var isLoading = _ref5$isLoading === void 0 ? false : _ref5$isLoading; |
| 5333 |
var _ref5$isGenerating = _ref5.isGenerating; |
| 5334 |
var isGenerating = _ref5$isGenerating === void 0 ? false : _ref5$isGenerating; |
| 5335 |
var children = _ref5.children; |
| 5336 |
var props = _objectWithoutProperties$1(_ref5, _excluded5$1); |
| 5337 |
if (isGenerating) return /*#__PURE__*/ react.default.createElement(GenerateLoader, null); |
| 5338 |
if (isLoading) return /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, { sx: { |
| 5339 |
width: "100%", |
| 5340 |
maxWidth: 600, |
| 5341 |
margin: "0 auto", |
| 5342 |
alignSelf: "center" |
| 5343 |
} }, /*#__PURE__*/ react.default.createElement(Loader, { color: "inherit" })); |
| 5344 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, _extends$1({ |
| 5345 |
sx: { |
| 5346 |
overflowY: "auto", |
| 5347 |
p: 4 |
| 5348 |
}, |
| 5349 |
flexGrow: 1 |
| 5350 |
}, props), children); |
| 5351 |
}; |
| 5352 |
Content.propTypes = { |
| 5353 |
children: import_prop_types$8.default.node, |
| 5354 |
isLoading: import_prop_types$8.default.bool, |
| 5355 |
isGenerating: import_prop_types$8.default.bool |
| 5356 |
}; |
| 5357 |
var ErrorMessage = function ErrorMessage(_ref6) { |
| 5358 |
var _ref6$sx = _ref6.sx; |
| 5359 |
var sx = _ref6$sx === void 0 ? {} : _ref6$sx; |
| 5360 |
var props = _objectWithoutProperties$1(_ref6, _excluded6); |
| 5361 |
return /*#__PURE__*/ react.default.createElement(PromptErrorMessage, _extends$1({ actionPosition: "bottom" }, props, { sx: _objectSpread$23({ mb: 2.5 }, sx) })); |
| 5362 |
}; |
| 5363 |
ErrorMessage.propTypes = { sx: import_prop_types$8.default.object }; |
| 5364 |
var ViewPanel = function ViewPanel(props) { |
| 5365 |
var _useGlobalSettings2 = useGlobalSettings(); |
| 5366 |
var hasSubscription = _useGlobalSettings2.hasSubscription; |
| 5367 |
var usagePercentage = _useGlobalSettings2.usagePercentage; |
| 5368 |
return /*#__PURE__*/ react.default.createElement(Panel, null, /*#__PURE__*/ react.default.createElement(UsageMessages, { |
| 5369 |
hasSubscription, |
| 5370 |
usagePercentage, |
| 5371 |
sx: { mb: 4 }, |
| 5372 |
feature: FREE_TRIAL_FEATURES_NAMES.IMAGES |
| 5373 |
}), props.children); |
| 5374 |
}; |
| 5375 |
ViewPanel.propTypes = { children: import_prop_types$8.default.node }; |
| 5376 |
View.Panel = ViewPanel; |
| 5377 |
View.Content = Content; |
| 5378 |
View.BackButton = ViewBackButton; |
| 5379 |
View.ErrorMessage = ErrorMessage; |
| 5380 |
View.PanelHeading = PanelHeading; |
| 5381 |
View.ContentHeading = ContentHeading; |
| 5382 |
View.propTypes = { children: import_prop_types$8.default.node }; |
| 5383 |
|
| 5384 |
//#endregion |
| 5385 |
//#region modules/ai/assets/js/editor/pages/form-media/constants/index.js |
| 5386 |
var LOCATIONS = { |
| 5387 |
RESIZE: "resize", |
| 5388 |
GENERATE: "generate", |
| 5389 |
VARIATIONS: "variations", |
| 5390 |
IMAGE_TOOLS: "image-tools", |
| 5391 |
IN_PAINTING: "in-painting", |
| 5392 |
OUT_PAINTING: "out-painting", |
| 5393 |
REMOVE_BACKGROUND: "remove-background", |
| 5394 |
REPLACE_BACKGROUND: "replace-background", |
| 5395 |
REMOVE_TEXT: "remove-text", |
| 5396 |
CLEANUP: "cleanup", |
| 5397 |
PRODUCT_IMAGE_UNIFICATION: "product-image-unification", |
| 5398 |
ISOLATE_OBJECT: "isolate-objects" |
| 5399 |
}; |
| 5400 |
var IMAGE_PROMPT_SETTINGS = { |
| 5401 |
IMAGE_TYPE: "image_type", |
| 5402 |
IMAGE_STYLE: "style_preset", |
| 5403 |
IMAGE_STRENGTH: "image_strength", |
| 5404 |
IMAGE_RATIO: "ratio", |
| 5405 |
IMAGE_ZOOM: "zoom", |
| 5406 |
IMAGE_UPSCALE: "upscale_to", |
| 5407 |
IMAGE_BACKGROUND_COLOR: "background_color" |
| 5408 |
}; |
| 5409 |
var FEATURE_IDENTIFIER = { ISOLATE_OBJECT: "isolate-object" }; |
| 5410 |
var IMAGE_PROMPT_CATEGORIES = { |
| 5411 |
"": { |
| 5412 |
label: (0, _wordpress_i18n.__)("None", "elementor"), |
| 5413 |
subCategories: {} |
| 5414 |
}, |
| 5415 |
photographic: { |
| 5416 |
label: (0, _wordpress_i18n.__)("Photographic", "elementor"), |
| 5417 |
subCategories: { |
| 5418 |
"": (0, _wordpress_i18n.__)("None", "elementor"), |
| 5419 |
landscape: (0, _wordpress_i18n.__)("Landscape", "elementor"), |
| 5420 |
macro: (0, _wordpress_i18n.__)("Macro", "elementor"), |
| 5421 |
portrait: (0, _wordpress_i18n.__)("Portrait", "elementor"), |
| 5422 |
"long-exposure": (0, _wordpress_i18n.__)("Long Exposure", "elementor"), |
| 5423 |
product: (0, _wordpress_i18n.__)("Product", "elementor"), |
| 5424 |
photorealistic: (0, _wordpress_i18n.__)("Photorealistic", "elementor") |
| 5425 |
} |
| 5426 |
}, |
| 5427 |
vector: { |
| 5428 |
label: (0, _wordpress_i18n.__)("Vector / Logo", "elementor"), |
| 5429 |
subCategories: { |
| 5430 |
"": (0, _wordpress_i18n.__)("None", "elementor"), |
| 5431 |
"typographic-logo": (0, _wordpress_i18n.__)("Typographic Logo", "elementor"), |
| 5432 |
"shape-logo": (0, _wordpress_i18n.__)("Shape Logo", "elementor"), |
| 5433 |
"handwritten-logo": (0, _wordpress_i18n.__)("Handwritten Logo", "elementor"), |
| 5434 |
"line-art-logo": (0, _wordpress_i18n.__)("Line Art Logo", "elementor"), |
| 5435 |
"old-school-logo": (0, _wordpress_i18n.__)("Old School Logo", "elementor") |
| 5436 |
} |
| 5437 |
}, |
| 5438 |
background: { |
| 5439 |
label: (0, _wordpress_i18n.__)("Background", "elementor"), |
| 5440 |
subCategories: { |
| 5441 |
"": (0, _wordpress_i18n.__)("None", "elementor"), |
| 5442 |
floral: (0, _wordpress_i18n.__)("Floral", "elementor"), |
| 5443 |
gradient: (0, _wordpress_i18n.__)("Gradient", "elementor"), |
| 5444 |
mosaic: (0, _wordpress_i18n.__)("Mosaic", "elementor"), |
| 5445 |
neon: (0, _wordpress_i18n.__)("Neon", "elementor"), |
| 5446 |
bokeh: (0, _wordpress_i18n.__)("Bokeh", "elementor") |
| 5447 |
} |
| 5448 |
}, |
| 5449 |
handmade: { |
| 5450 |
label: (0, _wordpress_i18n.__)("Handmade", "elementor"), |
| 5451 |
subCategories: { |
| 5452 |
"": (0, _wordpress_i18n.__)("None", "elementor"), |
| 5453 |
doodle: (0, _wordpress_i18n.__)("Doodle", "elementor"), |
| 5454 |
"line-art": (0, _wordpress_i18n.__)("Line Art", "elementor"), |
| 5455 |
"oil-painting": (0, _wordpress_i18n.__)("Oil Painting", "elementor"), |
| 5456 |
"pencil-drawing": (0, _wordpress_i18n.__)("Pencil Drawing", "elementor"), |
| 5457 |
watercolor: (0, _wordpress_i18n.__)("Watercolor", "elementor") |
| 5458 |
} |
| 5459 |
}, |
| 5460 |
"digital-art": { |
| 5461 |
label: (0, _wordpress_i18n.__)("Digital Art", "elementor"), |
| 5462 |
subCategories: { |
| 5463 |
"": (0, _wordpress_i18n.__)("None", "elementor"), |
| 5464 |
amine: (0, _wordpress_i18n.__)("Anime", "elementor"), |
| 5465 |
cartoon: (0, _wordpress_i18n.__)("Cartoon", "elementor"), |
| 5466 |
cinematic: (0, _wordpress_i18n.__)("Cinematic", "elementor"), |
| 5467 |
"comic-book": (0, _wordpress_i18n.__)("Comic Book", "elementor"), |
| 5468 |
"fantasy-art": (0, _wordpress_i18n.__)("Fantasy Art", "elementor"), |
| 5469 |
isometric: (0, _wordpress_i18n.__)("Isometric", "elementor"), |
| 5470 |
vector: (0, _wordpress_i18n.__)("Vector", "elementor"), |
| 5471 |
"pixel-art": (0, _wordpress_i18n.__)("Pixel Art", "elementor"), |
| 5472 |
"low-poly": (0, _wordpress_i18n.__)("Low Poly", "elementor"), |
| 5473 |
"neon-punk": (0, _wordpress_i18n.__)("Neon Punk", "elementor") |
| 5474 |
} |
| 5475 |
}, |
| 5476 |
"3d": { |
| 5477 |
label: (0, _wordpress_i18n.__)("3D", "elementor"), |
| 5478 |
subCategories: { |
| 5479 |
"": (0, _wordpress_i18n.__)("None", "elementor"), |
| 5480 |
clay: (0, _wordpress_i18n.__)("Clay", "elementor"), |
| 5481 |
digital: (0, _wordpress_i18n.__)("Digital", "elementor"), |
| 5482 |
origami: (0, _wordpress_i18n.__)("Origami", "elementor"), |
| 5483 |
stone: (0, _wordpress_i18n.__)("Stone", "elementor"), |
| 5484 |
wood: (0, _wordpress_i18n.__)("Wood", "elementor") |
| 5485 |
} |
| 5486 |
} |
| 5487 |
}; |
| 5488 |
var IMAGE_ASPECT_RATIO = { |
| 5489 |
"1:1": { |
| 5490 |
width: 512, |
| 5491 |
height: 512, |
| 5492 |
label: (0, _wordpress_i18n.__)("Square", "elementor") + " (1:1)" |
| 5493 |
}, |
| 5494 |
"3:2": { |
| 5495 |
width: 640, |
| 5496 |
height: 448, |
| 5497 |
label: (0, _wordpress_i18n.__)("Landscape", "elementor") + " (3:2)" |
| 5498 |
}, |
| 5499 |
"4:3": { |
| 5500 |
width: 640, |
| 5501 |
height: 448, |
| 5502 |
label: (0, _wordpress_i18n.__)("Landscape", "elementor") + " (4:3)" |
| 5503 |
}, |
| 5504 |
"16:9": { |
| 5505 |
width: 704, |
| 5506 |
height: 384, |
| 5507 |
label: (0, _wordpress_i18n.__)("Landscape", "elementor") + " (16:9)" |
| 5508 |
}, |
| 5509 |
"2:3": { |
| 5510 |
width: 448, |
| 5511 |
height: 640, |
| 5512 |
label: (0, _wordpress_i18n.__)("Portrait", "elementor") + " (2:3)" |
| 5513 |
}, |
| 5514 |
"3:4": { |
| 5515 |
width: 448, |
| 5516 |
height: 640, |
| 5517 |
label: (0, _wordpress_i18n.__)("Portrait", "elementor") + " (3:4)" |
| 5518 |
}, |
| 5519 |
"9:16": { |
| 5520 |
width: 384, |
| 5521 |
height: 704, |
| 5522 |
label: (0, _wordpress_i18n.__)("Portrait", "elementor") + " (9:16)" |
| 5523 |
} |
| 5524 |
}; |
| 5525 |
var IMAGE_PLACEHOLDERS_HOSTS = { WIREFRAME: "gene-\\d+\\.live\\.strattic\\.io" }; |
| 5526 |
var AI_EVENTS = { |
| 5527 |
MODAL_CLOSED: "elementor:ai:modal-closed", |
| 5528 |
SHOW_MODAL: "elementor:ai:show-modal" |
| 5529 |
}; |
| 5530 |
|
| 5531 |
//#endregion |
| 5532 |
//#region modules/ai/assets/js/editor/components/ui/overlay.js |
| 5533 |
var Overlay = (0, _elementor_ui.styled)(_elementor_ui.Box)(function(_ref) { |
| 5534 |
var theme = _ref.theme; |
| 5535 |
return { |
| 5536 |
width: "100%", |
| 5537 |
height: "100%", |
| 5538 |
position: "absolute", |
| 5539 |
backgroundColor: "rgba(0,0,0,0.5)", |
| 5540 |
transition: "opacity ".concat(theme.transitions.duration.short, "ms ").concat(theme.transitions.easing.easeInOut), |
| 5541 |
opacity: 0, |
| 5542 |
"&:hover": { opacity: 1 } |
| 5543 |
}; |
| 5544 |
}); |
| 5545 |
|
| 5546 |
//#endregion |
| 5547 |
//#region modules/ai/assets/js/editor/components/ui/overlay-bar.js |
| 5548 |
var OverlayBar = (0, _elementor_ui.styled)(_elementor_ui.Stack)(function(_ref) { |
| 5549 |
var theme = _ref.theme; |
| 5550 |
var position = _ref.position; |
| 5551 |
var style = { |
| 5552 |
width: "100%", |
| 5553 |
position: "absolute", |
| 5554 |
left: 0, |
| 5555 |
padding: theme.spacing(2.5) |
| 5556 |
}; |
| 5557 |
if ("top" === position) style.top = 0; |
| 5558 |
else if ("bottom" === position) style.bottom = 0; |
| 5559 |
return style; |
| 5560 |
}); |
| 5561 |
|
| 5562 |
//#endregion |
| 5563 |
//#region modules/ai/assets/js/editor/components/ui/overlay-bar-text.js |
| 5564 |
init_extends(); |
| 5565 |
init_objectWithoutProperties$1(); |
| 5566 |
var _excluded$25 = ["children"]; |
| 5567 |
var OverlayBarText = function OverlayBarText(_ref) { |
| 5568 |
var children = _ref.children; |
| 5569 |
var props = _objectWithoutProperties$1(_ref, _excluded$25); |
| 5570 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, _extends$1({ |
| 5571 |
variant: "caption", |
| 5572 |
color: "common.white" |
| 5573 |
}, props), children); |
| 5574 |
}; |
| 5575 |
OverlayBarText.propTypes = { children: import_prop_types$8.default.node }; |
| 5576 |
|
| 5577 |
//#endregion |
| 5578 |
//#region modules/ai/assets/js/editor/pages/form-media/components/gallery.js |
| 5579 |
init_defineProperty$1(); |
| 5580 |
init_slicedToArray(); |
| 5581 |
init_extends(); |
| 5582 |
init_objectWithoutProperties$1(); |
| 5583 |
var _excluded$24 = ["children"]; |
| 5584 |
var _excluded2$4 = [ |
| 5585 |
"alt", |
| 5586 |
"src", |
| 5587 |
"text", |
| 5588 |
"children", |
| 5589 |
"aspectRatio", |
| 5590 |
"variant", |
| 5591 |
"OverlayBarProps", |
| 5592 |
"numImagesInRow", |
| 5593 |
"overlay", |
| 5594 |
"onSelectChange", |
| 5595 |
"checkboxColor", |
| 5596 |
"isLoading", |
| 5597 |
"initialChecked" |
| 5598 |
]; |
| 5599 |
function ownKeys$22(e, r) { |
| 5600 |
var t = Object.keys(e); |
| 5601 |
if (Object.getOwnPropertySymbols) { |
| 5602 |
var o = Object.getOwnPropertySymbols(e); |
| 5603 |
r && (o = o.filter(function(r) { |
| 5604 |
return Object.getOwnPropertyDescriptor(e, r).enumerable; |
| 5605 |
})), t.push.apply(t, o); |
| 5606 |
} |
| 5607 |
return t; |
| 5608 |
} |
| 5609 |
__name(ownKeys$22, "ownKeys"); |
| 5610 |
function _objectSpread$22(e) { |
| 5611 |
for (var r = 1; r < arguments.length; r++) { |
| 5612 |
var t = null != arguments[r] ? arguments[r] : {}; |
| 5613 |
r % 2 ? ownKeys$22(Object(t), !0).forEach(function(r) { |
| 5614 |
_defineProperty$1(e, r, t[r]); |
| 5615 |
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$22(Object(t)).forEach(function(r) { |
| 5616 |
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); |
| 5617 |
}); |
| 5618 |
} |
| 5619 |
return e; |
| 5620 |
} |
| 5621 |
__name(_objectSpread$22, "_objectSpread"); |
| 5622 |
var aspectRatios = Object.keys(IMAGE_ASPECT_RATIO); |
| 5623 |
var Gallery = function Gallery(_ref) { |
| 5624 |
var children = _ref.children; |
| 5625 |
var props = _objectWithoutProperties$1(_ref, _excluded$24); |
| 5626 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.ImageList, _extends$1({ |
| 5627 |
width: "100%", |
| 5628 |
cols: 2, |
| 5629 |
gap: 24 |
| 5630 |
}, props), children); |
| 5631 |
}; |
| 5632 |
Gallery.propTypes = { children: import_prop_types$8.default.node }; |
| 5633 |
var GalleryImage = function GalleryImage(_ref2) { |
| 5634 |
var _elementorCommon$conf; |
| 5635 |
var _elementorCommon; |
| 5636 |
var alt = _ref2.alt; |
| 5637 |
var src = _ref2.src; |
| 5638 |
var text = _ref2.text; |
| 5639 |
var children = _ref2.children; |
| 5640 |
var _ref2$aspectRatio = _ref2.aspectRatio; |
| 5641 |
var aspectRatio = _ref2$aspectRatio === void 0 ? "1:1" : _ref2$aspectRatio; |
| 5642 |
var _ref2$variant = _ref2.variant; |
| 5643 |
var variant = _ref2$variant === void 0 ? "contained" : _ref2$variant; |
| 5644 |
var _ref2$OverlayBarProps = _ref2.OverlayBarProps; |
| 5645 |
var OverlayBarProps = _ref2$OverlayBarProps === void 0 ? {} : _ref2$OverlayBarProps; |
| 5646 |
var _ref2$numImagesInRow = _ref2.numImagesInRow; |
| 5647 |
var numImagesInRow = _ref2$numImagesInRow === void 0 ? 2 : _ref2$numImagesInRow; |
| 5648 |
var _ref2$overlay = _ref2.overlay; |
| 5649 |
var overlay = _ref2$overlay === void 0 ? true : _ref2$overlay; |
| 5650 |
var _ref2$onSelectChange = _ref2.onSelectChange; |
| 5651 |
var onSelectChange = _ref2$onSelectChange === void 0 ? null : _ref2$onSelectChange; |
| 5652 |
var _ref2$checkboxColor = _ref2.checkboxColor; |
| 5653 |
var checkboxColor = _ref2$checkboxColor === void 0 ? "rgba(0, 0, 0, 0.54)" : _ref2$checkboxColor; |
| 5654 |
var _ref2$isLoading = _ref2.isLoading; |
| 5655 |
var isLoading = _ref2$isLoading === void 0 ? false : _ref2$isLoading; |
| 5656 |
var _ref2$initialChecked = _ref2.initialChecked; |
| 5657 |
var initialChecked = _ref2$initialChecked === void 0 ? false : _ref2$initialChecked; |
| 5658 |
var props = _objectWithoutProperties$1(_ref2, _excluded2$4); |
| 5659 |
var _useState2 = _slicedToArray((0, react.useState)(initialChecked), 2); |
| 5660 |
var isChecked = _useState2[0]; |
| 5661 |
var setIsChecked = _useState2[1]; |
| 5662 |
var style = {}; |
| 5663 |
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; |
| 5664 |
(0, react.useEffect)(function() { |
| 5665 |
setIsChecked(initialChecked); |
| 5666 |
}, [initialChecked]); |
| 5667 |
if ("thumbnail" === variant) { |
| 5668 |
style.width = "100%"; |
| 5669 |
style.maxHeight = "238px"; |
| 5670 |
style.minWidth = "230px"; |
| 5671 |
} else { |
| 5672 |
style.width = "auto"; |
| 5673 |
style.height = "auto"; |
| 5674 |
style.maxWidth = "100%"; |
| 5675 |
style.maxHeight = "1:1" === aspectRatio ? "initial" : "100%"; |
| 5676 |
style.objectFit = "contain"; |
| 5677 |
style.aspectRatio = aspectRatio.replace(":", " / "); |
| 5678 |
} |
| 5679 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.ImageListItem, props, /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, { |
| 5680 |
display: "flex", |
| 5681 |
justifyContent: "center", |
| 5682 |
alignItems: "center", |
| 5683 |
sx: { |
| 5684 |
bgcolor: "action.selected", |
| 5685 |
height: "contained" === variant && numImagesInRow <= 2 ? 336 : "auto", |
| 5686 |
position: "relative", |
| 5687 |
overflow: "hidden" |
| 5688 |
} |
| 5689 |
}, /*#__PURE__*/ react.default.createElement(react.default.Fragment, null, isLoading ? /*#__PURE__*/ react.default.createElement(_elementor_ui.Skeleton, { |
| 5690 |
sx: _objectSpread$22(_objectSpread$22({}, style), {}, { |
| 5691 |
width: "100%", |
| 5692 |
height: "100% " |
| 5693 |
}), |
| 5694 |
animation: "wave", |
| 5695 |
variant: "rounded" |
| 5696 |
}, /*#__PURE__*/ react.default.createElement("img", { |
| 5697 |
alt, |
| 5698 |
src, |
| 5699 |
style: _objectSpread$22(_objectSpread$22({}, style), {}, { visibility: "hidden" }) |
| 5700 |
})) : /*#__PURE__*/ react.default.createElement(react.default.Fragment, null, onSelectChange && /*#__PURE__*/ react.default.createElement(_elementor_ui.Checkbox, { |
| 5701 |
onClick: function onClick() { |
| 5702 |
var newVal = !isChecked; |
| 5703 |
setIsChecked(newVal); |
| 5704 |
onSelectChange(newVal); |
| 5705 |
}, |
| 5706 |
checked: isChecked, |
| 5707 |
sx: { |
| 5708 |
position: "absolute", |
| 5709 |
top: 0, |
| 5710 |
left: isRTL ? void 0 : 0, |
| 5711 |
right: isRTL ? 0 : void 0, |
| 5712 |
"& .MuiSvgIcon-root": { color: checkboxColor } |
| 5713 |
} |
| 5714 |
}), /*#__PURE__*/ react.default.createElement("img", { |
| 5715 |
alt, |
| 5716 |
src, |
| 5717 |
style |
| 5718 |
})))), overlay && children && /*#__PURE__*/ react.default.createElement(Overlay, null, /*#__PURE__*/ react.default.createElement(OverlayBar, _extends$1({ |
| 5719 |
gap: 1, |
| 5720 |
position: "bottom" |
| 5721 |
}, OverlayBarProps), text && /*#__PURE__*/ react.default.createElement(OverlayBarText, null, text), children))); |
| 5722 |
}; |
| 5723 |
GalleryImage.propTypes = { |
| 5724 |
alt: import_prop_types$8.default.string, |
| 5725 |
src: import_prop_types$8.default.string, |
| 5726 |
text: import_prop_types$8.default.string, |
| 5727 |
children: import_prop_types$8.default.node, |
| 5728 |
BoxProps: import_prop_types$8.default.object, |
| 5729 |
OverlayBarProps: import_prop_types$8.default.object, |
| 5730 |
aspectRatio: import_prop_types$8.default.oneOf(aspectRatios), |
| 5731 |
variant: import_prop_types$8.default.oneOf(["contained", "thumbnail"]), |
| 5732 |
numImagesInRow: import_prop_types$8.default.number, |
| 5733 |
overlay: import_prop_types$8.default.bool, |
| 5734 |
onSelectChange: import_prop_types$8.default.func, |
| 5735 |
checkboxColor: import_prop_types$8.default.string, |
| 5736 |
initialChecked: import_prop_types$8.default.bool, |
| 5737 |
isLoading: import_prop_types$8.default.bool |
| 5738 |
}; |
| 5739 |
Gallery.Image = GalleryImage; |
| 5740 |
|
| 5741 |
//#endregion |
| 5742 |
//#region modules/ai/assets/js/editor/pages/form-media/components/image-form.js |
| 5743 |
init_extends(); |
| 5744 |
init_objectWithoutProperties$1(); |
| 5745 |
var _excluded$23 = ["children"]; |
| 5746 |
var ImageForm = function ImageForm(_ref) { |
| 5747 |
var children = _ref.children; |
| 5748 |
var props = _objectWithoutProperties$1(_ref, _excluded$23); |
| 5749 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, _extends$1({ component: "form" }, props), /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, { spacing: 2.5 }, children)); |
| 5750 |
}; |
| 5751 |
ImageForm.propTypes = { children: import_prop_types$8.default.node }; |
| 5752 |
|
| 5753 |
//#endregion |
| 5754 |
//#region modules/ai/assets/js/editor/icons/wand-icon.js |
| 5755 |
init_extends(); |
| 5756 |
var WandIcon = react.default.forwardRef(function(props, ref) { |
| 5757 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.SvgIcon, _extends$1({ viewBox: "0 0 24 24" }, props, { ref }), /*#__PURE__*/ react.default.createElement("path", { |
| 5758 |
fillRule: "evenodd", |
| 5759 |
clipRule: "evenodd", |
| 5760 |
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" |
| 5761 |
}), /*#__PURE__*/ react.default.createElement("path", { |
| 5762 |
fillRule: "evenodd", |
| 5763 |
clipRule: "evenodd", |
| 5764 |
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" |
| 5765 |
}), /*#__PURE__*/ react.default.createElement("path", { |
| 5766 |
fillRule: "evenodd", |
| 5767 |
clipRule: "evenodd", |
| 5768 |
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" |
| 5769 |
})); |
| 5770 |
}); |
| 5771 |
|
| 5772 |
//#endregion |
| 5773 |
//#region modules/ai/assets/js/editor/pages/form-media/components/enhance-button.js |
| 5774 |
init_extends(); |
| 5775 |
init_objectWithoutProperties$1(); |
| 5776 |
var _excluded$22 = ["isLoading"]; |
| 5777 |
var StyledWandIcon = (0, _elementor_ui.withDirection)(WandIcon); |
| 5778 |
var EnhanceButton = function EnhanceButton(_ref) { |
| 5779 |
var isLoading = _ref.isLoading; |
| 5780 |
var props = _objectWithoutProperties$1(_ref, _excluded$22); |
| 5781 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Tooltip, { title: (0, _wordpress_i18n.__)("Enhance prompt", "elementor") }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, { |
| 5782 |
component: "span", |
| 5783 |
sx: { cursor: props.disabled ? "default" : "pointer" } |
| 5784 |
}, /*#__PURE__*/ react.default.createElement(_elementor_ui.IconButton, _extends$1({ |
| 5785 |
size: "small", |
| 5786 |
color: "secondary" |
| 5787 |
}, props), isLoading ? /*#__PURE__*/ react.default.createElement(_elementor_ui.CircularProgress, { |
| 5788 |
color: "secondary", |
| 5789 |
size: 20 |
| 5790 |
}) : /*#__PURE__*/ react.default.createElement(StyledWandIcon, { fontSize: "small" })))); |
| 5791 |
}; |
| 5792 |
EnhanceButton.propTypes = { |
| 5793 |
disabled: import_prop_types$8.default.bool, |
| 5794 |
isLoading: import_prop_types$8.default.bool |
| 5795 |
}; |
| 5796 |
|
| 5797 |
//#endregion |
| 5798 |
//#region modules/ai/assets/js/editor/pages/form-layout/context/config.js |
| 5799 |
var MODE_LAYOUT = "layout"; |
| 5800 |
var MODE_VARIATION = "variation"; |
| 5801 |
var LAYOUT_APP_MODES = [MODE_LAYOUT, MODE_VARIATION]; |
| 5802 |
var ConfigContext = react.default.createContext({}); |
| 5803 |
var useConfig = function useConfig() { |
| 5804 |
return react.default.useContext(ConfigContext); |
| 5805 |
}; |
| 5806 |
var ConfigProvider = function ConfigProvider(props) { |
| 5807 |
return /*#__PURE__*/ react.default.createElement(ConfigContext.Provider, { value: { |
| 5808 |
mode: props.mode, |
| 5809 |
attachmentsTypes: props.attachmentsTypes, |
| 5810 |
onClose: props.onClose, |
| 5811 |
onConnect: props.onConnect, |
| 5812 |
onData: props.onData, |
| 5813 |
onInsert: props.onInsert, |
| 5814 |
onSelect: props.onSelect, |
| 5815 |
onGenerate: props.onGenerate, |
| 5816 |
currentContext: props.currentContext, |
| 5817 |
hasPro: props.hasPro |
| 5818 |
} }, props.children); |
| 5819 |
}; |
| 5820 |
ConfigProvider.propTypes = { |
| 5821 |
mode: import_prop_types$8.default.oneOf(LAYOUT_APP_MODES).isRequired, |
| 5822 |
children: import_prop_types$8.default.node.isRequired, |
| 5823 |
attachmentsTypes: import_prop_types$8.default.object.isRequired, |
| 5824 |
onClose: import_prop_types$8.default.func.isRequired, |
| 5825 |
onConnect: import_prop_types$8.default.func.isRequired, |
| 5826 |
onData: import_prop_types$8.default.func.isRequired, |
| 5827 |
onInsert: import_prop_types$8.default.func.isRequired, |
| 5828 |
onSelect: import_prop_types$8.default.func.isRequired, |
| 5829 |
onGenerate: import_prop_types$8.default.func.isRequired, |
| 5830 |
currentContext: import_prop_types$8.default.object, |
| 5831 |
hasPro: import_prop_types$8.default.bool |
| 5832 |
}; |
| 5833 |
|
| 5834 |
//#endregion |
| 5835 |
//#region modules/ai/assets/js/editor/hooks/use-prompt-enhancer.js |
| 5836 |
init_api(); |
| 5837 |
init_use_prompt(); |
| 5838 |
var enhancePromptMap = /* @__PURE__ */ new Map([["media", getImagePromptEnhanced], ["layout", getLayoutPromptEnhanced]]); |
| 5839 |
var getResult = function getResult(prompt, type, enhanceType) { |
| 5840 |
if (!enhancePromptMap.has(type)) throw new Error("Invalid prompt type: ".concat(type)); |
| 5841 |
return enhancePromptMap.get(type)(prompt, enhanceType); |
| 5842 |
}; |
| 5843 |
/** |
| 5844 |
* Hook to enhance a prompt. |
| 5845 |
* |
| 5846 |
* @param {string} prompt |
| 5847 |
* @param {'media' | 'layout'} type |
| 5848 |
* @return {{enhancedPrompt: string | undefined, isEnhancing: boolean, enhance: (function(...[*]): Promise)}} |
| 5849 |
*/ |
| 5850 |
var usePromptEnhancer = function usePromptEnhancer(prompt, type) { |
| 5851 |
var mode = useConfig().mode; |
| 5852 |
var _usePrompt = usePrompt(function() { |
| 5853 |
return getResult(prompt, type, mode); |
| 5854 |
}, prompt); |
| 5855 |
var enhancedData = _usePrompt.data; |
| 5856 |
var isEnhancing = _usePrompt.isLoading; |
| 5857 |
return { |
| 5858 |
enhance: _usePrompt.send, |
| 5859 |
isEnhancing, |
| 5860 |
enhancedPrompt: enhancedData === null || enhancedData === void 0 ? void 0 : enhancedData.result |
| 5861 |
}; |
| 5862 |
}; |
| 5863 |
|
| 5864 |
//#endregion |
| 5865 |
//#region modules/ai/assets/js/editor/pages/form-media/components/prompt-field.js |
| 5866 |
init_extends(); |
| 5867 |
init_objectWithoutProperties$1(); |
| 5868 |
init_textarea(); |
| 5869 |
var _excluded$21 = ["disabled", "onChange"]; |
| 5870 |
var PromptField = function PromptField(_ref) { |
| 5871 |
var disabled = _ref.disabled; |
| 5872 |
var _onChange = _ref.onChange; |
| 5873 |
var props = _objectWithoutProperties$1(_ref, _excluded$21); |
| 5874 |
var _usePromptEnhancer = usePromptEnhancer(props.value, "media"); |
| 5875 |
var enhance = _usePromptEnhancer.enhance; |
| 5876 |
var isEnhancing = _usePromptEnhancer.isEnhancing; |
| 5877 |
return /*#__PURE__*/ react.default.createElement(Textarea, _extends$1({ |
| 5878 |
minRows: 3, |
| 5879 |
maxRows: 6, |
| 5880 |
InputProps: { endAdornment: /*#__PURE__*/ react.default.createElement(_elementor_ui.InputAdornment, { |
| 5881 |
position: "end", |
| 5882 |
sx: { |
| 5883 |
position: "absolute", |
| 5884 |
bottom: "24px", |
| 5885 |
right: "8px" |
| 5886 |
} |
| 5887 |
}, /*#__PURE__*/ react.default.createElement(EnhanceButton, { |
| 5888 |
isLoading: isEnhancing, |
| 5889 |
disabled: disabled || isEnhancing || !props.value, |
| 5890 |
onClick: function onClick() { |
| 5891 |
enhance(prompt).then(function(_ref2) { |
| 5892 |
var result = _ref2.result; |
| 5893 |
return _onChange(result); |
| 5894 |
}); |
| 5895 |
} |
| 5896 |
})) }, |
| 5897 |
sx: { "& .MuiInputBase-input.MuiOutlinedInput-input.MuiInputBase-inputMultiline": { |
| 5898 |
pb: 5, |
| 5899 |
width: "89%" |
| 5900 |
} }, |
| 5901 |
onKeyDown: function onKeyDown(event) { |
| 5902 |
if ("Tab" === event.key) { |
| 5903 |
event.preventDefault(); |
| 5904 |
_onChange(props.placeholder); |
| 5905 |
} |
| 5906 |
} |
| 5907 |
}, props, { |
| 5908 |
onChange: function onChange(event) { |
| 5909 |
return _onChange(event.target.value); |
| 5910 |
}, |
| 5911 |
disabled: disabled || isEnhancing |
| 5912 |
})); |
| 5913 |
}; |
| 5914 |
PromptField.propTypes = { |
| 5915 |
value: import_prop_types$8.default.string, |
| 5916 |
disabled: import_prop_types$8.default.bool, |
| 5917 |
placeholder: import_prop_types$8.default.string, |
| 5918 |
onChange: import_prop_types$8.default.func.isRequired |
| 5919 |
}; |
| 5920 |
|
| 5921 |
//#endregion |
| 5922 |
//#region modules/ai/assets/js/editor/pages/form-media/components/image-type-select.js |
| 5923 |
init_extends(); |
| 5924 |
init_slicedToArray(); |
| 5925 |
init_use_introduction(); |
| 5926 |
var StyledNewChip = (0, _elementor_ui.styled)(_elementor_ui.Chip)(function() { |
| 5927 |
return { "& .MuiChip-label": { |
| 5928 |
fontSize: "0.75rem", |
| 5929 |
fontWeight: "normal" |
| 5930 |
} }; |
| 5931 |
}); |
| 5932 |
var showLabel = function showLabel(label, key, isViewed, markAsViewed) { |
| 5933 |
if (isViewed) return { |
| 5934 |
label, |
| 5935 |
value: key |
| 5936 |
}; |
| 5937 |
return { |
| 5938 |
label: /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, { |
| 5939 |
direction: "row", |
| 5940 |
width: "100%", |
| 5941 |
justifyContent: "space-between", |
| 5942 |
alignItems: "center" |
| 5943 |
}, label, /*#__PURE__*/ react.default.createElement(StyledNewChip, { |
| 5944 |
label: "New", |
| 5945 |
color: "info", |
| 5946 |
variant: "standard", |
| 5947 |
size: "tiny" |
| 5948 |
})), |
| 5949 |
value: key, |
| 5950 |
onClick: function onClick() { |
| 5951 |
return markAsViewed(); |
| 5952 |
} |
| 5953 |
}; |
| 5954 |
}; |
| 5955 |
var changeImageType = function changeImageType(e, props, markVectorAsViewed) { |
| 5956 |
if ("vector" === e.target.value) markVectorAsViewed(); |
| 5957 |
if (props.onChange) props.onChange(e); |
| 5958 |
}; |
| 5959 |
var ImageTypeSelect = function ImageTypeSelect(props) { |
| 5960 |
var _useIntroduction = useIntroduction("e-ai-image-vector-option"); |
| 5961 |
var isVectorViewed = _useIntroduction.isViewed; |
| 5962 |
var markVectorAsViewed = _useIntroduction.markAsViewed; |
| 5963 |
var imageTypesWithNewChip = Object.entries(IMAGE_PROMPT_CATEGORIES).map(function(_ref) { |
| 5964 |
var _ref2 = _slicedToArray(_ref, 2); |
| 5965 |
var key = _ref2[0]; |
| 5966 |
var label = _ref2[1].label; |
| 5967 |
if ("vector" === key) return showLabel(label, key, isVectorViewed, markVectorAsViewed); |
| 5968 |
return { |
| 5969 |
label, |
| 5970 |
value: key |
| 5971 |
}; |
| 5972 |
}); |
| 5973 |
return /*#__PURE__*/ react.default.createElement(PromptActionSelection, _extends$1({ |
| 5974 |
options: imageTypesWithNewChip, |
| 5975 |
wrapperStyle: { width: "100%" }, |
| 5976 |
label: (0, _wordpress_i18n.__)("Image type", "elementor") |
| 5977 |
}, props, { onChange: function onChange(e) { |
| 5978 |
changeImageType(e, props, markVectorAsViewed); |
| 5979 |
} })); |
| 5980 |
}; |
| 5981 |
ImageTypeSelect.propTypes = { |
| 5982 |
onChange: import_prop_types$8.default.func, |
| 5983 |
value: import_prop_types$8.default.string, |
| 5984 |
disabled: import_prop_types$8.default.bool |
| 5985 |
}; |
| 5986 |
|
| 5987 |
//#endregion |
| 5988 |
//#region modules/ai/assets/js/editor/pages/form-media/components/image-style-select.js |
| 5989 |
init_extends(); |
| 5990 |
init_slicedToArray(); |
| 5991 |
init_objectWithoutProperties$1(); |
| 5992 |
var _excluded$20 = ["type"]; |
| 5993 |
var ImageStyleSelect = function ImageStyleSelect(_ref) { |
| 5994 |
var _IMAGE_PROMPT_CATEGOR; |
| 5995 |
var _ref$type = _ref.type; |
| 5996 |
var type = _ref$type === void 0 ? "" : _ref$type; |
| 5997 |
var props = _objectWithoutProperties$1(_ref, _excluded$20); |
| 5998 |
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) { |
| 5999 |
var _ref3 = _slicedToArray(_ref2, 2); |
| 6000 |
var value = _ref3[0]; |
| 6001 |
return { |
| 6002 |
label: _ref3[1], |
| 6003 |
value |
| 6004 |
}; |
| 6005 |
}); |
| 6006 |
return /*#__PURE__*/ react.default.createElement(PromptActionSelection, _extends$1({ |
| 6007 |
options: imageStyles, |
| 6008 |
wrapperStyle: { width: "100%" }, |
| 6009 |
label: (0, _wordpress_i18n.__)("Style", "elementor") |
| 6010 |
}, props)); |
| 6011 |
}; |
| 6012 |
ImageStyleSelect.propTypes = { type: import_prop_types$8.default.string.isRequired }; |
| 6013 |
|
| 6014 |
//#endregion |
| 6015 |
//#region modules/ai/assets/js/editor/pages/form-media/components/image-ratio-select.js |
| 6016 |
init_extends(); |
| 6017 |
init_slicedToArray(); |
| 6018 |
var imageRatios = Object.entries(IMAGE_ASPECT_RATIO).map(function(_ref) { |
| 6019 |
var _ref2 = _slicedToArray(_ref, 2); |
| 6020 |
var value = _ref2[0]; |
| 6021 |
return { |
| 6022 |
label: _ref2[1].label, |
| 6023 |
value |
| 6024 |
}; |
| 6025 |
}); |
| 6026 |
var ImageRatioSelect = function ImageRatioSelect(props) { |
| 6027 |
return /*#__PURE__*/ react.default.createElement(PromptActionSelection, _extends$1({ |
| 6028 |
options: imageRatios, |
| 6029 |
wrapperStyle: { width: "100%" }, |
| 6030 |
label: (0, _wordpress_i18n.__)("Aspect ratio", "elementor") |
| 6031 |
}, props)); |
| 6032 |
}; |
| 6033 |
|
| 6034 |
//#endregion |
| 6035 |
//#region modules/ai/assets/js/editor/icons/refresh-icon.js |
| 6036 |
init_extends(); |
| 6037 |
var RefreshIcon = react.default.forwardRef(function(props, ref) { |
| 6038 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.SvgIcon, _extends$1({ viewBox: "0 0 24 24" }, props, { ref }), /*#__PURE__*/ react.default.createElement("path", { |
| 6039 |
fillRule: "evenodd", |
| 6040 |
clipRule: "evenodd", |
| 6041 |
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" |
| 6042 |
}), /*#__PURE__*/ react.default.createElement("path", { |
| 6043 |
fillRule: "evenodd", |
| 6044 |
clipRule: "evenodd", |
| 6045 |
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" |
| 6046 |
})); |
| 6047 |
}); |
| 6048 |
|
| 6049 |
//#endregion |
| 6050 |
//#region modules/ai/assets/js/editor/pages/form-media/components/generate-again-submit.js |
| 6051 |
init_extends(); |
| 6052 |
var GenerateAgainSubmit = function GenerateAgainSubmit(props) { |
| 6053 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Button, _extends$1({ |
| 6054 |
fullWidth: true, |
| 6055 |
type: "submit", |
| 6056 |
variant: "contained", |
| 6057 |
color: "secondary", |
| 6058 |
startIcon: /*#__PURE__*/ react.default.createElement(RefreshIcon, null), |
| 6059 |
sx: { color: "background.paper" } |
| 6060 |
}, props), (0, _wordpress_i18n.__)("Generate again", "elementor")); |
| 6061 |
}; |
| 6062 |
|
| 6063 |
//#endregion |
| 6064 |
//#region modules/ai/assets/js/editor/pages/form-media/components/new-prompt-button.js |
| 6065 |
init_extends(); |
| 6066 |
var NewPromptButton = function NewPromptButton(props) { |
| 6067 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Button, _extends$1({ |
| 6068 |
fullWidth: true, |
| 6069 |
variant: "text", |
| 6070 |
color: "secondary" |
| 6071 |
}, props), (0, _wordpress_i18n.__)("New prompt", "elementor")); |
| 6072 |
}; |
| 6073 |
|
| 6074 |
//#endregion |
| 6075 |
//#region modules/ai/assets/js/editor/pages/form-media/components/generate-images-submit.js |
| 6076 |
init_extends(); |
| 6077 |
init_generate_button(); |
| 6078 |
init_voice_promotion_alert(); |
| 6079 |
var GenerateImagesSubmit = function GenerateImagesSubmit(props) { |
| 6080 |
return /*#__PURE__*/ react.default.createElement(react.default.Fragment, null, /*#__PURE__*/ react.default.createElement(GenerateButton$1, _extends$1({ |
| 6081 |
size: "medium", |
| 6082 |
fullWidth: true |
| 6083 |
}, props), (0, _wordpress_i18n.__)("Generate images", "elementor")), /*#__PURE__*/ react.default.createElement(VoicePromotionAlert, { introductionKey: "ai-context-media-promotion" })); |
| 6084 |
}; |
| 6085 |
|
| 6086 |
//#endregion |
| 6087 |
//#region modules/ai/assets/js/editor/pages/form-media/hooks/use-image-size.js |
| 6088 |
var useImageSize = function useImageSize(aspectRatio) { |
| 6089 |
var _IMAGE_ASPECT_RATIO$a = IMAGE_ASPECT_RATIO[aspectRatio]; |
| 6090 |
return { |
| 6091 |
width: _IMAGE_ASPECT_RATIO$a.width, |
| 6092 |
height: _IMAGE_ASPECT_RATIO$a.height |
| 6093 |
}; |
| 6094 |
}; |
| 6095 |
|
| 6096 |
//#endregion |
| 6097 |
//#region modules/ai/assets/js/editor/hooks/use-image-navigation.js |
| 6098 |
init_slicedToArray(); |
| 6099 |
var initialIndex = -1; |
| 6100 |
var useImageNavigation = function useImageNavigation(images) { |
| 6101 |
var _useState2 = _slicedToArray((0, react.useState)(initialIndex), 2); |
| 6102 |
var zoomIndex = _useState2[0]; |
| 6103 |
var setZoomIndex = _useState2[1]; |
| 6104 |
return { |
| 6105 |
zoomIndex, |
| 6106 |
setZoomIndex, |
| 6107 |
actions: { |
| 6108 |
reset: function reset() { |
| 6109 |
return setZoomIndex(initialIndex); |
| 6110 |
}, |
| 6111 |
prev: function prev() { |
| 6112 |
var prevImage = zoomIndex + 1; |
| 6113 |
if (prevImage >= images.length) prevImage = 0; |
| 6114 |
setZoomIndex(prevImage); |
| 6115 |
}, |
| 6116 |
next: function next() { |
| 6117 |
var nextImage = zoomIndex - 1; |
| 6118 |
if (nextImage < 0) nextImage = images.length - 1; |
| 6119 |
setZoomIndex(nextImage); |
| 6120 |
} |
| 6121 |
} |
| 6122 |
}; |
| 6123 |
}; |
| 6124 |
|
| 6125 |
//#endregion |
| 6126 |
//#region modules/ai/assets/js/editor/icons/chevron-right-icon.js |
| 6127 |
init_extends(); |
| 6128 |
var ChevronRightIcon = react.default.forwardRef(function(props, ref) { |
| 6129 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.SvgIcon, _extends$1({ viewBox: "0 0 24 24" }, props, { ref }), /*#__PURE__*/ react.default.createElement("path", { |
| 6130 |
fillRule: "evenodd", |
| 6131 |
clipRule: "evenodd", |
| 6132 |
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" |
| 6133 |
})); |
| 6134 |
}); |
| 6135 |
|
| 6136 |
//#endregion |
| 6137 |
//#region modules/ai/assets/js/editor/pages/form-media/components/image-slider.js |
| 6138 |
init_defineProperty$1(); |
| 6139 |
init_extends(); |
| 6140 |
init_objectWithoutProperties$1(); |
| 6141 |
var _excluded$19 = [ |
| 6142 |
"onPrev", |
| 6143 |
"onNext", |
| 6144 |
"children" |
| 6145 |
]; |
| 6146 |
var _excluded2$3 = [ |
| 6147 |
"children", |
| 6148 |
"startAction", |
| 6149 |
"sx" |
| 6150 |
]; |
| 6151 |
var _excluded3$1 = ["src", "alt"]; |
| 6152 |
function ownKeys$21(e, r) { |
| 6153 |
var t = Object.keys(e); |
| 6154 |
if (Object.getOwnPropertySymbols) { |
| 6155 |
var o = Object.getOwnPropertySymbols(e); |
| 6156 |
r && (o = o.filter(function(r) { |
| 6157 |
return Object.getOwnPropertyDescriptor(e, r).enumerable; |
| 6158 |
})), t.push.apply(t, o); |
| 6159 |
} |
| 6160 |
return t; |
| 6161 |
} |
| 6162 |
__name(ownKeys$21, "ownKeys"); |
| 6163 |
function _objectSpread$21(e) { |
| 6164 |
for (var r = 1; r < arguments.length; r++) { |
| 6165 |
var t = null != arguments[r] ? arguments[r] : {}; |
| 6166 |
r % 2 ? ownKeys$21(Object(t), !0).forEach(function(r) { |
| 6167 |
_defineProperty$1(e, r, t[r]); |
| 6168 |
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$21(Object(t)).forEach(function(r) { |
| 6169 |
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); |
| 6170 |
}); |
| 6171 |
} |
| 6172 |
return e; |
| 6173 |
} |
| 6174 |
__name(_objectSpread$21, "_objectSpread"); |
| 6175 |
var StyledChevronLeftIcon = (0, _elementor_ui.withDirection)(ChevronLeftIcon); |
| 6176 |
var StyledChevronRightIcon = (0, _elementor_ui.withDirection)(ChevronRightIcon); |
| 6177 |
var ImageSlider = function ImageSlider(_ref) { |
| 6178 |
var onPrev = _ref.onPrev; |
| 6179 |
var onNext = _ref.onNext; |
| 6180 |
var children = _ref.children; |
| 6181 |
var props = _objectWithoutProperties$1(_ref, _excluded$19); |
| 6182 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, _extends$1({ |
| 6183 |
alignItems: "flex-start", |
| 6184 |
spacing: .5 |
| 6185 |
}, props), /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, { |
| 6186 |
direction: "row", |
| 6187 |
spacing: 2.5, |
| 6188 |
alignSelf: "center", |
| 6189 |
alignItems: "center" |
| 6190 |
}, /*#__PURE__*/ react.default.createElement(_elementor_ui.IconButton, { |
| 6191 |
onClick: onPrev, |
| 6192 |
size: "large", |
| 6193 |
color: "secondary" |
| 6194 |
}, /*#__PURE__*/ react.default.createElement(StyledChevronLeftIcon, null)), /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, { |
| 6195 |
spacing: .5, |
| 6196 |
justifyContent: "space-around", |
| 6197 |
alignItems: "center" |
| 6198 |
}, children), /*#__PURE__*/ react.default.createElement(_elementor_ui.IconButton, { |
| 6199 |
onClick: onNext, |
| 6200 |
size: "large", |
| 6201 |
color: "secondary" |
| 6202 |
}, /*#__PURE__*/ react.default.createElement(StyledChevronRightIcon, null)))); |
| 6203 |
}; |
| 6204 |
ImageSlider.propTypes = { |
| 6205 |
onPrev: import_prop_types$8.default.func.isRequired, |
| 6206 |
onNext: import_prop_types$8.default.func.isRequired, |
| 6207 |
children: import_prop_types$8.default.node.isRequired |
| 6208 |
}; |
| 6209 |
var Actions$1 = function Actions(_ref2) { |
| 6210 |
var children = _ref2.children; |
| 6211 |
var startAction = _ref2.startAction; |
| 6212 |
var _ref2$sx = _ref2.sx; |
| 6213 |
var sx = _ref2$sx === void 0 ? {} : _ref2$sx; |
| 6214 |
var props = _objectWithoutProperties$1(_ref2, _excluded2$3); |
| 6215 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, _extends$1({ |
| 6216 |
display: "flex", |
| 6217 |
justifyContent: "flex-end", |
| 6218 |
alignItems: "center", |
| 6219 |
width: "100%" |
| 6220 |
}, props, { sx: _objectSpread$21({ mb: 1.5 }, sx) }), startAction, /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, { |
| 6221 |
direction: "row", |
| 6222 |
spacing: 2, |
| 6223 |
justifyContent: "flex-end", |
| 6224 |
flexGrow: 1, |
| 6225 |
width: "100%" |
| 6226 |
}, children)); |
| 6227 |
}; |
| 6228 |
Actions$1.propTypes = { |
| 6229 |
sx: import_prop_types$8.default.object, |
| 6230 |
startAction: import_prop_types$8.default.node, |
| 6231 |
children: import_prop_types$8.default.node.isRequired |
| 6232 |
}; |
| 6233 |
var Image$2 = function Image(_ref3) { |
| 6234 |
var src = _ref3.src; |
| 6235 |
var _ref3$alt = _ref3.alt; |
| 6236 |
var alt = _ref3$alt === void 0 ? "" : _ref3$alt; |
| 6237 |
var props = _objectWithoutProperties$1(_ref3, _excluded3$1); |
| 6238 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, { |
| 6239 |
display: "flex", |
| 6240 |
justifyContent: "center", |
| 6241 |
alignItems: "center" |
| 6242 |
}, /*#__PURE__*/ react.default.createElement("img", _extends$1({ |
| 6243 |
src, |
| 6244 |
alt |
| 6245 |
}, props))); |
| 6246 |
}; |
| 6247 |
Image$2.propTypes = { |
| 6248 |
alt: import_prop_types$8.default.string, |
| 6249 |
src: import_prop_types$8.default.string.isRequired |
| 6250 |
}; |
| 6251 |
ImageSlider.Actions = Actions$1; |
| 6252 |
ImageSlider.Image = Image$2; |
| 6253 |
|
| 6254 |
//#endregion |
| 6255 |
//#region modules/ai/assets/js/editor/icons/copy-icon.js |
| 6256 |
init_extends(); |
| 6257 |
var CopyIcon$1 = react.default.forwardRef(function(props, ref) { |
| 6258 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.SvgIcon, _extends$1({ viewBox: "0 0 24 24" }, props, { ref }), /*#__PURE__*/ react.default.createElement("path", { |
| 6259 |
fillRule: "evenodd", |
| 6260 |
clipRule: "evenodd", |
| 6261 |
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" |
| 6262 |
}), /*#__PURE__*/ react.default.createElement("path", { |
| 6263 |
fillRule: "evenodd", |
| 6264 |
clipRule: "evenodd", |
| 6265 |
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" |
| 6266 |
})); |
| 6267 |
}); |
| 6268 |
|
| 6269 |
//#endregion |
| 6270 |
//#region modules/ai/assets/js/editor/icons/edit-icon.js |
| 6271 |
init_extends(); |
| 6272 |
var EditIcon$1 = react.default.forwardRef(function(props, ref) { |
| 6273 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.SvgIcon, _extends$1({ viewBox: "0 0 24 24" }, props, { ref }), /*#__PURE__*/ react.default.createElement("path", { |
| 6274 |
fillRule: "evenodd", |
| 6275 |
clipRule: "evenodd", |
| 6276 |
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" |
| 6277 |
}), /*#__PURE__*/ react.default.createElement("path", { |
| 6278 |
fillRule: "evenodd", |
| 6279 |
clipRule: "evenodd", |
| 6280 |
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" |
| 6281 |
})); |
| 6282 |
}); |
| 6283 |
|
| 6284 |
//#endregion |
| 6285 |
//#region modules/ai/assets/js/editor/icons/download-icon.js |
| 6286 |
init_extends(); |
| 6287 |
var DownloadIcon = react.default.forwardRef(function(props, ref) { |
| 6288 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.SvgIcon, _extends$1({ viewBox: "0 0 24 24" }, props, { ref }), /*#__PURE__*/ react.default.createElement("path", { |
| 6289 |
fillRule: "evenodd", |
| 6290 |
clipRule: "evenodd", |
| 6291 |
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" |
| 6292 |
}), /*#__PURE__*/ react.default.createElement("path", { |
| 6293 |
fillRule: "evenodd", |
| 6294 |
clipRule: "evenodd", |
| 6295 |
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" |
| 6296 |
}), /*#__PURE__*/ react.default.createElement("path", { |
| 6297 |
fillRule: "evenodd", |
| 6298 |
clipRule: "evenodd", |
| 6299 |
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" |
| 6300 |
})); |
| 6301 |
}); |
| 6302 |
|
| 6303 |
//#endregion |
| 6304 |
//#region modules/ai/assets/js/editor/icons/zoom-in-icon.js |
| 6305 |
init_extends(); |
| 6306 |
var ZoomInIcon = react.default.forwardRef(function(props, ref) { |
| 6307 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.SvgIcon, _extends$1({ viewBox: "0 0 24 24" }, props, { ref }), /*#__PURE__*/ react.default.createElement("path", { |
| 6308 |
fillRule: "evenodd", |
| 6309 |
clipRule: "evenodd", |
| 6310 |
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" |
| 6311 |
}), /*#__PURE__*/ react.default.createElement("path", { |
| 6312 |
fillRule: "evenodd", |
| 6313 |
clipRule: "evenodd", |
| 6314 |
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" |
| 6315 |
}), /*#__PURE__*/ react.default.createElement("path", { |
| 6316 |
fillRule: "evenodd", |
| 6317 |
clipRule: "evenodd", |
| 6318 |
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" |
| 6319 |
}), /*#__PURE__*/ react.default.createElement("path", { |
| 6320 |
fillRule: "evenodd", |
| 6321 |
clipRule: "evenodd", |
| 6322 |
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" |
| 6323 |
})); |
| 6324 |
}); |
| 6325 |
|
| 6326 |
//#endregion |
| 6327 |
//#region modules/ai/assets/js/editor/pages/form-media/components/image-actions.js |
| 6328 |
init_defineProperty$1(); |
| 6329 |
init_objectWithoutProperties$1(); |
| 6330 |
init_extends(); |
| 6331 |
var _excluded$18 = ["children"]; |
| 6332 |
var _excluded2$2 = ["sx"]; |
| 6333 |
var _excluded3 = ["sx"]; |
| 6334 |
var _excluded4 = ["sx"]; |
| 6335 |
var _excluded5 = ["sx"]; |
| 6336 |
function ownKeys$20(e, r) { |
| 6337 |
var t = Object.keys(e); |
| 6338 |
if (Object.getOwnPropertySymbols) { |
| 6339 |
var o = Object.getOwnPropertySymbols(e); |
| 6340 |
r && (o = o.filter(function(r) { |
| 6341 |
return Object.getOwnPropertyDescriptor(e, r).enumerable; |
| 6342 |
})), t.push.apply(t, o); |
| 6343 |
} |
| 6344 |
return t; |
| 6345 |
} |
| 6346 |
__name(ownKeys$20, "ownKeys"); |
| 6347 |
function _objectSpread$20(e) { |
| 6348 |
for (var r = 1; r < arguments.length; r++) { |
| 6349 |
var t = null != arguments[r] ? arguments[r] : {}; |
| 6350 |
r % 2 ? ownKeys$20(Object(t), !0).forEach(function(r) { |
| 6351 |
_defineProperty$1(e, r, t[r]); |
| 6352 |
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$20(Object(t)).forEach(function(r) { |
| 6353 |
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); |
| 6354 |
}); |
| 6355 |
} |
| 6356 |
return e; |
| 6357 |
} |
| 6358 |
__name(_objectSpread$20, "_objectSpread"); |
| 6359 |
var StyledEditSvgIcon = (0, _elementor_ui.withDirection)(EditIcon$1); |
| 6360 |
var StyledCopySvgIcon = (0, _elementor_ui.withDirection)(CopyIcon$1); |
| 6361 |
var StyledZoomInIcon = (0, _elementor_ui.withDirection)(ZoomInIcon); |
| 6362 |
var Tooltip$6 = function Tooltip(props) { |
| 6363 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Tooltip, _extends$1({ PopperProps: { sx: { "&.MuiTooltip-popper .MuiTooltip-tooltip.MuiTooltip-tooltipPlacementBottom": { mt: 1 } } } }, props)); |
| 6364 |
}; |
| 6365 |
var ImageActions = function ImageActions(_ref) { |
| 6366 |
var children = _ref.children; |
| 6367 |
var props = _objectWithoutProperties$1(_ref, _excluded$18); |
| 6368 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, _extends$1({ |
| 6369 |
display: "flex", |
| 6370 |
justifyContent: "space-between", |
| 6371 |
alignItems: "center", |
| 6372 |
width: "100%", |
| 6373 |
gap: 1 |
| 6374 |
}, props), children); |
| 6375 |
}; |
| 6376 |
ImageActions.propTypes = { children: import_prop_types$8.default.node }; |
| 6377 |
var UseImage = function UseImage(_ref2) { |
| 6378 |
var sx = _ref2.sx; |
| 6379 |
var props = _objectWithoutProperties$1(_ref2, _excluded2$2); |
| 6380 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Button, _extends$1({ |
| 6381 |
size: "small", |
| 6382 |
variant: "contained", |
| 6383 |
startIcon: /*#__PURE__*/ react.default.createElement(DownloadIcon, null), |
| 6384 |
sx |
| 6385 |
}, props), (0, _wordpress_i18n.__)("Use Image", "elementor")); |
| 6386 |
}; |
| 6387 |
UseImage.propTypes = { sx: import_prop_types$8.default.object }; |
| 6388 |
var EditImage = function EditImage(props) { |
| 6389 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Button, _extends$1({ |
| 6390 |
size: "small", |
| 6391 |
color: "secondary", |
| 6392 |
startIcon: /*#__PURE__*/ react.default.createElement(StyledEditSvgIcon, null) |
| 6393 |
}, props), (0, _wordpress_i18n.__)("Edit", "elementor")); |
| 6394 |
}; |
| 6395 |
var EditIcon = function EditIcon(_ref3) { |
| 6396 |
var _ref3$sx = _ref3.sx; |
| 6397 |
var sx = _ref3$sx === void 0 ? {} : _ref3$sx; |
| 6398 |
var props = _objectWithoutProperties$1(_ref3, _excluded3); |
| 6399 |
return /*#__PURE__*/ react.default.createElement(Tooltip$6, { title: (0, _wordpress_i18n.__)("Edit", "elementor") }, /*#__PURE__*/ react.default.createElement(_elementor_ui.IconButton, _extends$1({ sx: _objectSpread$20({ |
| 6400 |
mr: -1.5, |
| 6401 |
ml: .5, |
| 6402 |
color: "common.white", |
| 6403 |
"&:hover": { color: "common.white" } |
| 6404 |
}, sx) }, props), /*#__PURE__*/ react.default.createElement(StyledEditSvgIcon, null))); |
| 6405 |
}; |
| 6406 |
EditIcon.propTypes = { sx: import_prop_types$8.default.object }; |
| 6407 |
var ZoomIcon = function ZoomIcon(_ref4) { |
| 6408 |
var _ref4$sx = _ref4.sx; |
| 6409 |
var sx = _ref4$sx === void 0 ? {} : _ref4$sx; |
| 6410 |
var props = _objectWithoutProperties$1(_ref4, _excluded4); |
| 6411 |
return /*#__PURE__*/ react.default.createElement(Tooltip$6, { title: (0, _wordpress_i18n.__)("Zoom", "elementor") }, /*#__PURE__*/ react.default.createElement(_elementor_ui.IconButton, _extends$1({ |
| 6412 |
color: "secondary", |
| 6413 |
"aria-label": (0, _wordpress_i18n.__)("Zoom", "elementor"), |
| 6414 |
sx: _objectSpread$20({ |
| 6415 |
color: "common.white", |
| 6416 |
"&:hover": { color: "common.white" } |
| 6417 |
}, sx) |
| 6418 |
}, props), /*#__PURE__*/ react.default.createElement(StyledZoomInIcon, null))); |
| 6419 |
}; |
| 6420 |
ZoomIcon.propTypes = { sx: import_prop_types$8.default.object }; |
| 6421 |
var CopyIcon = function CopyIcon(_ref5) { |
| 6422 |
var _ref5$sx = _ref5.sx; |
| 6423 |
var sx = _ref5$sx === void 0 ? {} : _ref5$sx; |
| 6424 |
var props = _objectWithoutProperties$1(_ref5, _excluded5); |
| 6425 |
return /*#__PURE__*/ react.default.createElement(Tooltip$6, { title: (0, _wordpress_i18n.__)("Copy prompt", "elementor") }, /*#__PURE__*/ react.default.createElement(_elementor_ui.IconButton, _extends$1({ sx: _objectSpread$20({ |
| 6426 |
mr: -1.5, |
| 6427 |
ml: .5, |
| 6428 |
color: "common.white", |
| 6429 |
"&:hover": { color: "common.white" } |
| 6430 |
}, sx) }, props), /*#__PURE__*/ react.default.createElement(StyledCopySvgIcon, null))); |
| 6431 |
}; |
| 6432 |
CopyIcon.propTypes = { sx: import_prop_types$8.default.object }; |
| 6433 |
ImageActions.UseImage = UseImage; |
| 6434 |
ImageActions.EditImage = EditImage; |
| 6435 |
ImageActions.EditIcon = EditIcon; |
| 6436 |
ImageActions.ZoomIcon = ZoomIcon; |
| 6437 |
ImageActions.CopyIcon = CopyIcon; |
| 6438 |
|
| 6439 |
//#endregion |
| 6440 |
//#region modules/ai/assets/js/editor/pages/form-media/components/single-image-preview.js |
| 6441 |
init_defineProperty$1(); |
| 6442 |
init_extends(); |
| 6443 |
init_objectWithoutProperties$1(); |
| 6444 |
var _excluded$17 = ["children"]; |
| 6445 |
var _excluded2$1 = ["children", "sx"]; |
| 6446 |
function ownKeys$19(e, r) { |
| 6447 |
var t = Object.keys(e); |
| 6448 |
if (Object.getOwnPropertySymbols) { |
| 6449 |
var o = Object.getOwnPropertySymbols(e); |
| 6450 |
r && (o = o.filter(function(r) { |
| 6451 |
return Object.getOwnPropertyDescriptor(e, r).enumerable; |
| 6452 |
})), t.push.apply(t, o); |
| 6453 |
} |
| 6454 |
return t; |
| 6455 |
} |
| 6456 |
__name(ownKeys$19, "ownKeys"); |
| 6457 |
function _objectSpread$19(e) { |
| 6458 |
for (var r = 1; r < arguments.length; r++) { |
| 6459 |
var t = null != arguments[r] ? arguments[r] : {}; |
| 6460 |
r % 2 ? ownKeys$19(Object(t), !0).forEach(function(r) { |
| 6461 |
_defineProperty$1(e, r, t[r]); |
| 6462 |
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$19(Object(t)).forEach(function(r) { |
| 6463 |
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); |
| 6464 |
}); |
| 6465 |
} |
| 6466 |
return e; |
| 6467 |
} |
| 6468 |
__name(_objectSpread$19, "_objectSpread"); |
| 6469 |
var SingleImagePreview = function SingleImagePreview(_ref) { |
| 6470 |
var children = _ref.children; |
| 6471 |
var props = _objectWithoutProperties$1(_ref, _excluded$17); |
| 6472 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, _extends$1({ display: "flex" }, props), children); |
| 6473 |
}; |
| 6474 |
SingleImagePreview.propTypes = { children: import_prop_types$8.default.node.isRequired }; |
| 6475 |
var Actions = function Actions(_ref2) { |
| 6476 |
var children = _ref2.children; |
| 6477 |
var _ref2$sx = _ref2.sx; |
| 6478 |
var sx = _ref2$sx === void 0 ? {} : _ref2$sx; |
| 6479 |
var props = _objectWithoutProperties$1(_ref2, _excluded2$1); |
| 6480 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, _extends$1({ |
| 6481 |
display: "flex", |
| 6482 |
width: "100%", |
| 6483 |
justifyContent: "flex-end", |
| 6484 |
alignItems: "center" |
| 6485 |
}, props, { sx: _objectSpread$19({ mb: 1.5 }, sx) }), /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, { |
| 6486 |
direction: "row", |
| 6487 |
spacing: 2, |
| 6488 |
justifyContent: "flex-end", |
| 6489 |
width: "100%" |
| 6490 |
}, children)); |
| 6491 |
}; |
| 6492 |
Actions.propTypes = { |
| 6493 |
sx: import_prop_types$8.default.object, |
| 6494 |
children: import_prop_types$8.default.node.isRequired |
| 6495 |
}; |
| 6496 |
var Image$1 = function Image(_ref3) { |
| 6497 |
var src = _ref3.src; |
| 6498 |
var alt = _ref3.alt; |
| 6499 |
var _ref3$style = _ref3.style; |
| 6500 |
var style = _ref3$style === void 0 ? {} : _ref3$style; |
| 6501 |
var _ref3$isLoading = _ref3.isLoading; |
| 6502 |
var isLoading = _ref3$isLoading === void 0 ? false : _ref3$isLoading; |
| 6503 |
var children = _ref3.children; |
| 6504 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, { margin: "0 auto" }, children, isLoading ? /*#__PURE__*/ react.default.createElement(_elementor_ui.Skeleton, { |
| 6505 |
sx: _objectSpread$19({ |
| 6506 |
maxWidth: "100%", |
| 6507 |
width: "auto", |
| 6508 |
maxHeight: "100%" |
| 6509 |
}, style), |
| 6510 |
animation: "wave", |
| 6511 |
variant: "rounded" |
| 6512 |
}) : /*#__PURE__*/ react.default.createElement("img", { |
| 6513 |
src, |
| 6514 |
alt, |
| 6515 |
style: _objectSpread$19({ |
| 6516 |
maxWidth: "100%", |
| 6517 |
width: "auto", |
| 6518 |
maxHeight: "100%" |
| 6519 |
}, style) |
| 6520 |
})); |
| 6521 |
}; |
| 6522 |
Image$1.propTypes = { |
| 6523 |
style: import_prop_types$8.default.object, |
| 6524 |
children: import_prop_types$8.default.node, |
| 6525 |
src: import_prop_types$8.default.string.isRequired, |
| 6526 |
alt: import_prop_types$8.default.string.isRequired, |
| 6527 |
isLoading: import_prop_types$8.default.bool |
| 6528 |
}; |
| 6529 |
SingleImagePreview.Actions = Actions; |
| 6530 |
SingleImagePreview.Image = Image$1; |
| 6531 |
|
| 6532 |
//#endregion |
| 6533 |
//#region modules/ai/assets/js/editor/pages/form-media/components/images-display.js |
| 6534 |
init_extends(); |
| 6535 |
init_defineProperty$1(); |
| 6536 |
init_objectWithoutProperties$1(); |
| 6537 |
var _excluded$16 = ["children", "sx"]; |
| 6538 |
function ownKeys$18(e, r) { |
| 6539 |
var t = Object.keys(e); |
| 6540 |
if (Object.getOwnPropertySymbols) { |
| 6541 |
var o = Object.getOwnPropertySymbols(e); |
| 6542 |
r && (o = o.filter(function(r) { |
| 6543 |
return Object.getOwnPropertyDescriptor(e, r).enumerable; |
| 6544 |
})), t.push.apply(t, o); |
| 6545 |
} |
| 6546 |
return t; |
| 6547 |
} |
| 6548 |
__name(ownKeys$18, "ownKeys"); |
| 6549 |
function _objectSpread$18(e) { |
| 6550 |
for (var r = 1; r < arguments.length; r++) { |
| 6551 |
var t = null != arguments[r] ? arguments[r] : {}; |
| 6552 |
r % 2 ? ownKeys$18(Object(t), !0).forEach(function(r) { |
| 6553 |
_defineProperty$1(e, r, t[r]); |
| 6554 |
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$18(Object(t)).forEach(function(r) { |
| 6555 |
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); |
| 6556 |
}); |
| 6557 |
} |
| 6558 |
return e; |
| 6559 |
} |
| 6560 |
__name(_objectSpread$18, "_objectSpread"); |
| 6561 |
var Container = function Container(_ref) { |
| 6562 |
var children = _ref.children; |
| 6563 |
var _ref$sx = _ref.sx; |
| 6564 |
var sx = _ref$sx === void 0 ? {} : _ref$sx; |
| 6565 |
var props = _objectWithoutProperties$1(_ref, _excluded$16); |
| 6566 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, _extends$1({ flexGrow: 1 }, props, { sx: _objectSpread$18({ overflowY: "auto" }, sx) }), children); |
| 6567 |
}; |
| 6568 |
Container.propTypes = { |
| 6569 |
sx: import_prop_types$8.default.object, |
| 6570 |
children: import_prop_types$8.default.node |
| 6571 |
}; |
| 6572 |
var ImagesDisplay = function ImagesDisplay(_ref2) { |
| 6573 |
var images = _ref2.images; |
| 6574 |
var _ref2$aspectRatio = _ref2.aspectRatio; |
| 6575 |
var aspectRatio = _ref2$aspectRatio === void 0 ? "1:1" : _ref2$aspectRatio; |
| 6576 |
var _ref2$onUseImage = _ref2.onUseImage; |
| 6577 |
var onUseImage = _ref2$onUseImage === void 0 ? null : _ref2$onUseImage; |
| 6578 |
var _ref2$onEditImage = _ref2.onEditImage; |
| 6579 |
var onEditImage = _ref2$onEditImage === void 0 ? null : _ref2$onEditImage; |
| 6580 |
var _ref2$transparentCont = _ref2.transparentContainer; |
| 6581 |
var transparentContainer = _ref2$transparentCont === void 0 ? false : _ref2$transparentCont; |
| 6582 |
var _ref2$cols = _ref2.cols; |
| 6583 |
var cols = _ref2$cols === void 0 ? 2 : _ref2$cols; |
| 6584 |
var _ref2$overlay = _ref2.overlay; |
| 6585 |
var overlay = _ref2$overlay === void 0 ? true : _ref2$overlay; |
| 6586 |
var _ref2$onSelectChange = _ref2.onSelectChange; |
| 6587 |
var onSelectChange = _ref2$onSelectChange === void 0 ? null : _ref2$onSelectChange; |
| 6588 |
var _useImageNavigation = useImageNavigation(images); |
| 6589 |
var zoomIndex = _useImageNavigation.zoomIndex; |
| 6590 |
var setZoomIndex = _useImageNavigation.setZoomIndex; |
| 6591 |
var actions = _useImageNavigation.actions; |
| 6592 |
var _useImageSize = useImageSize(aspectRatio); |
| 6593 |
var width = _useImageSize.width; |
| 6594 |
var height = _useImageSize.height; |
| 6595 |
if (zoomIndex > -1) { |
| 6596 |
var currentImage = images[zoomIndex]; |
| 6597 |
return /*#__PURE__*/ react.default.createElement(Container, null, /*#__PURE__*/ react.default.createElement(ImageSlider, { |
| 6598 |
onPrev: actions.prev, |
| 6599 |
onNext: actions.next |
| 6600 |
}, /*#__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() { |
| 6601 |
return onEditImage(currentImage); |
| 6602 |
} }), onUseImage && /*#__PURE__*/ react.default.createElement(ImageActions.UseImage, { onClick: function onClick() { |
| 6603 |
return onUseImage(currentImage); |
| 6604 |
} })), /*#__PURE__*/ react.default.createElement(ImageSlider.Image, { |
| 6605 |
src: currentImage.image_url, |
| 6606 |
style: { |
| 6607 |
maxWidth: "630px", |
| 6608 |
width: "100%", |
| 6609 |
height: "auto" |
| 6610 |
} |
| 6611 |
}))); |
| 6612 |
} |
| 6613 |
if (1 === images.length) { |
| 6614 |
var image = images[0]; |
| 6615 |
var singleImageStyle = { |
| 6616 |
width, |
| 6617 |
height |
| 6618 |
}; |
| 6619 |
if (transparentContainer) { |
| 6620 |
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%)"; |
| 6621 |
singleImageStyle.backgroundSize = "20px 20px"; |
| 6622 |
singleImageStyle.backgroundPosition = "0 0, 0 10px, 10px -10px, -10px 0px"; |
| 6623 |
} |
| 6624 |
return /*#__PURE__*/ react.default.createElement(Container, { flexDirection: "column" }, /*#__PURE__*/ react.default.createElement(SingleImagePreview, null, /*#__PURE__*/ react.default.createElement(SingleImagePreview.Image, { |
| 6625 |
src: image.image_url || image.url, |
| 6626 |
style: singleImageStyle, |
| 6627 |
alt: "generated-image", |
| 6628 |
isLoading: image.isLoading |
| 6629 |
}, /*#__PURE__*/ react.default.createElement(SingleImagePreview.Actions, null, onEditImage && /*#__PURE__*/ react.default.createElement(ImageActions.EditImage, { onClick: function onClick() { |
| 6630 |
return onEditImage(image); |
| 6631 |
} }), onUseImage && /*#__PURE__*/ react.default.createElement(ImageActions.UseImage, { onClick: function onClick() { |
| 6632 |
return onUseImage(image); |
| 6633 |
} }))))); |
| 6634 |
} |
| 6635 |
return /*#__PURE__*/ react.default.createElement(Container, null, /*#__PURE__*/ react.default.createElement(Gallery, { cols }, images.map(function(image, index) { |
| 6636 |
return /*#__PURE__*/ react.default.createElement(Gallery.Image, { |
| 6637 |
key: "result-".concat(image.seed), |
| 6638 |
alt: "generated-".concat(index), |
| 6639 |
src: image.image_url, |
| 6640 |
aspectRatio, |
| 6641 |
"data-testid": "e-gallery-image", |
| 6642 |
numImagesInRow: cols, |
| 6643 |
overlay, |
| 6644 |
onSelectChange: onSelectChange ? function(isChecked) { |
| 6645 |
return onSelectChange(image.productId, isChecked); |
| 6646 |
} : null, |
| 6647 |
checkboxColor: image.checkboxColor, |
| 6648 |
initialChecked: image.isChecked, |
| 6649 |
isLoading: image.isLoading |
| 6650 |
}, /*#__PURE__*/ react.default.createElement(ImageActions, null, onUseImage && /*#__PURE__*/ react.default.createElement(ImageActions.UseImage, { |
| 6651 |
onClick: function onClick() { |
| 6652 |
return onUseImage(image); |
| 6653 |
}, |
| 6654 |
size: "medium", |
| 6655 |
fullWidth: true |
| 6656 |
}), /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, { |
| 6657 |
direction: "row", |
| 6658 |
spacing: .25, |
| 6659 |
alignItems: "center" |
| 6660 |
}, /*#__PURE__*/ react.default.createElement(ImageActions.ZoomIcon, { |
| 6661 |
onClick: function onClick() { |
| 6662 |
return setZoomIndex(index); |
| 6663 |
}, |
| 6664 |
size: "medium" |
| 6665 |
}), onEditImage && /*#__PURE__*/ react.default.createElement(ImageActions.EditIcon, { |
| 6666 |
onClick: function onClick() { |
| 6667 |
return onEditImage(image); |
| 6668 |
}, |
| 6669 |
size: "medium" |
| 6670 |
})))); |
| 6671 |
}))); |
| 6672 |
}; |
| 6673 |
ImagesDisplay.propTypes = { |
| 6674 |
images: import_prop_types$8.default.array, |
| 6675 |
aspectRatio: import_prop_types$8.default.string, |
| 6676 |
onUseImage: import_prop_types$8.default.func, |
| 6677 |
onEditImage: import_prop_types$8.default.func, |
| 6678 |
transparentContainer: import_prop_types$8.default.bool, |
| 6679 |
cols: import_prop_types$8.default.number, |
| 6680 |
overlay: import_prop_types$8.default.bool, |
| 6681 |
onSelectChange: import_prop_types$8.default.func |
| 6682 |
}; |
| 6683 |
ImagesDisplay.Container = Container; |
| 6684 |
|
| 6685 |
//#endregion |
| 6686 |
//#region modules/ai/assets/js/editor/pages/form-media/hooks/use-prompt-settings.js |
| 6687 |
init_defineProperty$1(); |
| 6688 |
init_slicedToArray(); |
| 6689 |
function ownKeys$17(e, r) { |
| 6690 |
var t = Object.keys(e); |
| 6691 |
if (Object.getOwnPropertySymbols) { |
| 6692 |
var o = Object.getOwnPropertySymbols(e); |
| 6693 |
r && (o = o.filter(function(r) { |
| 6694 |
return Object.getOwnPropertyDescriptor(e, r).enumerable; |
| 6695 |
})), t.push.apply(t, o); |
| 6696 |
} |
| 6697 |
return t; |
| 6698 |
} |
| 6699 |
__name(ownKeys$17, "ownKeys"); |
| 6700 |
function _objectSpread$17(e) { |
| 6701 |
for (var r = 1; r < arguments.length; r++) { |
| 6702 |
var t = null != arguments[r] ? arguments[r] : {}; |
| 6703 |
r % 2 ? ownKeys$17(Object(t), !0).forEach(function(r) { |
| 6704 |
_defineProperty$1(e, r, t[r]); |
| 6705 |
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$17(Object(t)).forEach(function(r) { |
| 6706 |
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); |
| 6707 |
}); |
| 6708 |
} |
| 6709 |
return e; |
| 6710 |
} |
| 6711 |
__name(_objectSpread$17, "_objectSpread"); |
| 6712 |
var IMAGE_TYPE = IMAGE_PROMPT_SETTINGS.IMAGE_TYPE; |
| 6713 |
var IMAGE_STYLE = IMAGE_PROMPT_SETTINGS.IMAGE_STYLE; |
| 6714 |
var IMAGE_STRENGTH = IMAGE_PROMPT_SETTINGS.IMAGE_STRENGTH; |
| 6715 |
var IMAGE_RATIO = IMAGE_PROMPT_SETTINGS.IMAGE_RATIO; |
| 6716 |
var IMAGE_ZOOM = IMAGE_PROMPT_SETTINGS.IMAGE_ZOOM; |
| 6717 |
var IMAGE_UPSCALE = IMAGE_PROMPT_SETTINGS.IMAGE_UPSCALE; |
| 6718 |
var IMAGE_BACKGROUND_COLOR = IMAGE_PROMPT_SETTINGS.IMAGE_BACKGROUND_COLOR; |
| 6719 |
var DEFAULT_TYPE = ""; |
| 6720 |
var DEFAULT_STYLE = ""; |
| 6721 |
var DEFAULT_STRENGTH = 0; |
| 6722 |
var DEFAULT_RATIO = "1:1"; |
| 6723 |
var DEFAULT_ZOOM = "1"; |
| 6724 |
var DEFAULT_UPSCALE = "512"; |
| 6725 |
var DEFAULT_COLOR = "#FFFFFF"; |
| 6726 |
var usePromptSettings = function usePromptSettings() { |
| 6727 |
var _ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; |
| 6728 |
var _ref$type = _ref.type; |
| 6729 |
var type = _ref$type === void 0 ? DEFAULT_TYPE : _ref$type; |
| 6730 |
var _ref$style = _ref.style; |
| 6731 |
var style = _ref$style === void 0 ? DEFAULT_STYLE : _ref$style; |
| 6732 |
var _ref$imageWeight = _ref.imageWeight; |
| 6733 |
var imageWeight = _ref$imageWeight === void 0 ? DEFAULT_STRENGTH : _ref$imageWeight; |
| 6734 |
var _ref$aspectRatio = _ref.aspectRatio; |
| 6735 |
var aspectRatio = _ref$aspectRatio === void 0 ? DEFAULT_RATIO : _ref$aspectRatio; |
| 6736 |
var _ref$zoom = _ref.zoom; |
| 6737 |
var zoom = _ref$zoom === void 0 ? DEFAULT_ZOOM : _ref$zoom; |
| 6738 |
var _ref$upScaleTo = _ref.upScaleTo; |
| 6739 |
var upScaleTo = _ref$upScaleTo === void 0 ? DEFAULT_UPSCALE : _ref$upScaleTo; |
| 6740 |
var _ref$bgColor = _ref.bgColor; |
| 6741 |
var bgColor = _ref$bgColor === void 0 ? DEFAULT_COLOR : _ref$bgColor; |
| 6742 |
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); |
| 6743 |
var settings = _useState2[0]; |
| 6744 |
var setSettings = _useState2[1]; |
| 6745 |
return { |
| 6746 |
settings, |
| 6747 |
updateSettings: function updateSettings(updated) { |
| 6748 |
return setSettings(function(prev) { |
| 6749 |
return _objectSpread$17(_objectSpread$17({}, prev), updated); |
| 6750 |
}); |
| 6751 |
}, |
| 6752 |
resetSettings: function resetSettings() { |
| 6753 |
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)); |
| 6754 |
} |
| 6755 |
}; |
| 6756 |
}; |
| 6757 |
|
| 6758 |
//#endregion |
| 6759 |
//#region modules/ai/assets/js/editor/hooks/use-images-preload.js |
| 6760 |
init_slicedToArray(); |
| 6761 |
var loadImage$1 = function loadImage(url) { |
| 6762 |
return new Promise(function(resolve, reject) { |
| 6763 |
var loadImg = new Image(); |
| 6764 |
loadImg.src = url; |
| 6765 |
loadImg.onload = function() { |
| 6766 |
return resolve(url); |
| 6767 |
}; |
| 6768 |
loadImg.onerror = function(err) { |
| 6769 |
return reject(err); |
| 6770 |
}; |
| 6771 |
}); |
| 6772 |
}; |
| 6773 |
var useImagesPreload = function useImagesPreload() { |
| 6774 |
var _useState2 = _slicedToArray((0, react.useState)(false), 2); |
| 6775 |
var ready = _useState2[0]; |
| 6776 |
var setReady = _useState2[1]; |
| 6777 |
return { |
| 6778 |
ready, |
| 6779 |
preloadImages: function preloadImages(images) { |
| 6780 |
setReady(false); |
| 6781 |
Promise.all(images.map(function(url) { |
| 6782 |
return loadImage$1(url); |
| 6783 |
})).then(function() { |
| 6784 |
return setReady(true); |
| 6785 |
}).catch(function(err) { |
| 6786 |
return console.log("Failed to load images", err); |
| 6787 |
}); |
| 6788 |
} |
| 6789 |
}; |
| 6790 |
}; |
| 6791 |
|
| 6792 |
//#endregion |
| 6793 |
//#region modules/ai/assets/js/editor/pages/form-media/views/generate/hooks/use-suggested-images.js |
| 6794 |
init_slicedToArray(); |
| 6795 |
var shuffleImages = function shuffleImages(images) { |
| 6796 |
return images.map(function(image) { |
| 6797 |
return [Math.random(), image]; |
| 6798 |
}).sort(function(_ref, _ref2) { |
| 6799 |
return _slicedToArray(_ref, 1)[0] - _slicedToArray(_ref2, 1)[0]; |
| 6800 |
}).map(function(_ref5) { |
| 6801 |
return _slicedToArray(_ref5, 2)[1]; |
| 6802 |
}); |
| 6803 |
}; |
| 6804 |
var checkImageTypeIgnoreStyle = function checkImageTypeIgnoreStyle(imageType, selectedType) { |
| 6805 |
return _slicedToArray(imageType.split("/"), 1)[0] === selectedType; |
| 6806 |
}; |
| 6807 |
var useSuggestedImages = function useSuggestedImages(_ref7) { |
| 6808 |
var selectedType = _ref7.selectedType; |
| 6809 |
var _useState2 = _slicedToArray((0, react.useState)(false), 2); |
| 6810 |
var isLoading = _useState2[0]; |
| 6811 |
var setIsLoading = _useState2[1]; |
| 6812 |
var _useState4 = _slicedToArray((0, react.useState)({ images: [] }), 2); |
| 6813 |
var data = _useState4[0]; |
| 6814 |
var setImagesState = _useState4[1]; |
| 6815 |
var _useImagesPreload = useImagesPreload(); |
| 6816 |
var ready = _useImagesPreload.ready; |
| 6817 |
var preloadImages = _useImagesPreload.preloadImages; |
| 6818 |
var imagesData = (0, react.useMemo)(function() { |
| 6819 |
var shuffledImages = shuffleImages(data.images); |
| 6820 |
if (!selectedType) return shuffledImages; |
| 6821 |
var categoryImages = shuffledImages.filter(function(_ref8) { |
| 6822 |
var imageType = _ref8.imageType; |
| 6823 |
return checkImageTypeIgnoreStyle(imageType, selectedType); |
| 6824 |
}); |
| 6825 |
return categoryImages.length ? categoryImages : shuffledImages; |
| 6826 |
}, [selectedType, data]); |
| 6827 |
var fetchImages = function fetchImages() { |
| 6828 |
setIsLoading(true); |
| 6829 |
fetch("https://my.elementor.com/ai/images-prompt-gallery/ai-gallery.json").then(function(response) { |
| 6830 |
return response.json(); |
| 6831 |
}).then(function(json) { |
| 6832 |
return setImagesState(json); |
| 6833 |
}).catch(function(e) { |
| 6834 |
return console.log(e.message); |
| 6835 |
}).finally(function() { |
| 6836 |
return setIsLoading(false); |
| 6837 |
}); |
| 6838 |
}; |
| 6839 |
(0, react.useEffect)(function() { |
| 6840 |
if (0 === (data === null || data === void 0 ? void 0 : data.images.length)) { |
| 6841 |
fetchImages(); |
| 6842 |
return; |
| 6843 |
} |
| 6844 |
preloadImages(data.images.map(function(_ref9) { |
| 6845 |
return _ref9.thumbnailUrl; |
| 6846 |
})); |
| 6847 |
}, [data]); |
| 6848 |
return { |
| 6849 |
imagesData, |
| 6850 |
isLoading: !ready || isLoading |
| 6851 |
}; |
| 6852 |
}; |
| 6853 |
|
| 6854 |
//#endregion |
| 6855 |
//#region modules/ai/assets/js/editor/pages/form-media/utils/index.js |
| 6856 |
init_asyncToGenerator(); |
| 6857 |
init_defineProperty$1(); |
| 6858 |
init_slicedToArray(); |
| 6859 |
function ownKeys$16(e, r) { |
| 6860 |
var t = Object.keys(e); |
| 6861 |
if (Object.getOwnPropertySymbols) { |
| 6862 |
var o = Object.getOwnPropertySymbols(e); |
| 6863 |
r && (o = o.filter(function(r) { |
| 6864 |
return Object.getOwnPropertyDescriptor(e, r).enumerable; |
| 6865 |
})), t.push.apply(t, o); |
| 6866 |
} |
| 6867 |
return t; |
| 6868 |
} |
| 6869 |
__name(ownKeys$16, "ownKeys"); |
| 6870 |
function _objectSpread$16(e) { |
| 6871 |
for (var r = 1; r < arguments.length; r++) { |
| 6872 |
var t = null != arguments[r] ? arguments[r] : {}; |
| 6873 |
r % 2 ? ownKeys$16(Object(t), !0).forEach(function(r) { |
| 6874 |
_defineProperty$1(e, r, t[r]); |
| 6875 |
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$16(Object(t)).forEach(function(r) { |
| 6876 |
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); |
| 6877 |
}); |
| 6878 |
} |
| 6879 |
return e; |
| 6880 |
} |
| 6881 |
__name(_objectSpread$16, "_objectSpread"); |
| 6882 |
var getAspectRatioSizes = function getAspectRatioSizes(width, height) { |
| 6883 |
var aspectRatios = Object.keys(IMAGE_ASPECT_RATIO); |
| 6884 |
var targetRatio = width / height; |
| 6885 |
var closestRatio = aspectRatios[0]; |
| 6886 |
var minDiff = Infinity; |
| 6887 |
aspectRatios.forEach(function(ratio) { |
| 6888 |
var _ratio$split$map2 = _slicedToArray(ratio.split(":").map(Number), 2); |
| 6889 |
var w = _ratio$split$map2[0]; |
| 6890 |
var h = _ratio$split$map2[1]; |
| 6891 |
var diff = Math.abs(targetRatio - w / h); |
| 6892 |
if (diff < minDiff) { |
| 6893 |
minDiff = diff; |
| 6894 |
closestRatio = ratio; |
| 6895 |
} |
| 6896 |
}); |
| 6897 |
return _objectSpread$16({ ratio: closestRatio }, IMAGE_ASPECT_RATIO[closestRatio]); |
| 6898 |
}; |
| 6899 |
var fetchImageAsBase64 = /*#__PURE__*/ function() { |
| 6900 |
var _ref = _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee(url) { |
| 6901 |
var response; |
| 6902 |
var blob; |
| 6903 |
var reader; |
| 6904 |
var _t; |
| 6905 |
return import_regenerator$2.default.wrap(function(_context) { |
| 6906 |
while (1) switch (_context.prev = _context.next) { |
| 6907 |
case 0: |
| 6908 |
_context.prev = 0; |
| 6909 |
_context.next = 1; |
| 6910 |
return fetch(url); |
| 6911 |
case 1: |
| 6912 |
response = _context.sent; |
| 6913 |
_context.next = 2; |
| 6914 |
return response.blob(); |
| 6915 |
case 2: |
| 6916 |
blob = _context.sent; |
| 6917 |
reader = new FileReader(); |
| 6918 |
return _context.abrupt("return", new Promise(function(resolve, reject) { |
| 6919 |
reader.onloadend = function() { |
| 6920 |
resolve(reader.result); |
| 6921 |
}; |
| 6922 |
reader.onerror = reject; |
| 6923 |
reader.readAsDataURL(blob); |
| 6924 |
})); |
| 6925 |
case 3: |
| 6926 |
_context.prev = 3; |
| 6927 |
_t = _context["catch"](0); |
| 6928 |
throw _t; |
| 6929 |
case 4: |
| 6930 |
case "end": return _context.stop(); |
| 6931 |
} |
| 6932 |
}, _callee, null, [[0, 3]]); |
| 6933 |
})); |
| 6934 |
return function fetchImageAsBase64(_x) { |
| 6935 |
return _ref.apply(this, arguments); |
| 6936 |
}; |
| 6937 |
}(); |
| 6938 |
|
| 6939 |
//#endregion |
| 6940 |
//#region modules/ai/assets/js/editor/pages/form-media/context/edit-image-context.js |
| 6941 |
init_slicedToArray(); |
| 6942 |
init_defineProperty$1(); |
| 6943 |
function ownKeys$15(e, r) { |
| 6944 |
var t = Object.keys(e); |
| 6945 |
if (Object.getOwnPropertySymbols) { |
| 6946 |
var o = Object.getOwnPropertySymbols(e); |
| 6947 |
r && (o = o.filter(function(r) { |
| 6948 |
return Object.getOwnPropertyDescriptor(e, r).enumerable; |
| 6949 |
})), t.push.apply(t, o); |
| 6950 |
} |
| 6951 |
return t; |
| 6952 |
} |
| 6953 |
__name(ownKeys$15, "ownKeys"); |
| 6954 |
function _objectSpread$15(e) { |
| 6955 |
for (var r = 1; r < arguments.length; r++) { |
| 6956 |
var t = null != arguments[r] ? arguments[r] : {}; |
| 6957 |
r % 2 ? ownKeys$15(Object(t), !0).forEach(function(r) { |
| 6958 |
_defineProperty$1(e, r, t[r]); |
| 6959 |
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$15(Object(t)).forEach(function(r) { |
| 6960 |
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); |
| 6961 |
}); |
| 6962 |
} |
| 6963 |
return e; |
| 6964 |
} |
| 6965 |
__name(_objectSpread$15, "_objectSpread"); |
| 6966 |
var EditImageContext = (0, react.createContext)({}); |
| 6967 |
var SET_STATE = "SET_STATE"; |
| 6968 |
var SET_ASPECT_RATIO = "SET_ASPECT_RATIO"; |
| 6969 |
var SET_LOADING = "SET_LOADING"; |
| 6970 |
var RESET = "RESET"; |
| 6971 |
var initialValue = { |
| 6972 |
id: "", |
| 6973 |
url: "", |
| 6974 |
isLoading: false, |
| 6975 |
aspectRatio: "1:1" |
| 6976 |
}; |
| 6977 |
var reducer$1 = function reducer(state, _ref) { |
| 6978 |
var type = _ref.type; |
| 6979 |
var payload = _ref.payload; |
| 6980 |
switch (type) { |
| 6981 |
case SET_STATE: return _objectSpread$15(_objectSpread$15({}, state), payload); |
| 6982 |
case SET_ASPECT_RATIO: return _objectSpread$15(_objectSpread$15({}, state), {}, { aspectRatio: payload }); |
| 6983 |
case SET_LOADING: return _objectSpread$15(_objectSpread$15({}, state), {}, { isLoading: payload }); |
| 6984 |
case RESET: return initialValue; |
| 6985 |
default: throw Error("Unknown action."); |
| 6986 |
} |
| 6987 |
}; |
| 6988 |
var EditImageProvider = function EditImageProvider(_ref2) { |
| 6989 |
var children = _ref2.children; |
| 6990 |
var imageData = _ref2.imageData; |
| 6991 |
var _useReducer2 = _slicedToArray((0, react.useReducer)(reducer$1, _objectSpread$15(_objectSpread$15({}, initialValue), imageData)), 2); |
| 6992 |
var state = _useReducer2[0]; |
| 6993 |
var dispatch = _useReducer2[1]; |
| 6994 |
return /*#__PURE__*/ react.default.createElement(EditImageContext.Provider, { value: { |
| 6995 |
state, |
| 6996 |
dispatch |
| 6997 |
} }, children); |
| 6998 |
}; |
| 6999 |
EditImageProvider.propTypes = { |
| 7000 |
children: import_prop_types$8.default.node, |
| 7001 |
imageData: import_prop_types$8.default.object |
| 7002 |
}; |
| 7003 |
var useEditImage = function useEditImage() { |
| 7004 |
var _useContext = (0, react.useContext)(EditImageContext); |
| 7005 |
var state = _useContext.state; |
| 7006 |
var dispatch = _useContext.dispatch; |
| 7007 |
var id = state.id; |
| 7008 |
var url = state.url; |
| 7009 |
var aspectRatio = state.aspectRatio; |
| 7010 |
var isLoading = state.isLoading; |
| 7011 |
var _useImageSize = useImageSize(aspectRatio); |
| 7012 |
var width = _useImageSize.width; |
| 7013 |
var height = _useImageSize.height; |
| 7014 |
var setEditImage = function setEditImage(payload) { |
| 7015 |
return dispatch({ |
| 7016 |
type: SET_STATE, |
| 7017 |
payload |
| 7018 |
}); |
| 7019 |
}; |
| 7020 |
var setAspectRatio = function setAspectRatio(payload) { |
| 7021 |
return dispatch({ |
| 7022 |
type: SET_ASPECT_RATIO, |
| 7023 |
payload |
| 7024 |
}); |
| 7025 |
}; |
| 7026 |
var reset = function reset() { |
| 7027 |
return dispatch({ type: RESET }); |
| 7028 |
}; |
| 7029 |
(0, react.useEffect)(function() { |
| 7030 |
if (!id) return; |
| 7031 |
dispatch({ |
| 7032 |
type: SET_LOADING, |
| 7033 |
payload: true |
| 7034 |
}); |
| 7035 |
var img = new Image(); |
| 7036 |
img.src = url; |
| 7037 |
img.onload = function() { |
| 7038 |
var ratio = getAspectRatioSizes(img.width, img.height).ratio; |
| 7039 |
dispatch({ |
| 7040 |
type: SET_STATE, |
| 7041 |
payload: { |
| 7042 |
aspectRatio: ratio, |
| 7043 |
isLoading: false |
| 7044 |
} |
| 7045 |
}); |
| 7046 |
}; |
| 7047 |
}, [id]); |
| 7048 |
return { |
| 7049 |
editImage: state, |
| 7050 |
isLoading, |
| 7051 |
aspectRatio, |
| 7052 |
width, |
| 7053 |
height, |
| 7054 |
setEditImage, |
| 7055 |
setAspectRatio, |
| 7056 |
reset |
| 7057 |
}; |
| 7058 |
}; |
| 7059 |
|
| 7060 |
//#endregion |
| 7061 |
//#region modules/ai/assets/js/editor/pages/form-media/hooks/use-image-upload.js |
| 7062 |
init_slicedToArray(); |
| 7063 |
init_api(); |
| 7064 |
var useImageUpload = function useImageUpload() { |
| 7065 |
var _useState2 = _slicedToArray((0, react.useState)(false), 2); |
| 7066 |
var isUploading = _useState2[0]; |
| 7067 |
var setIsUploading = _useState2[1]; |
| 7068 |
var _useState4 = _slicedToArray((0, react.useState)(""), 2); |
| 7069 |
var uploadError = _useState4[0]; |
| 7070 |
var setUploadError = _useState4[1]; |
| 7071 |
var _useState6 = _slicedToArray((0, react.useState)({}), 2); |
| 7072 |
var attachmentData = _useState6[0]; |
| 7073 |
var setAttachmentData = _useState6[1]; |
| 7074 |
return { |
| 7075 |
upload: function upload(_ref) { |
| 7076 |
var image = _ref.image; |
| 7077 |
var prompt = _ref.prompt; |
| 7078 |
return new Promise(function(resolve, reject) { |
| 7079 |
setUploadError(""); |
| 7080 |
setAttachmentData({}); |
| 7081 |
setIsUploading(true); |
| 7082 |
uploadImage({ |
| 7083 |
image, |
| 7084 |
prompt |
| 7085 |
}).then(function(result) { |
| 7086 |
setAttachmentData(result); |
| 7087 |
resolve(result); |
| 7088 |
}).catch(function(err) { |
| 7089 |
var error = (err === null || err === void 0 ? void 0 : err.responseText) || err; |
| 7090 |
setUploadError(error); |
| 7091 |
reject(error); |
| 7092 |
}).finally(function() { |
| 7093 |
return setIsUploading(false); |
| 7094 |
}); |
| 7095 |
}); |
| 7096 |
}, |
| 7097 |
resetUpload: function resetUpload() { |
| 7098 |
setUploadError(""); |
| 7099 |
setAttachmentData({}); |
| 7100 |
setIsUploading(false); |
| 7101 |
}, |
| 7102 |
isUploading, |
| 7103 |
uploadError, |
| 7104 |
attachmentData |
| 7105 |
}; |
| 7106 |
}; |
| 7107 |
|
| 7108 |
//#endregion |
| 7109 |
//#region modules/ai/assets/js/editor/pages/form-media/context/global-actions-context.js |
| 7110 |
var GlobalActionsContext = (0, react.createContext)({}); |
| 7111 |
var GlobalActionsProvider = function GlobalActionsProvider(_ref) { |
| 7112 |
var actions = _ref.actions; |
| 7113 |
var children = _ref.children; |
| 7114 |
return /*#__PURE__*/ react.default.createElement(GlobalActionsContext.Provider, { value: actions }, children); |
| 7115 |
}; |
| 7116 |
GlobalActionsProvider.propTypes = { |
| 7117 |
actions: import_prop_types$8.default.object, |
| 7118 |
children: import_prop_types$8.default.node |
| 7119 |
}; |
| 7120 |
var useGlobalActions = function useGlobalActions() { |
| 7121 |
return (0, react.useContext)(GlobalActionsContext); |
| 7122 |
}; |
| 7123 |
|
| 7124 |
//#endregion |
| 7125 |
//#region assets/dev/js/editor/utils/files-upload-handler.js |
| 7126 |
var FilesUploadHandler = /*#__PURE__*/ function() { |
| 7127 |
function FilesUploadHandler() { |
| 7128 |
_classCallCheck(this, FilesUploadHandler); |
| 7129 |
} |
| 7130 |
return _createClass(FilesUploadHandler, null, [ |
| 7131 |
{ |
| 7132 |
key: "isUploadEnabled", |
| 7133 |
value: function isUploadEnabled(mediaType) { |
| 7134 |
if (!["svg", "application/json"].includes(mediaType)) return true; |
| 7135 |
return elementorCommon.config.filesUpload.unfilteredFiles; |
| 7136 |
} |
| 7137 |
}, |
| 7138 |
{ |
| 7139 |
key: "setUploadTypeCaller", |
| 7140 |
value: function setUploadTypeCaller(frame) { |
| 7141 |
frame.uploader.uploader.param("uploadTypeCaller", "elementor-wp-media-upload"); |
| 7142 |
} |
| 7143 |
}, |
| 7144 |
{ |
| 7145 |
key: "getUnfilteredFilesNonAdminDialog", |
| 7146 |
value: function getUnfilteredFilesNonAdminDialog() { |
| 7147 |
return elementorCommon.dialogsManager.createWidget("alert", { |
| 7148 |
id: "e-unfiltered-files-disabled-dialog", |
| 7149 |
headerMessage: (0, _wordpress_i18n.__)("Sorry, you can't upload that file yet", "elementor"), |
| 7150 |
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"), |
| 7151 |
strings: { confirm: (0, _wordpress_i18n.__)("Got it", "elementor") } |
| 7152 |
}); |
| 7153 |
} |
| 7154 |
}, |
| 7155 |
{ |
| 7156 |
key: "getUnfilteredFilesNotEnabledDialog", |
| 7157 |
value: function getUnfilteredFilesNotEnabledDialog(callback) { |
| 7158 |
var elementorInstance = window.elementorAdmin || window.elementor; |
| 7159 |
if (!elementorInstance.config.user.is_administrator) return this.getUnfilteredFilesNonAdminDialog(); |
| 7160 |
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() { |
| 7161 |
elementorCommon.ajax.addRequest("enable_unfiltered_files_upload", {}, true); |
| 7162 |
elementorCommon.config.filesUpload.unfilteredFiles = true; |
| 7163 |
callback(); |
| 7164 |
}); |
| 7165 |
} |
| 7166 |
}, |
| 7167 |
{ |
| 7168 |
key: "getUnfilteredFilesNotEnabledImportTemplateDialog", |
| 7169 |
value: function getUnfilteredFilesNotEnabledImportTemplateDialog(callback) { |
| 7170 |
if (!(window.elementorAdmin || window.elementor).config.user.is_administrator) return this.getUnfilteredFilesNonAdminDialog(); |
| 7171 |
return elementorCommon.dialogsManager.createWidget("confirm", { |
| 7172 |
id: "e-enable-unfiltered-files-dialog-import-template", |
| 7173 |
headerMessage: (0, _wordpress_i18n.__)("Enable Unfiltered File Uploads", "elementor"), |
| 7174 |
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"), |
| 7175 |
position: { |
| 7176 |
my: "center center", |
| 7177 |
at: "center center" |
| 7178 |
}, |
| 7179 |
strings: { |
| 7180 |
confirm: (0, _wordpress_i18n.__)("Enable and Import", "elementor"), |
| 7181 |
cancel: (0, _wordpress_i18n.__)("Import Without Enabling", "elementor") |
| 7182 |
}, |
| 7183 |
onConfirm: function onConfirm() { |
| 7184 |
elementorCommon.ajax.addRequest("enable_unfiltered_files_upload", { success: function success() { |
| 7185 |
elementorCommon.config.filesUpload.unfilteredFiles = true; |
| 7186 |
callback(); |
| 7187 |
} }, true); |
| 7188 |
}, |
| 7189 |
onCancel: function onCancel() { |
| 7190 |
return callback(); |
| 7191 |
} |
| 7192 |
}); |
| 7193 |
} |
| 7194 |
} |
| 7195 |
]); |
| 7196 |
}(); |
| 7197 |
|
| 7198 |
//#endregion |
| 7199 |
//#region modules/ai/assets/js/editor/pages/form-media/hooks/use-image-actions.js |
| 7200 |
init_objectWithoutProperties$1(); |
| 7201 |
init_asyncToGenerator(); |
| 7202 |
init_defineProperty$1(); |
| 7203 |
var _excluded$15 = ["image"]; |
| 7204 |
function ownKeys$14(e, r) { |
| 7205 |
var t = Object.keys(e); |
| 7206 |
if (Object.getOwnPropertySymbols) { |
| 7207 |
var o = Object.getOwnPropertySymbols(e); |
| 7208 |
r && (o = o.filter(function(r) { |
| 7209 |
return Object.getOwnPropertyDescriptor(e, r).enumerable; |
| 7210 |
})), t.push.apply(t, o); |
| 7211 |
} |
| 7212 |
return t; |
| 7213 |
} |
| 7214 |
__name(ownKeys$14, "ownKeys"); |
| 7215 |
function _objectSpread$14(e) { |
| 7216 |
for (var r = 1; r < arguments.length; r++) { |
| 7217 |
var t = null != arguments[r] ? arguments[r] : {}; |
| 7218 |
r % 2 ? ownKeys$14(Object(t), !0).forEach(function(r) { |
| 7219 |
_defineProperty$1(e, r, t[r]); |
| 7220 |
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$14(Object(t)).forEach(function(r) { |
| 7221 |
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); |
| 7222 |
}); |
| 7223 |
} |
| 7224 |
return e; |
| 7225 |
} |
| 7226 |
__name(_objectSpread$14, "_objectSpread"); |
| 7227 |
var normalizeImageData = function normalizeImageData(imageToUpload) { |
| 7228 |
if (!(imageToUpload !== null && imageToUpload !== void 0 && imageToUpload.imageUrl)) return imageToUpload; |
| 7229 |
return _objectSpread$14(_objectSpread$14({}, imageToUpload), {}, { |
| 7230 |
image_url: imageToUpload.imageUrl, |
| 7231 |
use_gallery_image: true |
| 7232 |
}); |
| 7233 |
}; |
| 7234 |
var useImageActions = function useImageActions() { |
| 7235 |
var _useEditImage = useEditImage(); |
| 7236 |
var editImage = _useEditImage.editImage; |
| 7237 |
var setEditImage = _useEditImage.setEditImage; |
| 7238 |
var _useGlobalActions = useGlobalActions(); |
| 7239 |
var setControlValue = _useGlobalActions.setControlValue; |
| 7240 |
var saveAndClose = _useGlobalActions.saveAndClose; |
| 7241 |
var _useImageUpload = useImageUpload(); |
| 7242 |
var attachmentData = _useImageUpload.attachmentData; |
| 7243 |
var isUploading = _useImageUpload.isUploading; |
| 7244 |
var uploadError = _useImageUpload.uploadError; |
| 7245 |
var uploadImage = _useImageUpload.upload; |
| 7246 |
var resetUpload = _useImageUpload.resetUpload; |
| 7247 |
var ensureSVGUploading = function ensureSVGUploading(imageUrl) { |
| 7248 |
if (!imageUrl) return true; |
| 7249 |
var imageExtension = new URL(imageUrl).pathname.split(".").pop(); |
| 7250 |
var isUploadAllowed = window._wpPluploadSettings.defaults.filters.mime_types[0].extensions.split(",").includes(imageExtension) || elementorCommon.config.filesUpload.unfilteredFiles; |
| 7251 |
if (!isUploadAllowed) { |
| 7252 |
var dialog = FilesUploadHandler.getUnfilteredFilesNotEnabledDialog(function() {}); |
| 7253 |
dialog.getElements("widget").css("z-index", "170001"); |
| 7254 |
dialog.show(); |
| 7255 |
} |
| 7256 |
return isUploadAllowed; |
| 7257 |
}; |
| 7258 |
var upload = function upload(imageToUpload, prompt) { |
| 7259 |
if (!ensureSVGUploading(imageToUpload.image_url)) return Promise.reject(/* @__PURE__ */ new Error("SVG Uploading is not allowed")); |
| 7260 |
return uploadImage({ |
| 7261 |
image: normalizeImageData(imageToUpload), |
| 7262 |
prompt: prompt || imageToUpload.prompt |
| 7263 |
}); |
| 7264 |
}; |
| 7265 |
var getFinalImage = /*#__PURE__*/ function() { |
| 7266 |
var _ref = _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee(imageToUpload, prompt) { |
| 7267 |
var isImageAlreadyUploaded; |
| 7268 |
var _result; |
| 7269 |
var result; |
| 7270 |
return import_regenerator$2.default.wrap(function(_context) { |
| 7271 |
while (1) switch (_context.prev = _context.next) { |
| 7272 |
case 0: |
| 7273 |
isImageAlreadyUploaded = editImage.url === imageToUpload.url; |
| 7274 |
if (!isImageAlreadyUploaded) { |
| 7275 |
_context.next = 1; |
| 7276 |
break; |
| 7277 |
} |
| 7278 |
editImage.image, _result = _objectWithoutProperties$1(editImage, _excluded$15); |
| 7279 |
return _context.abrupt("return", _result); |
| 7280 |
case 1: |
| 7281 |
_context.next = 2; |
| 7282 |
return upload(imageToUpload, prompt); |
| 7283 |
case 2: |
| 7284 |
result = _context.sent; |
| 7285 |
return _context.abrupt("return", result === null || result === void 0 ? void 0 : result.image); |
| 7286 |
case 3: |
| 7287 |
case "end": return _context.stop(); |
| 7288 |
} |
| 7289 |
}, _callee); |
| 7290 |
})); |
| 7291 |
return function getFinalImage(_x, _x2) { |
| 7292 |
return _ref.apply(this, arguments); |
| 7293 |
}; |
| 7294 |
}(); |
| 7295 |
return { |
| 7296 |
use: /* @__PURE__ */ function() { |
| 7297 |
var _ref3 = _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee3(imageToUpload, prompt) { |
| 7298 |
var result; |
| 7299 |
return import_regenerator$2.default.wrap(function(_context3) { |
| 7300 |
while (1) switch (_context3.prev = _context3.next) { |
| 7301 |
case 0: |
| 7302 |
_context3.next = 1; |
| 7303 |
return getFinalImage(imageToUpload, prompt); |
| 7304 |
case 1: |
| 7305 |
result = _context3.sent; |
| 7306 |
setControlValue(result); |
| 7307 |
saveAndClose(); |
| 7308 |
case 2: |
| 7309 |
case "end": return _context3.stop(); |
| 7310 |
} |
| 7311 |
}, _callee3); |
| 7312 |
})); |
| 7313 |
return function use(_x5, _x6) { |
| 7314 |
return _ref3.apply(this, arguments); |
| 7315 |
}; |
| 7316 |
}(), |
| 7317 |
edit: /* @__PURE__ */ function() { |
| 7318 |
var _ref2 = _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee2(imageToUpload, prompt) { |
| 7319 |
var result; |
| 7320 |
return import_regenerator$2.default.wrap(function(_context2) { |
| 7321 |
while (1) switch (_context2.prev = _context2.next) { |
| 7322 |
case 0: |
| 7323 |
_context2.next = 1; |
| 7324 |
return upload(imageToUpload, prompt); |
| 7325 |
case 1: |
| 7326 |
result = _context2.sent; |
| 7327 |
setEditImage(result.image); |
| 7328 |
case 2: |
| 7329 |
case "end": return _context2.stop(); |
| 7330 |
} |
| 7331 |
}, _callee2); |
| 7332 |
})); |
| 7333 |
return function edit(_x3, _x4) { |
| 7334 |
return _ref2.apply(this, arguments); |
| 7335 |
}; |
| 7336 |
}(), |
| 7337 |
reset: resetUpload, |
| 7338 |
error: uploadError, |
| 7339 |
data: attachmentData, |
| 7340 |
isLoading: isUploading, |
| 7341 |
useMultipleImages: /* @__PURE__ */ function() { |
| 7342 |
var _ref4 = _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee6(imagesToUpload) { |
| 7343 |
var results; |
| 7344 |
return import_regenerator$2.default.wrap(function(_context6) { |
| 7345 |
while (1) switch (_context6.prev = _context6.next) { |
| 7346 |
case 0: |
| 7347 |
_context6.next = 1; |
| 7348 |
return Promise.all(imagesToUpload.map(/*#__PURE__*/ function() { |
| 7349 |
var _ref5 = _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee4(img) { |
| 7350 |
return import_regenerator$2.default.wrap(function(_context4) { |
| 7351 |
while (1) switch (_context4.prev = _context4.next) { |
| 7352 |
case 0: |
| 7353 |
_context4.next = 1; |
| 7354 |
return getFinalImage(img, null).catch(function(_) { |
| 7355 |
return null; |
| 7356 |
}); |
| 7357 |
case 1: return _context4.abrupt("return", _context4.sent); |
| 7358 |
case 2: |
| 7359 |
case "end": return _context4.stop(); |
| 7360 |
} |
| 7361 |
}, _callee4); |
| 7362 |
})); |
| 7363 |
return function(_x8) { |
| 7364 |
return _ref5.apply(this, arguments); |
| 7365 |
}; |
| 7366 |
}())); |
| 7367 |
case 1: |
| 7368 |
results = _context6.sent; |
| 7369 |
_context6.next = 2; |
| 7370 |
return Promise.all(results.filter(function(result) { |
| 7371 |
return result; |
| 7372 |
}).map(/*#__PURE__*/ function() { |
| 7373 |
var _ref6 = _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee5(result) { |
| 7374 |
return import_regenerator$2.default.wrap(function(_context5) { |
| 7375 |
while (1) switch (_context5.prev = _context5.next) { |
| 7376 |
case 0: |
| 7377 |
_context5.next = 1; |
| 7378 |
return setControlValue(result); |
| 7379 |
case 1: return _context5.abrupt("return", _context5.sent); |
| 7380 |
case 2: |
| 7381 |
case "end": return _context5.stop(); |
| 7382 |
} |
| 7383 |
}, _callee5); |
| 7384 |
})); |
| 7385 |
return function(_x9) { |
| 7386 |
return _ref6.apply(this, arguments); |
| 7387 |
}; |
| 7388 |
}())); |
| 7389 |
case 2: |
| 7390 |
case "end": return _context6.stop(); |
| 7391 |
} |
| 7392 |
}, _callee6); |
| 7393 |
})); |
| 7394 |
return function useMultipleImages(_x7) { |
| 7395 |
return _ref4.apply(this, arguments); |
| 7396 |
}; |
| 7397 |
}() |
| 7398 |
}; |
| 7399 |
}; |
| 7400 |
|
| 7401 |
//#endregion |
| 7402 |
//#region modules/ai/assets/js/editor/pages/form-media/views/variations/components/images-placeholder.js |
| 7403 |
var ImagesPlaceholder = function ImagesPlaceholder() { |
| 7404 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, { |
| 7405 |
sx: { overflowY: "scroll" }, |
| 7406 |
flexGrow: 1 |
| 7407 |
}, /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, { |
| 7408 |
display: "grid", |
| 7409 |
gridTemplateColumns: "repeat(2, 1fr)", |
| 7410 |
gap: 3 |
| 7411 |
}, Array(4).fill(true).map(function(_, index) { |
| 7412 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, { |
| 7413 |
key: "placeholder-".concat(index), |
| 7414 |
display: "flex", |
| 7415 |
justifyContent: "center", |
| 7416 |
alignItems: "center", |
| 7417 |
sx: { |
| 7418 |
bgcolor: "action.selected", |
| 7419 |
height: 336 |
| 7420 |
} |
| 7421 |
}, /*#__PURE__*/ react.default.createElement(_elementor_icons.AIIcon, { |
| 7422 |
color: "secondary", |
| 7423 |
sx: { fontSize: 36 } |
| 7424 |
})); |
| 7425 |
}))); |
| 7426 |
}; |
| 7427 |
ImagesPlaceholder.propTypes = {}; |
| 7428 |
|
| 7429 |
//#endregion |
| 7430 |
//#region modules/ai/assets/js/editor/pages/form-media/views/generate/index.js |
| 7431 |
init_defineProperty$1(); |
| 7432 |
init_slicedToArray(); |
| 7433 |
init_prompt_history_action_context(); |
| 7434 |
init_prompt_library_link(); |
| 7435 |
init_requests_ids(); |
| 7436 |
function ownKeys$13(e, r) { |
| 7437 |
var t = Object.keys(e); |
| 7438 |
if (Object.getOwnPropertySymbols) { |
| 7439 |
var o = Object.getOwnPropertySymbols(e); |
| 7440 |
r && (o = o.filter(function(r) { |
| 7441 |
return Object.getOwnPropertyDescriptor(e, r).enumerable; |
| 7442 |
})), t.push.apply(t, o); |
| 7443 |
} |
| 7444 |
return t; |
| 7445 |
} |
| 7446 |
__name(ownKeys$13, "ownKeys"); |
| 7447 |
function _objectSpread$13(e) { |
| 7448 |
for (var r = 1; r < arguments.length; r++) { |
| 7449 |
var t = null != arguments[r] ? arguments[r] : {}; |
| 7450 |
r % 2 ? ownKeys$13(Object(t), !0).forEach(function(r) { |
| 7451 |
_defineProperty$1(e, r, t[r]); |
| 7452 |
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$13(Object(t)).forEach(function(r) { |
| 7453 |
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); |
| 7454 |
}); |
| 7455 |
} |
| 7456 |
return e; |
| 7457 |
} |
| 7458 |
__name(_objectSpread$13, "_objectSpread"); |
| 7459 |
var getPromptPlaceholder = function getPromptPlaceholder(images) { |
| 7460 |
if (!(images !== null && images !== void 0 && images.length)) return (0, _wordpress_i18n.__)("describe your image", "elementor"); |
| 7461 |
return images[Math.floor(Math.random() * images.length)].prompt; |
| 7462 |
}; |
| 7463 |
var Generate = function Generate(_ref) { |
| 7464 |
var textToImageHook = _ref.textToImageHook; |
| 7465 |
var _ref$predefinedPrompt = _ref.predefinedPrompt; |
| 7466 |
var predefinedPrompt = _ref$predefinedPrompt === void 0 ? "" : _ref$predefinedPrompt; |
| 7467 |
var _ref$initialSettings = _ref.initialSettings; |
| 7468 |
var initialSettings = _ref$initialSettings === void 0 ? {} : _ref$initialSettings; |
| 7469 |
var _useState2 = _slicedToArray((0, react.useState)(predefinedPrompt), 2); |
| 7470 |
var prompt = _useState2[0]; |
| 7471 |
var setPrompt = _useState2[1]; |
| 7472 |
var setGenerate = useRequestIds().setGenerate; |
| 7473 |
var initialImageType = useGlobalSettings().initialImageType; |
| 7474 |
var _usePromptSettings = usePromptSettings(_objectSpread$13({ type: initialImageType }, initialSettings)); |
| 7475 |
var settings = _usePromptSettings.settings; |
| 7476 |
var updateSettings = _usePromptSettings.updateSettings; |
| 7477 |
var resetSettings = _usePromptSettings.resetSettings; |
| 7478 |
var _useSuggestedImages = useSuggestedImages({ selectedType: settings[IMAGE_TYPE] }); |
| 7479 |
var suggestedImages = _useSuggestedImages.imagesData; |
| 7480 |
var isPreloading = _useSuggestedImages.isLoading; |
| 7481 |
var promptPlaceholder = getPromptPlaceholder(suggestedImages); |
| 7482 |
var _textToImageHook = textToImageHook({}); |
| 7483 |
var generatedImages = _textToImageHook.data; |
| 7484 |
var setResult = _textToImageHook.setResult; |
| 7485 |
var send = _textToImageHook.send; |
| 7486 |
var isGenerating = _textToImageHook.isLoading; |
| 7487 |
var error = _textToImageHook.error; |
| 7488 |
var reset = _textToImageHook.reset; |
| 7489 |
var _useImageActions = useImageActions(); |
| 7490 |
var use = _useImageActions.use; |
| 7491 |
var edit = _useImageActions.edit; |
| 7492 |
var isUploading = _useImageActions.isLoading; |
| 7493 |
var isLoading = isPreloading || isGenerating || isUploading; |
| 7494 |
var generateAspectRatio = (0, react.useMemo)(function() { |
| 7495 |
return settings[IMAGE_RATIO]; |
| 7496 |
}, [generatedImages === null || generatedImages === void 0 ? void 0 : generatedImages.result]); |
| 7497 |
var handleSubmit = function handleSubmit(event) { |
| 7498 |
event.preventDefault(); |
| 7499 |
setGenerate(); |
| 7500 |
if (!settings[IMAGE_STYLE]) settings[IMAGE_STYLE] = "general"; |
| 7501 |
send({ |
| 7502 |
prompt, |
| 7503 |
settings |
| 7504 |
}); |
| 7505 |
}; |
| 7506 |
var handleCopyPrompt = function handleCopyPrompt(_ref2) { |
| 7507 |
var selectedPrompt = _ref2.prompt; |
| 7508 |
var imageType = _ref2.imageType; |
| 7509 |
setPrompt(selectedPrompt); |
| 7510 |
var _imageType$split2 = _slicedToArray(imageType.split("/"), 2); |
| 7511 |
var type = _imageType$split2[0]; |
| 7512 |
var style = _imageType$split2[1]; |
| 7513 |
updateSettings(_defineProperty$1(_defineProperty$1({}, IMAGE_TYPE, type), IMAGE_STYLE, style)); |
| 7514 |
}; |
| 7515 |
useSubscribeOnPromptHistoryAction([{ |
| 7516 |
type: ACTION_TYPES.RESTORE, |
| 7517 |
handler: function handler(action) { |
| 7518 |
var _action$data; |
| 7519 |
var _action$data2; |
| 7520 |
var _action$data3; |
| 7521 |
var _action$data4; |
| 7522 |
handleCopyPrompt({ |
| 7523 |
prompt: (_action$data = action.data) === null || _action$data === void 0 ? void 0 : _action$data.prompt, |
| 7524 |
imageType: ((_action$data2 = action.data) === null || _action$data2 === void 0 ? void 0 : _action$data2.imageType) || "" |
| 7525 |
}); |
| 7526 |
updateSettings(_defineProperty$1({}, IMAGE_RATIO, (_action$data3 = action.data) === null || _action$data3 === void 0 ? void 0 : _action$data3.ratio)); |
| 7527 |
setResult((_action$data4 = action.data) === null || _action$data4 === void 0 ? void 0 : _action$data4.images, action.id); |
| 7528 |
} |
| 7529 |
}]); |
| 7530 |
return /*#__PURE__*/ react.default.createElement(View, null, /*#__PURE__*/ react.default.createElement(View.Panel, null, /*#__PURE__*/ react.default.createElement(View.PanelHeading, { |
| 7531 |
primary: (0, _wordpress_i18n.__)("Imagine anything create everything", "elementor"), |
| 7532 |
secondary: (0, _wordpress_i18n.__)("Generate images by selecting the desired type and style, and entering a prompt.", "elementor") |
| 7533 |
}), error && /*#__PURE__*/ react.default.createElement(View.ErrorMessage, { |
| 7534 |
error, |
| 7535 |
onRetry: handleSubmit |
| 7536 |
}), /*#__PURE__*/ react.default.createElement(ImageForm, { onSubmit: handleSubmit }, /*#__PURE__*/ react.default.createElement(PromptField, { |
| 7537 |
"data-testid": "e-image-prompt", |
| 7538 |
value: prompt, |
| 7539 |
disabled: isLoading, |
| 7540 |
placeholder: promptPlaceholder, |
| 7541 |
onChange: setPrompt |
| 7542 |
}), /*#__PURE__*/ react.default.createElement(ImageTypeSelect, { |
| 7543 |
disabled: isLoading, |
| 7544 |
value: settings[IMAGE_TYPE], |
| 7545 |
onChange: function onChange(event) { |
| 7546 |
return updateSettings(_defineProperty$1({}, IMAGE_TYPE, event.target.value)); |
| 7547 |
} |
| 7548 |
}), /*#__PURE__*/ react.default.createElement(ImageStyleSelect, { |
| 7549 |
type: settings[IMAGE_TYPE], |
| 7550 |
value: settings[IMAGE_STYLE], |
| 7551 |
disabled: isLoading || !settings[IMAGE_TYPE] || false, |
| 7552 |
onChange: function onChange(event) { |
| 7553 |
return updateSettings(_defineProperty$1({}, IMAGE_STYLE, event.target.value)); |
| 7554 |
} |
| 7555 |
}), /*#__PURE__*/ react.default.createElement(ImageRatioSelect, { |
| 7556 |
disabled: isLoading, |
| 7557 |
value: settings[IMAGE_RATIO], |
| 7558 |
onChange: function onChange(event) { |
| 7559 |
return updateSettings(_defineProperty$1({}, IMAGE_RATIO, event.target.value)); |
| 7560 |
} |
| 7561 |
}), generatedImages !== null && generatedImages !== void 0 && generatedImages.result ? /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, { |
| 7562 |
gap: 2, |
| 7563 |
sx: { my: 2.5 } |
| 7564 |
}, /*#__PURE__*/ react.default.createElement(GenerateAgainSubmit, { disabled: isLoading || "" === prompt }), /*#__PURE__*/ react.default.createElement(NewPromptButton, { |
| 7565 |
disabled: isLoading, |
| 7566 |
onClick: function onClick() { |
| 7567 |
resetSettings(); |
| 7568 |
setPrompt(""); |
| 7569 |
reset(); |
| 7570 |
} |
| 7571 |
})) : /*#__PURE__*/ react.default.createElement(GenerateImagesSubmit, { disabled: isLoading || "" === prompt }))), /*#__PURE__*/ react.default.createElement(View.Content, { |
| 7572 |
isLoading: isPreloading || isUploading, |
| 7573 |
isGenerating |
| 7574 |
}, generatedImages !== null && generatedImages !== void 0 && generatedImages.result ? /*#__PURE__*/ react.default.createElement(ImagesDisplay, { |
| 7575 |
images: generatedImages === null || generatedImages === void 0 ? void 0 : generatedImages.result, |
| 7576 |
aspectRatio: generateAspectRatio, |
| 7577 |
onUseImage: use, |
| 7578 |
onEditImage: edit |
| 7579 |
}) : /*#__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) { |
| 7580 |
return /*#__PURE__*/ react.default.createElement(Gallery.Image, { |
| 7581 |
variant: "thumbnail", |
| 7582 |
key: suggestedPrompt.prompt, |
| 7583 |
alt: suggestedPrompt.prompt, |
| 7584 |
text: suggestedPrompt.prompt, |
| 7585 |
src: suggestedPrompt.thumbnailUrl |
| 7586 |
}, /*#__PURE__*/ react.default.createElement(ImageActions, null, /*#__PURE__*/ react.default.createElement(ImageActions.UseImage, { |
| 7587 |
onClick: function onClick() { |
| 7588 |
return use(suggestedPrompt); |
| 7589 |
}, |
| 7590 |
fullWidth: true |
| 7591 |
}), /*#__PURE__*/ react.default.createElement(ImageActions.CopyIcon, { onClick: function onClick() { |
| 7592 |
return handleCopyPrompt(suggestedPrompt); |
| 7593 |
} }), /*#__PURE__*/ react.default.createElement(ImageActions.EditIcon, { onClick: function onClick() { |
| 7594 |
return edit(suggestedPrompt); |
| 7595 |
} }))); |
| 7596 |
})))))); |
| 7597 |
}; |
| 7598 |
Generate.propTypes = { |
| 7599 |
predefinedPrompt: import_prop_types$8.default.string, |
| 7600 |
textToImageHook: import_prop_types$8.default.func, |
| 7601 |
initialSettings: import_prop_types$8.default.object |
| 7602 |
}; |
| 7603 |
|
| 7604 |
//#endregion |
| 7605 |
//#region modules/ai/assets/js/editor/icons/expand-icon.js |
| 7606 |
init_extends(); |
| 7607 |
var ExpandIcon$1 = react.default.forwardRef(function(props, ref) { |
| 7608 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.SvgIcon, _extends$1({ viewBox: "0 0 24 24" }, props, { ref }), /*#__PURE__*/ react.default.createElement("path", { |
| 7609 |
fillRule: "evenodd", |
| 7610 |
clipRule: "evenodd", |
| 7611 |
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" |
| 7612 |
})); |
| 7613 |
}); |
| 7614 |
|
| 7615 |
//#endregion |
| 7616 |
//#region modules/ai/assets/js/editor/icons/brush-icon.js |
| 7617 |
init_extends(); |
| 7618 |
var BrushIcon = react.default.forwardRef(function(props, ref) { |
| 7619 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.SvgIcon, _extends$1({ viewBox: "0 0 24 24" }, props, { ref }), /*#__PURE__*/ react.default.createElement("path", { |
| 7620 |
fillRule: "evenodd", |
| 7621 |
clipRule: "evenodd", |
| 7622 |
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" |
| 7623 |
})); |
| 7624 |
}); |
| 7625 |
|
| 7626 |
//#endregion |
| 7627 |
//#region modules/ai/assets/js/editor/icons/evolve-icon.js |
| 7628 |
init_extends(); |
| 7629 |
var EvolveIcon = react.default.forwardRef(function(props, ref) { |
| 7630 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.SvgIcon, _extends$1({ viewBox: "0 0 24 24" }, props, { ref }), /*#__PURE__*/ react.default.createElement("path", { |
| 7631 |
fillRule: "evenodd", |
| 7632 |
clipRule: "evenodd", |
| 7633 |
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" |
| 7634 |
})); |
| 7635 |
}); |
| 7636 |
|
| 7637 |
//#endregion |
| 7638 |
//#region modules/ai/assets/js/editor/icons/enlarger-icon.js |
| 7639 |
init_extends(); |
| 7640 |
var ExpandIcon = react.default.forwardRef(function(props, ref) { |
| 7641 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.SvgIcon, _extends$1({ viewBox: "0 0 24 24" }, props, { ref }), /*#__PURE__*/ react.default.createElement("path", { |
| 7642 |
fillRule: "evenodd", |
| 7643 |
clipRule: "evenodd", |
| 7644 |
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" |
| 7645 |
})); |
| 7646 |
}); |
| 7647 |
|
| 7648 |
//#endregion |
| 7649 |
//#region modules/ai/assets/js/editor/icons/remove-bg.js |
| 7650 |
init_extends(); |
| 7651 |
var RemoveBackgroundIcon = react.default.forwardRef(function(props, ref) { |
| 7652 |
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" })); |
| 7653 |
}); |
| 7654 |
|
| 7655 |
//#endregion |
| 7656 |
//#region modules/ai/assets/js/editor/icons/replace-bg.js |
| 7657 |
init_extends(); |
| 7658 |
var ReplaceBackgroundIcon = react.default.forwardRef(function(props, ref) { |
| 7659 |
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" })); |
| 7660 |
}); |
| 7661 |
|
| 7662 |
//#endregion |
| 7663 |
//#region modules/ai/assets/js/editor/icons/cleanup-icon.js |
| 7664 |
init_extends(); |
| 7665 |
var Cleanup$1 = react.default.forwardRef(function(props, ref) { |
| 7666 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.SvgIcon, _extends$1({ viewBox: "0 0 16 16" }, props, { ref }), /*#__PURE__*/ react.default.createElement("path", { |
| 7667 |
fillRule: "evenodd", |
| 7668 |
clipRule: "evenodd", |
| 7669 |
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" |
| 7670 |
})); |
| 7671 |
}); |
| 7672 |
|
| 7673 |
//#endregion |
| 7674 |
//#region modules/ai/assets/js/editor/icons/isolate-object-icon.js |
| 7675 |
init_extends(); |
| 7676 |
var IsolateObjectIcon = react.default.forwardRef(function(props, ref) { |
| 7677 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.SvgIcon, _extends$1({ viewBox: "0 0 16 16" }, props, { ref }), /*#__PURE__*/ react.default.createElement("path", { |
| 7678 |
fillRule: "evenodd", |
| 7679 |
clipRule: "evenodd", |
| 7680 |
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" |
| 7681 |
})); |
| 7682 |
}); |
| 7683 |
|
| 7684 |
//#endregion |
| 7685 |
//#region modules/ai/assets/js/editor/pages/form-media/views/image-tools/image-tools-panel.js |
| 7686 |
init_use_introduction(); |
| 7687 |
var TeaserDrawing = function TeaserDrawing() { |
| 7688 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.SvgIcon, { |
| 7689 |
viewBox: "0 0 184 80", |
| 7690 |
sx: { |
| 7691 |
width: 184, |
| 7692 |
height: 80 |
| 7693 |
} |
| 7694 |
}, /*#__PURE__*/ react.default.createElement("g", { clipPath: "url(#clip0_3127_96542)" }, /*#__PURE__*/ react.default.createElement("path", { |
| 7695 |
fillRule: "evenodd", |
| 7696 |
clipRule: "evenodd", |
| 7697 |
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", |
| 7698 |
fill: "#69727D" |
| 7699 |
}), /*#__PURE__*/ react.default.createElement("path", { |
| 7700 |
fillRule: "evenodd", |
| 7701 |
clipRule: "evenodd", |
| 7702 |
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", |
| 7703 |
fill: "#69727D" |
| 7704 |
}), /*#__PURE__*/ react.default.createElement("path", { |
| 7705 |
d: "M53.9717 12L57.2198 17.0456L3.24796 51.4731L-0.000164873 46.4275L53.9717 12Z", |
| 7706 |
fill: "#69727D" |
| 7707 |
}), /*#__PURE__*/ react.default.createElement("path", { |
| 7708 |
d: "M64.9761 5L68.2242 10.0456L57.2612 17.0387L54.013 11.9931L64.9761 5Z", |
| 7709 |
fill: "#E6E8EA" |
| 7710 |
}), /*#__PURE__*/ react.default.createElement("path", { |
| 7711 |
fillRule: "evenodd", |
| 7712 |
clipRule: "evenodd", |
| 7713 |
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", |
| 7714 |
fill: "#69727D" |
| 7715 |
}), /*#__PURE__*/ react.default.createElement("path", { |
| 7716 |
fillRule: "evenodd", |
| 7717 |
clipRule: "evenodd", |
| 7718 |
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", |
| 7719 |
fill: "#69727D" |
| 7720 |
}), /*#__PURE__*/ react.default.createElement("path", { |
| 7721 |
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", |
| 7722 |
fill: "#E6E8EA" |
| 7723 |
}), /*#__PURE__*/ react.default.createElement("path", { |
| 7724 |
fillRule: "evenodd", |
| 7725 |
clipRule: "evenodd", |
| 7726 |
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", |
| 7727 |
fill: "#69727D" |
| 7728 |
}), /*#__PURE__*/ react.default.createElement("path", { |
| 7729 |
fillRule: "evenodd", |
| 7730 |
clipRule: "evenodd", |
| 7731 |
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", |
| 7732 |
fill: "#69727D" |
| 7733 |
}), /*#__PURE__*/ react.default.createElement("path", { |
| 7734 |
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", |
| 7735 |
fill: "#E6E8EA" |
| 7736 |
}), /*#__PURE__*/ react.default.createElement("path", { |
| 7737 |
fillRule: "evenodd", |
| 7738 |
clipRule: "evenodd", |
| 7739 |
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", |
| 7740 |
fill: "#69727D" |
| 7741 |
}), /*#__PURE__*/ react.default.createElement("path", { |
| 7742 |
fillRule: "evenodd", |
| 7743 |
clipRule: "evenodd", |
| 7744 |
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", |
| 7745 |
fill: "#69727D" |
| 7746 |
})), /*#__PURE__*/ react.default.createElement("defs", null, /*#__PURE__*/ react.default.createElement("clipPath", { id: "clip0_3127_96542" }, /*#__PURE__*/ react.default.createElement("rect", { |
| 7747 |
width: "184", |
| 7748 |
height: "80", |
| 7749 |
fill: "white" |
| 7750 |
})))); |
| 7751 |
}; |
| 7752 |
var ImageToolsContainer = (0, _elementor_ui.styled)(_elementor_ui.Box)(function(_ref) { |
| 7753 |
var theme = _ref.theme; |
| 7754 |
return { height: "calc(100% - ".concat(theme.spacing(13), ")") }; |
| 7755 |
}); |
| 7756 |
var ToolsTeaserContainer = (0, _elementor_ui.styled)(_elementor_ui.Box)(function(_ref2) { |
| 7757 |
return { |
| 7758 |
position: "sticky", |
| 7759 |
top: "100%", |
| 7760 |
padding: _ref2.theme.spacing(4, 0, 1) |
| 7761 |
}; |
| 7762 |
}); |
| 7763 |
var StyledChip = (0, _elementor_ui.styled)(_elementor_ui.Chip)(function() { |
| 7764 |
return { |
| 7765 |
position: "absolute", |
| 7766 |
top: 8, |
| 7767 |
right: 8, |
| 7768 |
"& .MuiChip-label": { |
| 7769 |
fontSize: "0.75rem", |
| 7770 |
fontWeight: "normal" |
| 7771 |
} |
| 7772 |
}; |
| 7773 |
}); |
| 7774 |
var ImageToolsPanel = function ImageToolsPanel() { |
| 7775 |
var navigate = useLocation().navigate; |
| 7776 |
var _useIntroduction = useIntroduction("e-ai-image-isolate-tool"); |
| 7777 |
var isIsolateViewed = _useIntroduction.isViewed; |
| 7778 |
var markIsolateAsViewed = _useIntroduction.markAsViewed; |
| 7779 |
var tools = [ |
| 7780 |
{ |
| 7781 |
label: (0, _wordpress_i18n.__)("Expand Image", "elementor"), |
| 7782 |
Icon: ExpandIcon$1, |
| 7783 |
onClick: function onClick() { |
| 7784 |
return navigate(LOCATIONS.OUT_PAINTING); |
| 7785 |
} |
| 7786 |
}, |
| 7787 |
{ |
| 7788 |
label: (0, _wordpress_i18n.__)("Generative Fill", "elementor"), |
| 7789 |
Icon: BrushIcon, |
| 7790 |
onClick: function onClick() { |
| 7791 |
return navigate(LOCATIONS.IN_PAINTING); |
| 7792 |
} |
| 7793 |
}, |
| 7794 |
{ |
| 7795 |
label: (0, _wordpress_i18n.__)("Resize", "elementor"), |
| 7796 |
Icon: ExpandIcon, |
| 7797 |
onClick: function onClick() { |
| 7798 |
return navigate(LOCATIONS.RESIZE); |
| 7799 |
} |
| 7800 |
}, |
| 7801 |
{ |
| 7802 |
label: (0, _wordpress_i18n.__)("Variations", "elementor"), |
| 7803 |
Icon: EvolveIcon, |
| 7804 |
onClick: function onClick() { |
| 7805 |
return navigate(LOCATIONS.VARIATIONS); |
| 7806 |
} |
| 7807 |
}, |
| 7808 |
{ |
| 7809 |
label: (0, _wordpress_i18n.__)("Remove Background", "elementor"), |
| 7810 |
Icon: RemoveBackgroundIcon, |
| 7811 |
onClick: function onClick() { |
| 7812 |
return navigate(LOCATIONS.REMOVE_BACKGROUND); |
| 7813 |
} |
| 7814 |
}, |
| 7815 |
{ |
| 7816 |
label: (0, _wordpress_i18n.__)("Replace Background", "elementor"), |
| 7817 |
Icon: ReplaceBackgroundIcon, |
| 7818 |
onClick: function onClick() { |
| 7819 |
return navigate(LOCATIONS.REPLACE_BACKGROUND); |
| 7820 |
} |
| 7821 |
}, |
| 7822 |
{ |
| 7823 |
label: (0, _wordpress_i18n.__)("Cleanup", "elementor"), |
| 7824 |
Icon: Cleanup$1, |
| 7825 |
onClick: function onClick() { |
| 7826 |
return navigate(LOCATIONS.CLEANUP); |
| 7827 |
} |
| 7828 |
}, |
| 7829 |
{ |
| 7830 |
label: (0, _wordpress_i18n.__)("Isolate object", "elementor"), |
| 7831 |
Icon: IsolateObjectIcon, |
| 7832 |
ChipParam: !isIsolateViewed ? /*#__PURE__*/ react.default.createElement(StyledChip, { |
| 7833 |
label: "New", |
| 7834 |
color: "info", |
| 7835 |
variant: "standard", |
| 7836 |
size: "tiny" |
| 7837 |
}) : null, |
| 7838 |
onClick: function onClick() { |
| 7839 |
markIsolateAsViewed(); |
| 7840 |
navigate(LOCATIONS.ISOLATE_OBJECT); |
| 7841 |
} |
| 7842 |
} |
| 7843 |
]; |
| 7844 |
return /*#__PURE__*/ react.default.createElement(ImageToolsContainer, null, /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, { |
| 7845 |
display: "grid", |
| 7846 |
gridTemplateColumns: "repeat(2, 1fr)", |
| 7847 |
gap: 1, |
| 7848 |
justifyContent: "center" |
| 7849 |
}, tools.map(function(_ref3) { |
| 7850 |
var label = _ref3.label; |
| 7851 |
var Icon = _ref3.Icon; |
| 7852 |
var ChipParam = _ref3.ChipParam; |
| 7853 |
var onClick = _ref3.onClick; |
| 7854 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Button, { |
| 7855 |
onClick, |
| 7856 |
key: label, |
| 7857 |
variant: "outlined", |
| 7858 |
color: "secondary", |
| 7859 |
disabled: false, |
| 7860 |
sx: { |
| 7861 |
py: 3, |
| 7862 |
fontSize: "12px", |
| 7863 |
height: "auto", |
| 7864 |
borderRadius: "4px" |
| 7865 |
} |
| 7866 |
}, ChipParam, /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, { |
| 7867 |
display: "flex", |
| 7868 |
justifyContent: "center", |
| 7869 |
alignItems: "center", |
| 7870 |
flexDirection: "column" |
| 7871 |
}, /*#__PURE__*/ react.default.createElement(Icon, { sx: { mb: .5 } }), label)); |
| 7872 |
})), /*#__PURE__*/ react.default.createElement(ToolsTeaserContainer, { |
| 7873 |
display: "flex", |
| 7874 |
flexDirection: "column", |
| 7875 |
alignItems: "center" |
| 7876 |
}, /*#__PURE__*/ react.default.createElement(TeaserDrawing, null), /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, { |
| 7877 |
variant: "body2", |
| 7878 |
align: "center", |
| 7879 |
color: "secondary", |
| 7880 |
sx: { mt: 2 } |
| 7881 |
}, (0, _wordpress_i18n.__)("Stay tuned! More incredible AI tools are coming your way soon.", "elementor")))); |
| 7882 |
}; |
| 7883 |
ImageToolsPanel.propTypes = { |
| 7884 |
generateNewPrompt: import_prop_types$8.default.func, |
| 7885 |
panelActive: import_prop_types$8.default.bool |
| 7886 |
}; |
| 7887 |
|
| 7888 |
//#endregion |
| 7889 |
//#region modules/ai/assets/js/editor/pages/form-media/views/image-tools/image-tools-content.js |
| 7890 |
var ImageToolsContent = function ImageToolsContent() { |
| 7891 |
var _useEditImage = useEditImage(); |
| 7892 |
var editImage = _useEditImage.editImage; |
| 7893 |
var width = _useEditImage.width; |
| 7894 |
var height = _useEditImage.height; |
| 7895 |
var use = useImageActions().use; |
| 7896 |
return /*#__PURE__*/ react.default.createElement(SingleImagePreview, null, /*#__PURE__*/ react.default.createElement(SingleImagePreview.Image, { |
| 7897 |
src: editImage.url, |
| 7898 |
style: { |
| 7899 |
width, |
| 7900 |
height |
| 7901 |
}, |
| 7902 |
alt: editImage.alt || (0, _wordpress_i18n.__)("Image preview", "elementor") |
| 7903 |
}, /*#__PURE__*/ react.default.createElement(SingleImagePreview.Actions, null, /*#__PURE__*/ react.default.createElement(ImageActions.UseImage, { onClick: function onClick() { |
| 7904 |
return use(editImage); |
| 7905 |
} })))); |
| 7906 |
}; |
| 7907 |
|
| 7908 |
//#endregion |
| 7909 |
//#region modules/ai/assets/js/editor/pages/form-media/views/image-tools/index.js |
| 7910 |
var ImageTools = function ImageTools() { |
| 7911 |
var navigate = useLocation().navigate; |
| 7912 |
return /*#__PURE__*/ react.default.createElement(View, null, /*#__PURE__*/ react.default.createElement(View.Panel, null, /*#__PURE__*/ react.default.createElement(View.BackButton, { onClick: function onClick() { |
| 7913 |
return navigate(LOCATIONS.GENERATE); |
| 7914 |
} }, (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))); |
| 7915 |
}; |
| 7916 |
|
| 7917 |
//#endregion |
| 7918 |
//#region modules/ai/assets/js/editor/pages/form-media/components/generate-submit.js |
| 7919 |
init_extends(); |
| 7920 |
var GenerateSubmit = function GenerateSubmit(props) { |
| 7921 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Button, _extends$1({ |
| 7922 |
fullWidth: true, |
| 7923 |
size: "medium", |
| 7924 |
type: "submit", |
| 7925 |
variant: "contained" |
| 7926 |
}, props), props.children || (0, _wordpress_i18n.__)("Generate", "elementor")); |
| 7927 |
}; |
| 7928 |
GenerateSubmit.propTypes = { children: import_prop_types$8.default.node }; |
| 7929 |
|
| 7930 |
//#endregion |
| 7931 |
//#region modules/ai/assets/js/editor/pages/form-media/hooks/use-image-prompt.js |
| 7932 |
init_use_prompt(); |
| 7933 |
var useImagePrompt = function useImagePrompt() { |
| 7934 |
var promptData = usePrompt.apply(void 0, arguments); |
| 7935 |
var _useGlobalActions = useGlobalActions(); |
| 7936 |
var setHasUnsavedChanges = _useGlobalActions.setHasUnsavedChanges; |
| 7937 |
var state = _useGlobalActions.state; |
| 7938 |
(0, react.useEffect)(function() { |
| 7939 |
var _promptData$data; |
| 7940 |
if ((_promptData$data = promptData.data) !== null && _promptData$data !== void 0 && _promptData$data.result) setHasUnsavedChanges(true); |
| 7941 |
}, [promptData.data]); |
| 7942 |
(0, react.useEffect)(function() { |
| 7943 |
if (state.isAllSaved) promptData.sendUsageData(); |
| 7944 |
}, [state.isAllSaved]); |
| 7945 |
return promptData; |
| 7946 |
}; |
| 7947 |
|
| 7948 |
//#endregion |
| 7949 |
//#region modules/ai/assets/js/editor/pages/form-media/views/resize/hooks/use-resize.js |
| 7950 |
init_api(); |
| 7951 |
var useResize = function useResize(initialValue) { |
| 7952 |
return useImagePrompt(function fetchAction(payload) { |
| 7953 |
return getImageToImageUpscale(payload); |
| 7954 |
}, initialValue); |
| 7955 |
}; |
| 7956 |
|
| 7957 |
//#endregion |
| 7958 |
//#region modules/ai/assets/js/editor/pages/form-media/views/resize/index.js |
| 7959 |
init_defineProperty$1(); |
| 7960 |
init_requests_ids(); |
| 7961 |
var Resize = function Resize() { |
| 7962 |
var _useEditImage = useEditImage(); |
| 7963 |
var editImage = _useEditImage.editImage; |
| 7964 |
var initialEditImageWidth = _useEditImage.width; |
| 7965 |
var setGenerate = useRequestIds().setGenerate; |
| 7966 |
var _useImageActions = useImageActions(); |
| 7967 |
var use = _useImageActions.use; |
| 7968 |
var edit = _useImageActions.edit; |
| 7969 |
var isUploading = _useImageActions.isLoading; |
| 7970 |
var _usePromptSettings = usePromptSettings(); |
| 7971 |
var settings = _usePromptSettings.settings; |
| 7972 |
var updateSettings = _usePromptSettings.updateSettings; |
| 7973 |
var _useResize = useResize(); |
| 7974 |
var data = _useResize.data; |
| 7975 |
var send = _useResize.send; |
| 7976 |
var isGenerating = _useResize.isLoading; |
| 7977 |
var error = _useResize.error; |
| 7978 |
var isLoading = isGenerating || isUploading; |
| 7979 |
var handleSubmit = function handleSubmit(event) { |
| 7980 |
event.preventDefault(); |
| 7981 |
setGenerate(); |
| 7982 |
send({ |
| 7983 |
promptSettings: settings, |
| 7984 |
image: editImage |
| 7985 |
}); |
| 7986 |
}; |
| 7987 |
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, { |
| 7988 |
primary: (0, _wordpress_i18n.__)("Resize", "elementor"), |
| 7989 |
secondary: (0, _wordpress_i18n.__)("Make an image larger and improve it’s resolution.", "elementor") |
| 7990 |
}), error && /*#__PURE__*/ react.default.createElement(View.ErrorMessage, { |
| 7991 |
error, |
| 7992 |
onRetry: handleSubmit |
| 7993 |
}), /*#__PURE__*/ react.default.createElement(ImageForm, { onSubmit: handleSubmit }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, { spacing: .2 }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, { |
| 7994 |
display: "flex", |
| 7995 |
justifyContent: "space-between", |
| 7996 |
alignItems: "center" |
| 7997 |
}, /*#__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, { |
| 7998 |
marks: true, |
| 7999 |
step: 64, |
| 8000 |
min: 512, |
| 8001 |
max: 2048, |
| 8002 |
id: "upscale_to", |
| 8003 |
color: "secondary", |
| 8004 |
name: "upscale_to", |
| 8005 |
disabled: isLoading, |
| 8006 |
defaultValue: initialEditImageWidth, |
| 8007 |
valueLabelDisplay: "auto", |
| 8008 |
"aria-label": (0, _wordpress_i18n.__)("Upscale to", "elementor"), |
| 8009 |
onChange: function onChange(_, value) { |
| 8010 |
return updateSettings(_defineProperty$1({}, IMAGE_UPSCALE, value)); |
| 8011 |
} |
| 8012 |
}), /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, { |
| 8013 |
display: "flex", |
| 8014 |
justifyContent: "space-between", |
| 8015 |
alignItems: "center" |
| 8016 |
}, /*#__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, { |
| 8017 |
onUseImage: use, |
| 8018 |
onEditImage: edit, |
| 8019 |
images: data.result, |
| 8020 |
aspectRatio: editImage.aspectRatio |
| 8021 |
}) : /*#__PURE__*/ react.default.createElement(SingleImagePreview, null, /*#__PURE__*/ react.default.createElement(SingleImagePreview.Image, { |
| 8022 |
src: editImage.url, |
| 8023 |
alt: editImage.alt, |
| 8024 |
style: { |
| 8025 |
width: editImage.width, |
| 8026 |
height: editImage.height |
| 8027 |
} |
| 8028 |
})))); |
| 8029 |
}; |
| 8030 |
|
| 8031 |
//#endregion |
| 8032 |
//#region node_modules/react-sketch-canvas/dist/react-sketch-canvas.esm.js |
| 8033 |
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { |
| 8034 |
try { |
| 8035 |
var info = gen[key](arg); |
| 8036 |
var value = info.value; |
| 8037 |
} catch (error) { |
| 8038 |
reject(error); |
| 8039 |
return; |
| 8040 |
} |
| 8041 |
if (info.done) resolve(value); |
| 8042 |
else Promise.resolve(value).then(_next, _throw); |
| 8043 |
} |
| 8044 |
function _asyncToGenerator(fn) { |
| 8045 |
return function() { |
| 8046 |
var self = this; |
| 8047 |
var args = arguments; |
| 8048 |
return new Promise(function(resolve, reject) { |
| 8049 |
var gen = fn.apply(self, args); |
| 8050 |
function _next(value) { |
| 8051 |
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); |
| 8052 |
} |
| 8053 |
function _throw(err) { |
| 8054 |
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); |
| 8055 |
} |
| 8056 |
_next(void 0); |
| 8057 |
}); |
| 8058 |
}; |
| 8059 |
} |
| 8060 |
function _extends() { |
| 8061 |
_extends = Object.assign || function(target) { |
| 8062 |
for (var i = 1; i < arguments.length; i++) { |
| 8063 |
var source = arguments[i]; |
| 8064 |
for (var key in source) if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; |
| 8065 |
} |
| 8066 |
return target; |
| 8067 |
}; |
| 8068 |
return _extends.apply(this, arguments); |
| 8069 |
} |
| 8070 |
var runtime = { exports: {} }; |
| 8071 |
/** |
| 8072 |
* Copyright (c) 2014-present, Facebook, Inc. |
| 8073 |
* |
| 8074 |
* This source code is licensed under the MIT license found in the |
| 8075 |
* LICENSE file in the root directory of this source tree. |
| 8076 |
*/ |
| 8077 |
(function(module) { |
| 8078 |
var runtime = function(exports) { |
| 8079 |
var Op = Object.prototype; |
| 8080 |
var hasOwn = Op.hasOwnProperty; |
| 8081 |
var undefined$1; |
| 8082 |
var $Symbol = typeof Symbol === "function" ? Symbol : {}; |
| 8083 |
var iteratorSymbol = $Symbol.iterator || "@@iterator"; |
| 8084 |
var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator"; |
| 8085 |
var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; |
| 8086 |
function define(obj, key, value) { |
| 8087 |
Object.defineProperty(obj, key, { |
| 8088 |
value, |
| 8089 |
enumerable: true, |
| 8090 |
configurable: true, |
| 8091 |
writable: true |
| 8092 |
}); |
| 8093 |
return obj[key]; |
| 8094 |
} |
| 8095 |
try { |
| 8096 |
define({}, ""); |
| 8097 |
} catch (err) { |
| 8098 |
define = function(obj, key, value) { |
| 8099 |
return obj[key] = value; |
| 8100 |
}; |
| 8101 |
} |
| 8102 |
function wrap(innerFn, outerFn, self, tryLocsList) { |
| 8103 |
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator; |
| 8104 |
var generator = Object.create(protoGenerator.prototype); |
| 8105 |
generator._invoke = makeInvokeMethod(innerFn, self, new Context(tryLocsList || [])); |
| 8106 |
return generator; |
| 8107 |
} |
| 8108 |
exports.wrap = wrap; |
| 8109 |
function tryCatch(fn, obj, arg) { |
| 8110 |
try { |
| 8111 |
return { |
| 8112 |
type: "normal", |
| 8113 |
arg: fn.call(obj, arg) |
| 8114 |
}; |
| 8115 |
} catch (err) { |
| 8116 |
return { |
| 8117 |
type: "throw", |
| 8118 |
arg: err |
| 8119 |
}; |
| 8120 |
} |
| 8121 |
} |
| 8122 |
var GenStateSuspendedStart = "suspendedStart"; |
| 8123 |
var GenStateSuspendedYield = "suspendedYield"; |
| 8124 |
var GenStateExecuting = "executing"; |
| 8125 |
var GenStateCompleted = "completed"; |
| 8126 |
var ContinueSentinel = {}; |
| 8127 |
function Generator() {} |
| 8128 |
function GeneratorFunction() {} |
| 8129 |
function GeneratorFunctionPrototype() {} |
| 8130 |
var IteratorPrototype = {}; |
| 8131 |
define(IteratorPrototype, iteratorSymbol, function() { |
| 8132 |
return this; |
| 8133 |
}); |
| 8134 |
var getProto = Object.getPrototypeOf; |
| 8135 |
var NativeIteratorPrototype = getProto && getProto(getProto(values([]))); |
| 8136 |
if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) IteratorPrototype = NativeIteratorPrototype; |
| 8137 |
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); |
| 8138 |
GeneratorFunction.prototype = GeneratorFunctionPrototype; |
| 8139 |
define(Gp, "constructor", GeneratorFunctionPrototype); |
| 8140 |
define(GeneratorFunctionPrototype, "constructor", GeneratorFunction); |
| 8141 |
GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"); |
| 8142 |
function defineIteratorMethods(prototype) { |
| 8143 |
[ |
| 8144 |
"next", |
| 8145 |
"throw", |
| 8146 |
"return" |
| 8147 |
].forEach(function(method) { |
| 8148 |
define(prototype, method, function(arg) { |
| 8149 |
return this._invoke(method, arg); |
| 8150 |
}); |
| 8151 |
}); |
| 8152 |
} |
| 8153 |
exports.isGeneratorFunction = function(genFun) { |
| 8154 |
var ctor = typeof genFun === "function" && genFun.constructor; |
| 8155 |
return ctor ? ctor === GeneratorFunction || (ctor.displayName || ctor.name) === "GeneratorFunction" : false; |
| 8156 |
}; |
| 8157 |
exports.mark = function(genFun) { |
| 8158 |
if (Object.setPrototypeOf) Object.setPrototypeOf(genFun, GeneratorFunctionPrototype); |
| 8159 |
else { |
| 8160 |
genFun.__proto__ = GeneratorFunctionPrototype; |
| 8161 |
define(genFun, toStringTagSymbol, "GeneratorFunction"); |
| 8162 |
} |
| 8163 |
genFun.prototype = Object.create(Gp); |
| 8164 |
return genFun; |
| 8165 |
}; |
| 8166 |
exports.awrap = function(arg) { |
| 8167 |
return { __await: arg }; |
| 8168 |
}; |
| 8169 |
function AsyncIterator(generator, PromiseImpl) { |
| 8170 |
function invoke(method, arg, resolve, reject) { |
| 8171 |
var record = tryCatch(generator[method], generator, arg); |
| 8172 |
if (record.type === "throw") reject(record.arg); |
| 8173 |
else { |
| 8174 |
var result = record.arg; |
| 8175 |
var value = result.value; |
| 8176 |
if (value && typeof value === "object" && hasOwn.call(value, "__await")) return PromiseImpl.resolve(value.__await).then(function(value) { |
| 8177 |
invoke("next", value, resolve, reject); |
| 8178 |
}, function(err) { |
| 8179 |
invoke("throw", err, resolve, reject); |
| 8180 |
}); |
| 8181 |
return PromiseImpl.resolve(value).then(function(unwrapped) { |
| 8182 |
result.value = unwrapped; |
| 8183 |
resolve(result); |
| 8184 |
}, function(error) { |
| 8185 |
return invoke("throw", error, resolve, reject); |
| 8186 |
}); |
| 8187 |
} |
| 8188 |
} |
| 8189 |
var previousPromise; |
| 8190 |
function enqueue(method, arg) { |
| 8191 |
function callInvokeWithMethodAndArg() { |
| 8192 |
return new PromiseImpl(function(resolve, reject) { |
| 8193 |
invoke(method, arg, resolve, reject); |
| 8194 |
}); |
| 8195 |
} |
| 8196 |
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); |
| 8197 |
} |
| 8198 |
this._invoke = enqueue; |
| 8199 |
} |
| 8200 |
defineIteratorMethods(AsyncIterator.prototype); |
| 8201 |
define(AsyncIterator.prototype, asyncIteratorSymbol, function() { |
| 8202 |
return this; |
| 8203 |
}); |
| 8204 |
exports.AsyncIterator = AsyncIterator; |
| 8205 |
exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) { |
| 8206 |
if (PromiseImpl === void 0) PromiseImpl = Promise; |
| 8207 |
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); |
| 8208 |
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function(result) { |
| 8209 |
return result.done ? result.value : iter.next(); |
| 8210 |
}); |
| 8211 |
}; |
| 8212 |
function makeInvokeMethod(innerFn, self, context) { |
| 8213 |
var state = GenStateSuspendedStart; |
| 8214 |
return function invoke(method, arg) { |
| 8215 |
if (state === GenStateExecuting) throw new Error("Generator is already running"); |
| 8216 |
if (state === GenStateCompleted) { |
| 8217 |
if (method === "throw") throw arg; |
| 8218 |
return doneResult(); |
| 8219 |
} |
| 8220 |
context.method = method; |
| 8221 |
context.arg = arg; |
| 8222 |
while (true) { |
| 8223 |
var delegate = context.delegate; |
| 8224 |
if (delegate) { |
| 8225 |
var delegateResult = maybeInvokeDelegate(delegate, context); |
| 8226 |
if (delegateResult) { |
| 8227 |
if (delegateResult === ContinueSentinel) continue; |
| 8228 |
return delegateResult; |
| 8229 |
} |
| 8230 |
} |
| 8231 |
if (context.method === "next") context.sent = context._sent = context.arg; |
| 8232 |
else if (context.method === "throw") { |
| 8233 |
if (state === GenStateSuspendedStart) { |
| 8234 |
state = GenStateCompleted; |
| 8235 |
throw context.arg; |
| 8236 |
} |
| 8237 |
context.dispatchException(context.arg); |
| 8238 |
} else if (context.method === "return") context.abrupt("return", context.arg); |
| 8239 |
state = GenStateExecuting; |
| 8240 |
var record = tryCatch(innerFn, self, context); |
| 8241 |
if (record.type === "normal") { |
| 8242 |
state = context.done ? GenStateCompleted : GenStateSuspendedYield; |
| 8243 |
if (record.arg === ContinueSentinel) continue; |
| 8244 |
return { |
| 8245 |
value: record.arg, |
| 8246 |
done: context.done |
| 8247 |
}; |
| 8248 |
} else if (record.type === "throw") { |
| 8249 |
state = GenStateCompleted; |
| 8250 |
context.method = "throw"; |
| 8251 |
context.arg = record.arg; |
| 8252 |
} |
| 8253 |
} |
| 8254 |
}; |
| 8255 |
} |
| 8256 |
function maybeInvokeDelegate(delegate, context) { |
| 8257 |
var method = delegate.iterator[context.method]; |
| 8258 |
if (method === undefined$1) { |
| 8259 |
context.delegate = null; |
| 8260 |
if (context.method === "throw") { |
| 8261 |
if (delegate.iterator["return"]) { |
| 8262 |
context.method = "return"; |
| 8263 |
context.arg = undefined$1; |
| 8264 |
maybeInvokeDelegate(delegate, context); |
| 8265 |
if (context.method === "throw") return ContinueSentinel; |
| 8266 |
} |
| 8267 |
context.method = "throw"; |
| 8268 |
context.arg = /* @__PURE__ */ new TypeError("The iterator does not provide a 'throw' method"); |
| 8269 |
} |
| 8270 |
return ContinueSentinel; |
| 8271 |
} |
| 8272 |
var record = tryCatch(method, delegate.iterator, context.arg); |
| 8273 |
if (record.type === "throw") { |
| 8274 |
context.method = "throw"; |
| 8275 |
context.arg = record.arg; |
| 8276 |
context.delegate = null; |
| 8277 |
return ContinueSentinel; |
| 8278 |
} |
| 8279 |
var info = record.arg; |
| 8280 |
if (!info) { |
| 8281 |
context.method = "throw"; |
| 8282 |
context.arg = /* @__PURE__ */ new TypeError("iterator result is not an object"); |
| 8283 |
context.delegate = null; |
| 8284 |
return ContinueSentinel; |
| 8285 |
} |
| 8286 |
if (info.done) { |
| 8287 |
context[delegate.resultName] = info.value; |
| 8288 |
context.next = delegate.nextLoc; |
| 8289 |
if (context.method !== "return") { |
| 8290 |
context.method = "next"; |
| 8291 |
context.arg = undefined$1; |
| 8292 |
} |
| 8293 |
} else return info; |
| 8294 |
context.delegate = null; |
| 8295 |
return ContinueSentinel; |
| 8296 |
} |
| 8297 |
defineIteratorMethods(Gp); |
| 8298 |
define(Gp, toStringTagSymbol, "Generator"); |
| 8299 |
define(Gp, iteratorSymbol, function() { |
| 8300 |
return this; |
| 8301 |
}); |
| 8302 |
define(Gp, "toString", function() { |
| 8303 |
return "[object Generator]"; |
| 8304 |
}); |
| 8305 |
function pushTryEntry(locs) { |
| 8306 |
var entry = { tryLoc: locs[0] }; |
| 8307 |
if (1 in locs) entry.catchLoc = locs[1]; |
| 8308 |
if (2 in locs) { |
| 8309 |
entry.finallyLoc = locs[2]; |
| 8310 |
entry.afterLoc = locs[3]; |
| 8311 |
} |
| 8312 |
this.tryEntries.push(entry); |
| 8313 |
} |
| 8314 |
function resetTryEntry(entry) { |
| 8315 |
var record = entry.completion || {}; |
| 8316 |
record.type = "normal"; |
| 8317 |
delete record.arg; |
| 8318 |
entry.completion = record; |
| 8319 |
} |
| 8320 |
function Context(tryLocsList) { |
| 8321 |
this.tryEntries = [{ tryLoc: "root" }]; |
| 8322 |
tryLocsList.forEach(pushTryEntry, this); |
| 8323 |
this.reset(true); |
| 8324 |
} |
| 8325 |
exports.keys = function(object) { |
| 8326 |
var keys = []; |
| 8327 |
for (var key in object) keys.push(key); |
| 8328 |
keys.reverse(); |
| 8329 |
return function next() { |
| 8330 |
while (keys.length) { |
| 8331 |
var key = keys.pop(); |
| 8332 |
if (key in object) { |
| 8333 |
next.value = key; |
| 8334 |
next.done = false; |
| 8335 |
return next; |
| 8336 |
} |
| 8337 |
} |
| 8338 |
next.done = true; |
| 8339 |
return next; |
| 8340 |
}; |
| 8341 |
}; |
| 8342 |
function values(iterable) { |
| 8343 |
if (iterable) { |
| 8344 |
var iteratorMethod = iterable[iteratorSymbol]; |
| 8345 |
if (iteratorMethod) return iteratorMethod.call(iterable); |
| 8346 |
if (typeof iterable.next === "function") return iterable; |
| 8347 |
if (!isNaN(iterable.length)) { |
| 8348 |
var i = -1; |
| 8349 |
var next = function next() { |
| 8350 |
while (++i < iterable.length) if (hasOwn.call(iterable, i)) { |
| 8351 |
next.value = iterable[i]; |
| 8352 |
next.done = false; |
| 8353 |
return next; |
| 8354 |
} |
| 8355 |
next.value = undefined$1; |
| 8356 |
next.done = true; |
| 8357 |
return next; |
| 8358 |
}; |
| 8359 |
return next.next = next; |
| 8360 |
} |
| 8361 |
} |
| 8362 |
return { next: doneResult }; |
| 8363 |
} |
| 8364 |
exports.values = values; |
| 8365 |
function doneResult() { |
| 8366 |
return { |
| 8367 |
value: undefined$1, |
| 8368 |
done: true |
| 8369 |
}; |
| 8370 |
} |
| 8371 |
Context.prototype = { |
| 8372 |
constructor: Context, |
| 8373 |
reset: function(skipTempReset) { |
| 8374 |
this.prev = 0; |
| 8375 |
this.next = 0; |
| 8376 |
this.sent = this._sent = undefined$1; |
| 8377 |
this.done = false; |
| 8378 |
this.delegate = null; |
| 8379 |
this.method = "next"; |
| 8380 |
this.arg = undefined$1; |
| 8381 |
this.tryEntries.forEach(resetTryEntry); |
| 8382 |
if (!skipTempReset) { |
| 8383 |
for (var name in this) if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) this[name] = undefined$1; |
| 8384 |
} |
| 8385 |
}, |
| 8386 |
stop: function() { |
| 8387 |
this.done = true; |
| 8388 |
var rootRecord = this.tryEntries[0].completion; |
| 8389 |
if (rootRecord.type === "throw") throw rootRecord.arg; |
| 8390 |
return this.rval; |
| 8391 |
}, |
| 8392 |
dispatchException: function(exception) { |
| 8393 |
if (this.done) throw exception; |
| 8394 |
var context = this; |
| 8395 |
function handle(loc, caught) { |
| 8396 |
record.type = "throw"; |
| 8397 |
record.arg = exception; |
| 8398 |
context.next = loc; |
| 8399 |
if (caught) { |
| 8400 |
context.method = "next"; |
| 8401 |
context.arg = undefined$1; |
| 8402 |
} |
| 8403 |
return !!caught; |
| 8404 |
} |
| 8405 |
for (var i = this.tryEntries.length - 1; i >= 0; --i) { |
| 8406 |
var entry = this.tryEntries[i]; |
| 8407 |
var record = entry.completion; |
| 8408 |
if (entry.tryLoc === "root") return handle("end"); |
| 8409 |
if (entry.tryLoc <= this.prev) { |
| 8410 |
var hasCatch = hasOwn.call(entry, "catchLoc"); |
| 8411 |
var hasFinally = hasOwn.call(entry, "finallyLoc"); |
| 8412 |
if (hasCatch && hasFinally) { |
| 8413 |
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, true); |
| 8414 |
else if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); |
| 8415 |
} else if (hasCatch) { |
| 8416 |
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, true); |
| 8417 |
} else if (hasFinally) { |
| 8418 |
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); |
| 8419 |
} else throw new Error("try statement without catch or finally"); |
| 8420 |
} |
| 8421 |
} |
| 8422 |
}, |
| 8423 |
abrupt: function(type, arg) { |
| 8424 |
for (var i = this.tryEntries.length - 1; i >= 0; --i) { |
| 8425 |
var entry = this.tryEntries[i]; |
| 8426 |
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { |
| 8427 |
var finallyEntry = entry; |
| 8428 |
break; |
| 8429 |
} |
| 8430 |
} |
| 8431 |
if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) finallyEntry = null; |
| 8432 |
var record = finallyEntry ? finallyEntry.completion : {}; |
| 8433 |
record.type = type; |
| 8434 |
record.arg = arg; |
| 8435 |
if (finallyEntry) { |
| 8436 |
this.method = "next"; |
| 8437 |
this.next = finallyEntry.finallyLoc; |
| 8438 |
return ContinueSentinel; |
| 8439 |
} |
| 8440 |
return this.complete(record); |
| 8441 |
}, |
| 8442 |
complete: function(record, afterLoc) { |
| 8443 |
if (record.type === "throw") throw record.arg; |
| 8444 |
if (record.type === "break" || record.type === "continue") this.next = record.arg; |
| 8445 |
else if (record.type === "return") { |
| 8446 |
this.rval = this.arg = record.arg; |
| 8447 |
this.method = "return"; |
| 8448 |
this.next = "end"; |
| 8449 |
} else if (record.type === "normal" && afterLoc) this.next = afterLoc; |
| 8450 |
return ContinueSentinel; |
| 8451 |
}, |
| 8452 |
finish: function(finallyLoc) { |
| 8453 |
for (var i = this.tryEntries.length - 1; i >= 0; --i) { |
| 8454 |
var entry = this.tryEntries[i]; |
| 8455 |
if (entry.finallyLoc === finallyLoc) { |
| 8456 |
this.complete(entry.completion, entry.afterLoc); |
| 8457 |
resetTryEntry(entry); |
| 8458 |
return ContinueSentinel; |
| 8459 |
} |
| 8460 |
} |
| 8461 |
}, |
| 8462 |
"catch": function(tryLoc) { |
| 8463 |
for (var i = this.tryEntries.length - 1; i >= 0; --i) { |
| 8464 |
var entry = this.tryEntries[i]; |
| 8465 |
if (entry.tryLoc === tryLoc) { |
| 8466 |
var record = entry.completion; |
| 8467 |
if (record.type === "throw") { |
| 8468 |
var thrown = record.arg; |
| 8469 |
resetTryEntry(entry); |
| 8470 |
} |
| 8471 |
return thrown; |
| 8472 |
} |
| 8473 |
} |
| 8474 |
throw new Error("illegal catch attempt"); |
| 8475 |
}, |
| 8476 |
delegateYield: function(iterable, resultName, nextLoc) { |
| 8477 |
this.delegate = { |
| 8478 |
iterator: values(iterable), |
| 8479 |
resultName, |
| 8480 |
nextLoc |
| 8481 |
}; |
| 8482 |
if (this.method === "next") this.arg = undefined$1; |
| 8483 |
return ContinueSentinel; |
| 8484 |
} |
| 8485 |
}; |
| 8486 |
return exports; |
| 8487 |
}(module.exports); |
| 8488 |
try { |
| 8489 |
regeneratorRuntime = runtime; |
| 8490 |
} catch (accidentalStrictMode) { |
| 8491 |
if (typeof globalThis === "object") globalThis.regeneratorRuntime = runtime; |
| 8492 |
else Function("r", "regeneratorRuntime = r")(runtime); |
| 8493 |
} |
| 8494 |
})(runtime); |
| 8495 |
var _regeneratorRuntime$24 = runtime.exports; |
| 8496 |
/** |
| 8497 |
* Generate SVG Path tag from the given points |
| 8498 |
*/ |
| 8499 |
var SvgPath = function SvgPath(_ref) { |
| 8500 |
var paths = _ref.paths; |
| 8501 |
var id = _ref.id; |
| 8502 |
var strokeWidth = _ref.strokeWidth; |
| 8503 |
var strokeColor = _ref.strokeColor; |
| 8504 |
var _ref$command = _ref.command; |
| 8505 |
var command = _ref$command === void 0 ? bezierCommand : _ref$command; |
| 8506 |
if (paths.length === 1) { |
| 8507 |
var _paths$ = paths[0]; |
| 8508 |
var x = _paths$.x; |
| 8509 |
var y = _paths$.y; |
| 8510 |
var radius = strokeWidth / 2; |
| 8511 |
return react.createElement("circle", { |
| 8512 |
key: id, |
| 8513 |
id, |
| 8514 |
cx: x, |
| 8515 |
cy: y, |
| 8516 |
r: radius, |
| 8517 |
stroke: strokeColor, |
| 8518 |
fill: strokeColor |
| 8519 |
}); |
| 8520 |
} |
| 8521 |
var d = paths.reduce(function(acc, point, i, a) { |
| 8522 |
return i === 0 ? "M " + point.x + "," + point.y : acc + " " + command(point, i, a); |
| 8523 |
}, ""); |
| 8524 |
return react.createElement("path", { |
| 8525 |
key: id, |
| 8526 |
id, |
| 8527 |
d, |
| 8528 |
fill: "none", |
| 8529 |
strokeLinecap: "round", |
| 8530 |
stroke: strokeColor, |
| 8531 |
strokeWidth |
| 8532 |
}); |
| 8533 |
}; |
| 8534 |
var line = function line(pointA, pointB) { |
| 8535 |
var lengthX = pointB.x - pointA.x; |
| 8536 |
var lengthY = pointB.y - pointA.y; |
| 8537 |
return { |
| 8538 |
length: Math.sqrt(Math.pow(lengthX, 2) + Math.pow(lengthY, 2)), |
| 8539 |
angle: Math.atan2(lengthY, lengthX) |
| 8540 |
}; |
| 8541 |
}; |
| 8542 |
var controlPoint = function controlPoint(controlPoints) { |
| 8543 |
var current = controlPoints.current; |
| 8544 |
var next = controlPoints.next; |
| 8545 |
var previous = controlPoints.previous; |
| 8546 |
var reverse = controlPoints.reverse; |
| 8547 |
var p = previous || current; |
| 8548 |
var n = next || current; |
| 8549 |
var smoothing = .2; |
| 8550 |
var o = line(p, n); |
| 8551 |
var angle = o.angle + (reverse ? Math.PI : 0); |
| 8552 |
var length = o.length * smoothing; |
| 8553 |
return [current.x + Math.cos(angle) * length, current.y + Math.sin(angle) * length]; |
| 8554 |
}; |
| 8555 |
var bezierCommand = function bezierCommand(point, i, a) { |
| 8556 |
var cpsX = null; |
| 8557 |
var cpsY = null; |
| 8558 |
switch (i) { |
| 8559 |
case 0: |
| 8560 |
var _controlPoint = controlPoint({ current: point }); |
| 8561 |
cpsX = _controlPoint[0]; |
| 8562 |
cpsY = _controlPoint[1]; |
| 8563 |
break; |
| 8564 |
case 1: |
| 8565 |
var _controlPoint2 = controlPoint({ |
| 8566 |
current: a[i - 1], |
| 8567 |
next: point |
| 8568 |
}); |
| 8569 |
cpsX = _controlPoint2[0]; |
| 8570 |
cpsY = _controlPoint2[1]; |
| 8571 |
break; |
| 8572 |
default: |
| 8573 |
var _controlPoint3 = controlPoint({ |
| 8574 |
current: a[i - 1], |
| 8575 |
previous: a[i - 2], |
| 8576 |
next: point |
| 8577 |
}); |
| 8578 |
cpsX = _controlPoint3[0]; |
| 8579 |
cpsY = _controlPoint3[1]; |
| 8580 |
break; |
| 8581 |
} |
| 8582 |
var _controlPoint4 = controlPoint({ |
| 8583 |
current: point, |
| 8584 |
previous: a[i - 1], |
| 8585 |
next: a[i + 1], |
| 8586 |
reverse: true |
| 8587 |
}); |
| 8588 |
var cpeX = _controlPoint4[0]; |
| 8589 |
var cpeY = _controlPoint4[1]; |
| 8590 |
return "C " + cpsX + "," + cpsY + " " + cpeX + "," + cpeY + " " + point.x + ", " + point.y; |
| 8591 |
}; |
| 8592 |
var Paths = function Paths(_ref2) { |
| 8593 |
var id = _ref2.id; |
| 8594 |
var paths = _ref2.paths; |
| 8595 |
return react.createElement(react.Fragment, null, paths.map(function(path, index) { |
| 8596 |
return react.createElement(SvgPath, { |
| 8597 |
key: id + "__" + index, |
| 8598 |
paths: path.paths, |
| 8599 |
id: id + "__" + index, |
| 8600 |
strokeWidth: path.strokeWidth, |
| 8601 |
strokeColor: path.strokeColor, |
| 8602 |
command: bezierCommand |
| 8603 |
}); |
| 8604 |
})); |
| 8605 |
}; |
| 8606 |
var loadImage = function loadImage(url) { |
| 8607 |
return new Promise(function(resolve, reject) { |
| 8608 |
var img = new Image(); |
| 8609 |
img.addEventListener("load", function() { |
| 8610 |
if (img.width > 0) resolve(img); |
| 8611 |
reject("Image not found"); |
| 8612 |
}); |
| 8613 |
img.addEventListener("error", function(err) { |
| 8614 |
return reject(err); |
| 8615 |
}); |
| 8616 |
img.src = url; |
| 8617 |
img.setAttribute("crossorigin", "anonymous"); |
| 8618 |
}); |
| 8619 |
}; |
| 8620 |
function getCanvasWithViewBox(canvas) { |
| 8621 |
var _canvas$firstChild; |
| 8622 |
var svgCanvas = (_canvas$firstChild = canvas.firstChild) == null ? void 0 : _canvas$firstChild.cloneNode(true); |
| 8623 |
var width = canvas.offsetWidth; |
| 8624 |
var height = canvas.offsetHeight; |
| 8625 |
svgCanvas.setAttribute("viewBox", "0 0 " + width + " " + height); |
| 8626 |
svgCanvas.setAttribute("width", width.toString()); |
| 8627 |
svgCanvas.setAttribute("height", height.toString()); |
| 8628 |
return { |
| 8629 |
svgCanvas, |
| 8630 |
width, |
| 8631 |
height |
| 8632 |
}; |
| 8633 |
} |
| 8634 |
var Canvas = /*#__PURE__*/ react.forwardRef(function(props, ref) { |
| 8635 |
var paths = props.paths; |
| 8636 |
var isDrawing = props.isDrawing; |
| 8637 |
var onPointerDown = props.onPointerDown; |
| 8638 |
var onPointerMove = props.onPointerMove; |
| 8639 |
var onPointerUp = props.onPointerUp; |
| 8640 |
var _props$id = props.id; |
| 8641 |
var id = _props$id === void 0 ? "react-sketch-canvas" : _props$id; |
| 8642 |
var _props$width = props.width; |
| 8643 |
var width = _props$width === void 0 ? "100%" : _props$width; |
| 8644 |
var _props$height = props.height; |
| 8645 |
var height = _props$height === void 0 ? "100%" : _props$height; |
| 8646 |
var _props$className = props.className; |
| 8647 |
var className = _props$className === void 0 ? "react-sketch-canvas" : _props$className; |
| 8648 |
var _props$canvasColor = props.canvasColor; |
| 8649 |
var canvasColor = _props$canvasColor === void 0 ? "red" : _props$canvasColor; |
| 8650 |
var _props$backgroundImag = props.backgroundImage; |
| 8651 |
var backgroundImage = _props$backgroundImag === void 0 ? "" : _props$backgroundImag; |
| 8652 |
var _props$exportWithBack = props.exportWithBackgroundImage; |
| 8653 |
var exportWithBackgroundImage = _props$exportWithBack === void 0 ? false : _props$exportWithBack; |
| 8654 |
var _props$preserveBackgr = props.preserveBackgroundImageAspectRatio; |
| 8655 |
var preserveBackgroundImageAspectRatio = _props$preserveBackgr === void 0 ? "none" : _props$preserveBackgr; |
| 8656 |
var _props$allowOnlyPoint = props.allowOnlyPointerType; |
| 8657 |
var allowOnlyPointerType = _props$allowOnlyPoint === void 0 ? "all" : _props$allowOnlyPoint; |
| 8658 |
var _props$style = props.style; |
| 8659 |
var style = _props$style === void 0 ? { |
| 8660 |
border: "0.0625rem solid #9c9c9c", |
| 8661 |
borderRadius: "0.25rem" |
| 8662 |
} : _props$style; |
| 8663 |
var _props$svgStyle = props.svgStyle; |
| 8664 |
var svgStyle = _props$svgStyle === void 0 ? {} : _props$svgStyle; |
| 8665 |
var canvasRef = react.useRef(null); |
| 8666 |
var getCoordinates = function getCoordinates(pointerEvent) { |
| 8667 |
var _canvasRef$current; |
| 8668 |
var _window$scrollX; |
| 8669 |
var _window$scrollY; |
| 8670 |
var boundingArea = (_canvasRef$current = canvasRef.current) == null ? void 0 : _canvasRef$current.getBoundingClientRect(); |
| 8671 |
var scrollLeft = (_window$scrollX = window.scrollX) != null ? _window$scrollX : 0; |
| 8672 |
var scrollTop = (_window$scrollY = window.scrollY) != null ? _window$scrollY : 0; |
| 8673 |
if (!boundingArea) return { |
| 8674 |
x: 0, |
| 8675 |
y: 0 |
| 8676 |
}; |
| 8677 |
return { |
| 8678 |
x: pointerEvent.pageX - boundingArea.left - scrollLeft, |
| 8679 |
y: pointerEvent.pageY - boundingArea.top - scrollTop |
| 8680 |
}; |
| 8681 |
}; |
| 8682 |
var handlePointerDown = function handlePointerDown(event) { |
| 8683 |
if (allowOnlyPointerType !== "all" && event.pointerType !== allowOnlyPointerType) return; |
| 8684 |
if (event.pointerType === "mouse" && event.button !== 0) return; |
| 8685 |
onPointerDown(getCoordinates(event)); |
| 8686 |
}; |
| 8687 |
var handlePointerMove = function handlePointerMove(event) { |
| 8688 |
if (!isDrawing) return; |
| 8689 |
if (allowOnlyPointerType !== "all" && event.pointerType !== allowOnlyPointerType) return; |
| 8690 |
onPointerMove(getCoordinates(event)); |
| 8691 |
}; |
| 8692 |
var handlePointerUp = function handlePointerUp(event) { |
| 8693 |
if (event.pointerType === "mouse" && event.button !== 0) return; |
| 8694 |
if (allowOnlyPointerType !== "all" && event.pointerType !== allowOnlyPointerType) return; |
| 8695 |
onPointerUp(); |
| 8696 |
}; |
| 8697 |
react.useImperativeHandle(ref, function() { |
| 8698 |
return { |
| 8699 |
exportImage: function exportImage(imageType) { |
| 8700 |
return new Promise(/*#__PURE__*/ function() { |
| 8701 |
var _ref = _asyncToGenerator(/*#__PURE__*/ _regeneratorRuntime$24.mark(function _callee(resolve, reject) { |
| 8702 |
var canvas; |
| 8703 |
var _getCanvasWithViewBox; |
| 8704 |
var svgCanvas; |
| 8705 |
var _width; |
| 8706 |
var _height; |
| 8707 |
var canvasSketch; |
| 8708 |
var loadImagePromises; |
| 8709 |
var img; |
| 8710 |
return _regeneratorRuntime$24.wrap(function _callee$(_context) { |
| 8711 |
while (1) switch (_context.prev = _context.next) { |
| 8712 |
case 0: |
| 8713 |
_context.prev = 0; |
| 8714 |
canvas = canvasRef.current; |
| 8715 |
if (canvas) { |
| 8716 |
_context.next = 4; |
| 8717 |
break; |
| 8718 |
} |
| 8719 |
throw Error("Canvas not rendered yet"); |
| 8720 |
case 4: |
| 8721 |
_getCanvasWithViewBox = getCanvasWithViewBox(canvas), svgCanvas = _getCanvasWithViewBox.svgCanvas, _width = _getCanvasWithViewBox.width, _height = _getCanvasWithViewBox.height; |
| 8722 |
canvasSketch = "data:image/svg+xml;base64," + btoa(svgCanvas.outerHTML); |
| 8723 |
_context.next = 8; |
| 8724 |
return loadImage(canvasSketch); |
| 8725 |
case 8: |
| 8726 |
_context.t0 = _context.sent; |
| 8727 |
loadImagePromises = [_context.t0]; |
| 8728 |
if (!exportWithBackgroundImage) { |
| 8729 |
_context.next = 21; |
| 8730 |
break; |
| 8731 |
} |
| 8732 |
_context.prev = 11; |
| 8733 |
_context.next = 14; |
| 8734 |
return loadImage(backgroundImage); |
| 8735 |
case 14: |
| 8736 |
img = _context.sent; |
| 8737 |
loadImagePromises.push(img); |
| 8738 |
_context.next = 21; |
| 8739 |
break; |
| 8740 |
case 18: |
| 8741 |
_context.prev = 18; |
| 8742 |
_context.t1 = _context["catch"](11); |
| 8743 |
console.warn("exportWithBackgroundImage props is set without a valid background image URL. This option is ignored"); |
| 8744 |
case 21: |
| 8745 |
Promise.all(loadImagePromises).then(function(images) { |
| 8746 |
var renderCanvas = document.createElement("canvas"); |
| 8747 |
renderCanvas.setAttribute("width", _width.toString()); |
| 8748 |
renderCanvas.setAttribute("height", _height.toString()); |
| 8749 |
var context = renderCanvas.getContext("2d"); |
| 8750 |
if (!context) throw Error("Canvas not rendered yet"); |
| 8751 |
images.reverse().forEach(function(image) { |
| 8752 |
context.drawImage(image, 0, 0); |
| 8753 |
}); |
| 8754 |
resolve(renderCanvas.toDataURL("image/" + imageType)); |
| 8755 |
})["catch"](function(e) { |
| 8756 |
throw e; |
| 8757 |
}); |
| 8758 |
_context.next = 27; |
| 8759 |
break; |
| 8760 |
case 24: |
| 8761 |
_context.prev = 24; |
| 8762 |
_context.t2 = _context["catch"](0); |
| 8763 |
reject(_context.t2); |
| 8764 |
case 27: |
| 8765 |
case "end": return _context.stop(); |
| 8766 |
} |
| 8767 |
}, _callee, null, [[0, 24], [11, 18]]); |
| 8768 |
})); |
| 8769 |
return function(_x, _x2) { |
| 8770 |
return _ref.apply(this, arguments); |
| 8771 |
}; |
| 8772 |
}()); |
| 8773 |
}, |
| 8774 |
exportSvg: function exportSvg() { |
| 8775 |
return new Promise(function(resolve, reject) { |
| 8776 |
try { |
| 8777 |
var _canvasRef$current2; |
| 8778 |
var canvas = (_canvasRef$current2 = canvasRef.current) != null ? _canvasRef$current2 : null; |
| 8779 |
if (canvas !== null) { |
| 8780 |
var _svgCanvas$querySelec; |
| 8781 |
var _svgCanvas$querySelec2; |
| 8782 |
var svgCanvas = getCanvasWithViewBox(canvas).svgCanvas; |
| 8783 |
if (exportWithBackgroundImage) { |
| 8784 |
resolve(svgCanvas.outerHTML); |
| 8785 |
return; |
| 8786 |
} |
| 8787 |
(_svgCanvas$querySelec = svgCanvas.querySelector("#" + id + "__background")) == null || _svgCanvas$querySelec.remove(); |
| 8788 |
(_svgCanvas$querySelec2 = svgCanvas.querySelector("#" + id + "__canvas-background")) == null || _svgCanvas$querySelec2.setAttribute("fill", canvasColor); |
| 8789 |
resolve(svgCanvas.outerHTML); |
| 8790 |
} |
| 8791 |
reject(/* @__PURE__ */ new Error("Canvas not loaded")); |
| 8792 |
} catch (e) { |
| 8793 |
reject(e); |
| 8794 |
} |
| 8795 |
}); |
| 8796 |
} |
| 8797 |
}; |
| 8798 |
}); |
| 8799 |
react.useEffect(function() { |
| 8800 |
document.addEventListener("pointerup", handlePointerUp); |
| 8801 |
return function() { |
| 8802 |
document.removeEventListener("pointerup", handlePointerUp); |
| 8803 |
}; |
| 8804 |
}, [handlePointerUp]); |
| 8805 |
var eraserPaths = paths.filter(function(path) { |
| 8806 |
return !path.drawMode; |
| 8807 |
}); |
| 8808 |
var currentGroup = 0; |
| 8809 |
var pathGroups = paths.reduce(function(arrayGroup, path) { |
| 8810 |
if (!path.drawMode) { |
| 8811 |
currentGroup += 1; |
| 8812 |
return arrayGroup; |
| 8813 |
} |
| 8814 |
if (arrayGroup[currentGroup] === void 0) arrayGroup[currentGroup] = []; |
| 8815 |
arrayGroup[currentGroup].push(path); |
| 8816 |
return arrayGroup; |
| 8817 |
}, [[]]); |
| 8818 |
return react.createElement("div", { |
| 8819 |
role: "presentation", |
| 8820 |
ref: canvasRef, |
| 8821 |
className, |
| 8822 |
style: _extends({ |
| 8823 |
touchAction: "none", |
| 8824 |
width, |
| 8825 |
height |
| 8826 |
}, style), |
| 8827 |
"touch-action": "none", |
| 8828 |
onPointerDown: handlePointerDown, |
| 8829 |
onPointerMove: handlePointerMove, |
| 8830 |
onPointerUp: handlePointerUp |
| 8831 |
}, react.createElement("svg", { |
| 8832 |
version: "1.1", |
| 8833 |
baseProfile: "full", |
| 8834 |
xmlns: "http://www.w3.org/2000/svg", |
| 8835 |
xmlnsXlink: "http://www.w3.org/1999/xlink", |
| 8836 |
style: _extends({ |
| 8837 |
width: "100%", |
| 8838 |
height: "100%" |
| 8839 |
}, svgStyle), |
| 8840 |
id |
| 8841 |
}, react.createElement("g", { |
| 8842 |
id: id + "__eraser-stroke-group", |
| 8843 |
display: "none" |
| 8844 |
}, react.createElement("rect", { |
| 8845 |
id: id + "__mask-background", |
| 8846 |
x: "0", |
| 8847 |
y: "0", |
| 8848 |
width: "100%", |
| 8849 |
height: "100%", |
| 8850 |
fill: "white" |
| 8851 |
}), eraserPaths.map(function(eraserPath, i) { |
| 8852 |
return react.createElement(SvgPath, { |
| 8853 |
key: id + "__eraser-" + i, |
| 8854 |
id: id + "__eraser-" + i, |
| 8855 |
paths: eraserPath.paths, |
| 8856 |
strokeColor: "#000000", |
| 8857 |
strokeWidth: eraserPath.strokeWidth |
| 8858 |
}); |
| 8859 |
})), react.createElement("defs", null, backgroundImage && react.createElement("pattern", { |
| 8860 |
id: id + "__background", |
| 8861 |
x: "0", |
| 8862 |
y: "0", |
| 8863 |
width: "100%", |
| 8864 |
height: "100%", |
| 8865 |
patternUnits: "userSpaceOnUse" |
| 8866 |
}, react.createElement("image", { |
| 8867 |
x: "0", |
| 8868 |
y: "0", |
| 8869 |
width: "100%", |
| 8870 |
height: "100%", |
| 8871 |
xlinkHref: backgroundImage, |
| 8872 |
preserveAspectRatio: preserveBackgroundImageAspectRatio |
| 8873 |
})), eraserPaths.map(function(_, i) { |
| 8874 |
return react.createElement("mask", { |
| 8875 |
id: id + "__eraser-mask-" + i, |
| 8876 |
key: id + "__eraser-mask-" + i, |
| 8877 |
maskUnits: "userSpaceOnUse" |
| 8878 |
}, react.createElement("use", { href: "#" + id + "__mask-background" }), Array.from({ length: eraserPaths.length - i }, function(_, j) { |
| 8879 |
return j + i; |
| 8880 |
}).map(function(k) { |
| 8881 |
return react.createElement("use", { |
| 8882 |
key: k.toString(), |
| 8883 |
href: "#" + id + "__eraser-" + k.toString() |
| 8884 |
}); |
| 8885 |
})); |
| 8886 |
})), react.createElement("g", { id: id + "__canvas-background-group" }, react.createElement("rect", { |
| 8887 |
id: id + "__canvas-background", |
| 8888 |
x: "0", |
| 8889 |
y: "0", |
| 8890 |
width: "100%", |
| 8891 |
height: "100%", |
| 8892 |
fill: backgroundImage ? "url(#" + id + "__background)" : canvasColor |
| 8893 |
})), pathGroups.map(function(pathGroup, i) { |
| 8894 |
return react.createElement("g", { |
| 8895 |
id: id + "__stroke-group-" + i, |
| 8896 |
key: id + "__stroke-group-" + i, |
| 8897 |
mask: "url(#" + id + "__eraser-mask-" + i + ")" |
| 8898 |
}, react.createElement(Paths, { |
| 8899 |
id, |
| 8900 |
paths: pathGroup |
| 8901 |
})); |
| 8902 |
}))); |
| 8903 |
}); |
| 8904 |
var ReactSketchCanvas = /*#__PURE__*/ react.forwardRef(function(props, ref) { |
| 8905 |
var _props$id = props.id; |
| 8906 |
var id = _props$id === void 0 ? "react-sketch-canvas" : _props$id; |
| 8907 |
var _props$width = props.width; |
| 8908 |
var width = _props$width === void 0 ? "100%" : _props$width; |
| 8909 |
var _props$height = props.height; |
| 8910 |
var height = _props$height === void 0 ? "100%" : _props$height; |
| 8911 |
var _props$className = props.className; |
| 8912 |
var className = _props$className === void 0 ? "" : _props$className; |
| 8913 |
var _props$canvasColor = props.canvasColor; |
| 8914 |
var canvasColor = _props$canvasColor === void 0 ? "white" : _props$canvasColor; |
| 8915 |
var _props$strokeColor = props.strokeColor; |
| 8916 |
var strokeColor = _props$strokeColor === void 0 ? "red" : _props$strokeColor; |
| 8917 |
var _props$backgroundImag = props.backgroundImage; |
| 8918 |
var backgroundImage = _props$backgroundImag === void 0 ? "" : _props$backgroundImag; |
| 8919 |
var _props$exportWithBack = props.exportWithBackgroundImage; |
| 8920 |
var exportWithBackgroundImage = _props$exportWithBack === void 0 ? false : _props$exportWithBack; |
| 8921 |
var _props$preserveBackgr = props.preserveBackgroundImageAspectRatio; |
| 8922 |
var preserveBackgroundImageAspectRatio = _props$preserveBackgr === void 0 ? "none" : _props$preserveBackgr; |
| 8923 |
var _props$strokeWidth = props.strokeWidth; |
| 8924 |
var strokeWidth = _props$strokeWidth === void 0 ? 4 : _props$strokeWidth; |
| 8925 |
var _props$eraserWidth = props.eraserWidth; |
| 8926 |
var eraserWidth = _props$eraserWidth === void 0 ? 8 : _props$eraserWidth; |
| 8927 |
var _props$allowOnlyPoint = props.allowOnlyPointerType; |
| 8928 |
var allowOnlyPointerType = _props$allowOnlyPoint === void 0 ? "all" : _props$allowOnlyPoint; |
| 8929 |
var _props$style = props.style; |
| 8930 |
var style = _props$style === void 0 ? { |
| 8931 |
border: "0.0625rem solid #9c9c9c", |
| 8932 |
borderRadius: "0.25rem" |
| 8933 |
} : _props$style; |
| 8934 |
var _props$svgStyle = props.svgStyle; |
| 8935 |
var svgStyle = _props$svgStyle === void 0 ? {} : _props$svgStyle; |
| 8936 |
var _props$onChange = props.onChange; |
| 8937 |
var onChange = _props$onChange === void 0 ? function(_paths) {} : _props$onChange; |
| 8938 |
var _props$onStroke = props.onStroke; |
| 8939 |
var onStroke = _props$onStroke === void 0 ? function(_path, _isEraser) {} : _props$onStroke; |
| 8940 |
var _props$withTimestamp = props.withTimestamp; |
| 8941 |
var withTimestamp = _props$withTimestamp === void 0 ? false : _props$withTimestamp; |
| 8942 |
var svgCanvas = react.createRef(); |
| 8943 |
var _React$useState = react.useState(true); |
| 8944 |
var drawMode = _React$useState[0]; |
| 8945 |
var setDrawMode = _React$useState[1]; |
| 8946 |
var _React$useState2 = react.useState(false); |
| 8947 |
var isDrawing = _React$useState2[0]; |
| 8948 |
var setIsDrawing = _React$useState2[1]; |
| 8949 |
var _React$useState3 = react.useState([]); |
| 8950 |
var resetStack = _React$useState3[0]; |
| 8951 |
var setResetStack = _React$useState3[1]; |
| 8952 |
var _React$useState4 = react.useState([]); |
| 8953 |
var undoStack = _React$useState4[0]; |
| 8954 |
var setUndoStack = _React$useState4[1]; |
| 8955 |
var _React$useState5 = react.useState([]); |
| 8956 |
var currentPaths = _React$useState5[0]; |
| 8957 |
var setCurrentPaths = _React$useState5[1]; |
| 8958 |
var liftStrokeUp = react.useCallback(function() { |
| 8959 |
var _currentPaths$slice$; |
| 8960 |
var _currentPaths$slice; |
| 8961 |
var lastStroke = (_currentPaths$slice$ = (_currentPaths$slice = currentPaths.slice(-1)) == null ? void 0 : _currentPaths$slice[0]) != null ? _currentPaths$slice$ : null; |
| 8962 |
if (lastStroke === null) { |
| 8963 |
console.warn("No stroke found!"); |
| 8964 |
return; |
| 8965 |
} |
| 8966 |
onStroke(lastStroke, !lastStroke.drawMode); |
| 8967 |
}, [isDrawing]); |
| 8968 |
react.useEffect(function() { |
| 8969 |
liftStrokeUp(); |
| 8970 |
}, [isDrawing]); |
| 8971 |
react.useEffect(function() { |
| 8972 |
onChange(currentPaths); |
| 8973 |
}, [currentPaths]); |
| 8974 |
react.useImperativeHandle(ref, function() { |
| 8975 |
return { |
| 8976 |
eraseMode: function eraseMode(erase) { |
| 8977 |
setDrawMode(!erase); |
| 8978 |
}, |
| 8979 |
clearCanvas: function clearCanvas() { |
| 8980 |
setResetStack([].concat(currentPaths)); |
| 8981 |
setCurrentPaths([]); |
| 8982 |
}, |
| 8983 |
undo: function undo() { |
| 8984 |
if (resetStack.length !== 0) { |
| 8985 |
setCurrentPaths([].concat(resetStack)); |
| 8986 |
setResetStack([]); |
| 8987 |
return; |
| 8988 |
} |
| 8989 |
setUndoStack(function(undoStack) { |
| 8990 |
return [].concat(undoStack, currentPaths.slice(-1)); |
| 8991 |
}); |
| 8992 |
setCurrentPaths(function(currentPaths) { |
| 8993 |
return currentPaths.slice(0, -1); |
| 8994 |
}); |
| 8995 |
}, |
| 8996 |
redo: function redo() { |
| 8997 |
if (undoStack.length === 0) return; |
| 8998 |
setCurrentPaths(function(currentPaths) { |
| 8999 |
return [].concat(currentPaths, undoStack.slice(-1)); |
| 9000 |
}); |
| 9001 |
setUndoStack(function(undoStack) { |
| 9002 |
return undoStack.slice(0, -1); |
| 9003 |
}); |
| 9004 |
}, |
| 9005 |
exportImage: function exportImage(imageType) { |
| 9006 |
var _svgCanvas$current; |
| 9007 |
var exportImage = (_svgCanvas$current = svgCanvas.current) == null ? void 0 : _svgCanvas$current.exportImage; |
| 9008 |
if (!exportImage) throw Error("Export function called before canvas loaded"); |
| 9009 |
else return exportImage(imageType); |
| 9010 |
}, |
| 9011 |
exportSvg: function exportSvg() { |
| 9012 |
return new Promise(function(resolve, reject) { |
| 9013 |
var _svgCanvas$current2; |
| 9014 |
var exportSvg = (_svgCanvas$current2 = svgCanvas.current) == null ? void 0 : _svgCanvas$current2.exportSvg; |
| 9015 |
if (!exportSvg) reject(Error("Export function called before canvas loaded")); |
| 9016 |
else exportSvg().then(function(data) { |
| 9017 |
resolve(data); |
| 9018 |
})["catch"](function(e) { |
| 9019 |
reject(e); |
| 9020 |
}); |
| 9021 |
}); |
| 9022 |
}, |
| 9023 |
exportPaths: function exportPaths() { |
| 9024 |
return new Promise(function(resolve, reject) { |
| 9025 |
try { |
| 9026 |
resolve(currentPaths); |
| 9027 |
} catch (e) { |
| 9028 |
reject(e); |
| 9029 |
} |
| 9030 |
}); |
| 9031 |
}, |
| 9032 |
loadPaths: function loadPaths(paths) { |
| 9033 |
setCurrentPaths(function(currentPaths) { |
| 9034 |
return [].concat(currentPaths, paths); |
| 9035 |
}); |
| 9036 |
}, |
| 9037 |
getSketchingTime: function getSketchingTime() { |
| 9038 |
return new Promise(function(resolve, reject) { |
| 9039 |
if (!withTimestamp) reject(/* @__PURE__ */ new Error("Set 'withTimestamp' prop to get sketching time")); |
| 9040 |
try { |
| 9041 |
resolve(currentPaths.reduce(function(totalSketchingTime, path) { |
| 9042 |
var _path$startTimestamp; |
| 9043 |
var _path$endTimestamp; |
| 9044 |
var startTimestamp = (_path$startTimestamp = path.startTimestamp) != null ? _path$startTimestamp : 0; |
| 9045 |
return totalSketchingTime + (((_path$endTimestamp = path.endTimestamp) != null ? _path$endTimestamp : 0) - startTimestamp); |
| 9046 |
}, 0)); |
| 9047 |
} catch (e) { |
| 9048 |
reject(e); |
| 9049 |
} |
| 9050 |
}); |
| 9051 |
}, |
| 9052 |
resetCanvas: function resetCanvas() { |
| 9053 |
setResetStack([]); |
| 9054 |
setUndoStack([]); |
| 9055 |
setCurrentPaths([]); |
| 9056 |
} |
| 9057 |
}; |
| 9058 |
}); |
| 9059 |
return react.createElement(Canvas, { |
| 9060 |
ref: svgCanvas, |
| 9061 |
id, |
| 9062 |
width, |
| 9063 |
height, |
| 9064 |
className, |
| 9065 |
canvasColor, |
| 9066 |
backgroundImage, |
| 9067 |
exportWithBackgroundImage, |
| 9068 |
preserveBackgroundImageAspectRatio, |
| 9069 |
allowOnlyPointerType, |
| 9070 |
style, |
| 9071 |
svgStyle, |
| 9072 |
paths: currentPaths, |
| 9073 |
isDrawing, |
| 9074 |
onPointerDown: function handlePointerDown(point) { |
| 9075 |
setIsDrawing(true); |
| 9076 |
setUndoStack([]); |
| 9077 |
var stroke = { |
| 9078 |
drawMode, |
| 9079 |
strokeColor: drawMode ? strokeColor : "#000000", |
| 9080 |
strokeWidth: drawMode ? strokeWidth : eraserWidth, |
| 9081 |
paths: [point] |
| 9082 |
}; |
| 9083 |
if (withTimestamp) stroke = _extends({}, stroke, { |
| 9084 |
startTimestamp: Date.now(), |
| 9085 |
endTimestamp: 0 |
| 9086 |
}); |
| 9087 |
setCurrentPaths(function(currentPaths) { |
| 9088 |
return [].concat(currentPaths, [stroke]); |
| 9089 |
}); |
| 9090 |
}, |
| 9091 |
onPointerMove: function handlePointerMove(point) { |
| 9092 |
if (!isDrawing) return; |
| 9093 |
var currentStroke = currentPaths.slice(-1)[0]; |
| 9094 |
var updatedStroke = _extends({}, currentStroke, { paths: [].concat(currentStroke.paths, [point]) }); |
| 9095 |
setCurrentPaths(function(currentPaths) { |
| 9096 |
return [].concat(currentPaths.slice(0, -1), [updatedStroke]); |
| 9097 |
}); |
| 9098 |
}, |
| 9099 |
onPointerUp: function handlePointerUp() { |
| 9100 |
var _currentPaths$slice$2; |
| 9101 |
var _currentPaths$slice2; |
| 9102 |
if (!isDrawing) return; |
| 9103 |
setIsDrawing(false); |
| 9104 |
if (!withTimestamp) return; |
| 9105 |
var currentStroke = (_currentPaths$slice$2 = (_currentPaths$slice2 = currentPaths.slice(-1)) == null ? void 0 : _currentPaths$slice2[0]) != null ? _currentPaths$slice$2 : null; |
| 9106 |
if (currentStroke === null) return; |
| 9107 |
var updatedStroke = _extends({}, currentStroke, { endTimestamp: Date.now() }); |
| 9108 |
setCurrentPaths(function(currentPaths) { |
| 9109 |
return [].concat(currentPaths.slice(0, -1), [updatedStroke]); |
| 9110 |
}); |
| 9111 |
} |
| 9112 |
}); |
| 9113 |
}); |
| 9114 |
|
| 9115 |
//#endregion |
| 9116 |
//#region modules/ai/assets/js/editor/icons/undo-icon.js |
| 9117 |
init_extends(); |
| 9118 |
var UndoIcon = react.default.forwardRef(function(props, ref) { |
| 9119 |
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" })); |
| 9120 |
}); |
| 9121 |
|
| 9122 |
//#endregion |
| 9123 |
//#region modules/ai/assets/js/editor/icons/redo-icon.js |
| 9124 |
init_extends(); |
| 9125 |
var RedoIcon = react.default.forwardRef(function(props, ref) { |
| 9126 |
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" })); |
| 9127 |
}); |
| 9128 |
|
| 9129 |
//#endregion |
| 9130 |
//#region modules/ai/assets/js/editor/pages/form-media/views/in-painting/in-painting-content.js |
| 9131 |
init_asyncToGenerator(); |
| 9132 |
init_slicedToArray(); |
| 9133 |
var STROKE_SELECT_WIDTH$1 = 120; |
| 9134 |
var BRUSH_COLOR$1 = "rgba(255, 255, 255)"; |
| 9135 |
var CANVAS_COLOR$1 = "rgba(0, 0, 0)"; |
| 9136 |
var StyledUndoIcon$1 = (0, _elementor_ui.withDirection)(UndoIcon); |
| 9137 |
var StyledRedoIcon$1 = (0, _elementor_ui.withDirection)(RedoIcon); |
| 9138 |
var BrushCursor$1 = (0, _elementor_ui.styled)(_elementor_ui.Box, { shouldForwardProp: function shouldForwardProp(prop) { |
| 9139 |
return "size" === prop; |
| 9140 |
} })(function(_ref) { |
| 9141 |
var theme = _ref.theme; |
| 9142 |
var size = _ref.size; |
| 9143 |
return { |
| 9144 |
position: "absolute", |
| 9145 |
width: size, |
| 9146 |
height: size, |
| 9147 |
borderRadius: "50%", |
| 9148 |
backgroundColor: BRUSH_COLOR$1, |
| 9149 |
pointerEvents: "none", |
| 9150 |
transform: "translate(".concat("rtl" === theme.direction ? "50%" : "-50%", ", -50%)"), |
| 9151 |
border: "1px solid #fff" |
| 9152 |
}; |
| 9153 |
}); |
| 9154 |
var BrishSizeIcon$1 = (0, _elementor_ui.styled)(_elementor_ui.Box, { shouldForwardProp: function shouldForwardProp(prop) { |
| 9155 |
return "size" === prop; |
| 9156 |
} })(function(_ref2) { |
| 9157 |
var theme = _ref2.theme; |
| 9158 |
var size = _ref2.size; |
| 9159 |
return { |
| 9160 |
width: size / 2, |
| 9161 |
height: size / 2, |
| 9162 |
borderRadius: "50%", |
| 9163 |
backgroundColor: theme.palette.secondary.main |
| 9164 |
}; |
| 9165 |
}); |
| 9166 |
var InPaintingContent = function InPaintingContent(_ref3) { |
| 9167 |
var editImage = _ref3.editImage; |
| 9168 |
var setMask = _ref3.setMask; |
| 9169 |
var setIsCanvasChanged = _ref3.setIsCanvasChanged; |
| 9170 |
var canvasWidth = _ref3.width; |
| 9171 |
var canvasHeight = _ref3.height; |
| 9172 |
var sketchRef = (0, react.useRef)(); |
| 9173 |
var _useState2 = _slicedToArray((0, react.useState)(30), 2); |
| 9174 |
var stroke = _useState2[0]; |
| 9175 |
var setStroke = _useState2[1]; |
| 9176 |
var brushCursorRef = (0, react.useRef)(); |
| 9177 |
(0, react.useEffect)(function() { |
| 9178 |
var canvas = document.querySelector(".eui-in-painting-canvas"); |
| 9179 |
var positionElement = function positionElement(e) { |
| 9180 |
var _canvas$getBoundingCl = canvas.getBoundingClientRect(); |
| 9181 |
var left = _canvas$getBoundingCl.left; |
| 9182 |
var top = _canvas$getBoundingCl.top; |
| 9183 |
var width = _canvas$getBoundingCl.width; |
| 9184 |
var height = _canvas$getBoundingCl.height; |
| 9185 |
var x = e.clientX - left; |
| 9186 |
var y = e.clientY - top; |
| 9187 |
if (x > 0 && x < width && y > 0 && y < height) { |
| 9188 |
brushCursorRef.current.style.left = "".concat(x, "px"); |
| 9189 |
brushCursorRef.current.style.top = "".concat(y, "px"); |
| 9190 |
} |
| 9191 |
}; |
| 9192 |
window.addEventListener("mousemove", positionElement); |
| 9193 |
return function() { |
| 9194 |
window.removeEventListener("mousemove", positionElement); |
| 9195 |
}; |
| 9196 |
}, [stroke]); |
| 9197 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, { |
| 9198 |
alignItems: "flex-start", |
| 9199 |
spacing: .5, |
| 9200 |
flexGrow: 1 |
| 9201 |
}, /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, { |
| 9202 |
width: "100%", |
| 9203 |
direction: "row", |
| 9204 |
spacing: 3, |
| 9205 |
alignSelf: "center", |
| 9206 |
justifyContent: "center", |
| 9207 |
sx: { marginBottom: "20px !important" } |
| 9208 |
}, /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, { |
| 9209 |
direction: "row", |
| 9210 |
gap: 1 |
| 9211 |
}, /*#__PURE__*/ react.default.createElement(_elementor_ui.Tooltip, { title: (0, _wordpress_i18n.__)("Undo", "elementor") }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Button, { |
| 9212 |
variant: "outlined", |
| 9213 |
color: "secondary", |
| 9214 |
onClick: function onClick() { |
| 9215 |
return sketchRef.current.undo(); |
| 9216 |
}, |
| 9217 |
sx: { px: 0 } |
| 9218 |
}, /*#__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, { |
| 9219 |
variant: "outlined", |
| 9220 |
color: "secondary", |
| 9221 |
onClick: function onClick() { |
| 9222 |
return sketchRef.current.redo(); |
| 9223 |
}, |
| 9224 |
sx: { px: 0 } |
| 9225 |
}, /*#__PURE__*/ react.default.createElement(StyledRedoIcon$1, null)))), /*#__PURE__*/ react.default.createElement(_elementor_ui.FormControl, { |
| 9226 |
size: "small", |
| 9227 |
color: "secondary", |
| 9228 |
sx: { minWidth: STROKE_SELECT_WIDTH$1 } |
| 9229 |
}, /*#__PURE__*/ react.default.createElement(_elementor_ui.InputLabel, { id: "stroke" }, "Stroke"), /*#__PURE__*/ react.default.createElement(_elementor_ui.Select, { |
| 9230 |
autoWidth: true, |
| 9231 |
label: "Stroke", |
| 9232 |
value: stroke, |
| 9233 |
id: "demo-simple-select", |
| 9234 |
labelId: "demo-simple-select-label", |
| 9235 |
onChange: function onChange(e) { |
| 9236 |
return setStroke(e.target.value); |
| 9237 |
}, |
| 9238 |
MenuProps: { |
| 9239 |
PaperProps: { sx: { maxWidth: STROKE_SELECT_WIDTH$1 } }, |
| 9240 |
MenuListProps: { sx: { minWidth: STROKE_SELECT_WIDTH$1 } } |
| 9241 |
}, |
| 9242 |
sx: { "& .MuiSelect-select .MuiListItemIcon-root": { |
| 9243 |
mr: .25, |
| 9244 |
width: "initial", |
| 9245 |
minWidth: "initial", |
| 9246 |
justifyContent: "flex-start" |
| 9247 |
} } |
| 9248 |
}, [ |
| 9249 |
10, |
| 9250 |
20, |
| 9251 |
30, |
| 9252 |
40, |
| 9253 |
50 |
| 9254 |
].map(function(value) { |
| 9255 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.MenuItem, { |
| 9256 |
key: "stroke-width-option-" + value, |
| 9257 |
value |
| 9258 |
}, /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, { |
| 9259 |
direction: "row", |
| 9260 |
alignItems: "center", |
| 9261 |
gap: 1 |
| 9262 |
}, /*#__PURE__*/ react.default.createElement(_elementor_ui.ListItemIcon, { sx: { |
| 9263 |
width: 30, |
| 9264 |
display: "flex", |
| 9265 |
justifyContent: "center" |
| 9266 |
} }, /*#__PURE__*/ react.default.createElement(BrishSizeIcon$1, { size: value })), /*#__PURE__*/ react.default.createElement(_elementor_ui.ListItemText, null, value))); |
| 9267 |
})))), /*#__PURE__*/ react.default.createElement("div", { style: { |
| 9268 |
margin: "0 auto", |
| 9269 |
position: "relative", |
| 9270 |
cursor: "none", |
| 9271 |
overflow: "hidden" |
| 9272 |
} }, /*#__PURE__*/ react.default.createElement(BrushCursor$1, { |
| 9273 |
ref: brushCursorRef, |
| 9274 |
size: stroke |
| 9275 |
}), /*#__PURE__*/ react.default.createElement(ReactSketchCanvas, { |
| 9276 |
className: "eui-in-painting-canvas", |
| 9277 |
withViewBox: true, |
| 9278 |
ref: sketchRef, |
| 9279 |
height: canvasHeight + "px", |
| 9280 |
width: canvasWidth + "px", |
| 9281 |
strokeWidth: stroke, |
| 9282 |
strokeColor: BRUSH_COLOR$1, |
| 9283 |
canvasColor: CANVAS_COLOR$1, |
| 9284 |
backgroundImage: editImage.url, |
| 9285 |
onStroke: function onStroke() { |
| 9286 |
return setIsCanvasChanged(true); |
| 9287 |
}, |
| 9288 |
onChange: /*#__PURE__*/ _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee() { |
| 9289 |
var svg; |
| 9290 |
return import_regenerator$2.default.wrap(function(_context) { |
| 9291 |
while (1) switch (_context.prev = _context.next) { |
| 9292 |
case 0: |
| 9293 |
_context.next = 1; |
| 9294 |
return sketchRef.current.exportSvg(); |
| 9295 |
case 1: |
| 9296 |
svg = _context.sent; |
| 9297 |
setMask(svg); |
| 9298 |
case 2: |
| 9299 |
case "end": return _context.stop(); |
| 9300 |
} |
| 9301 |
}, _callee); |
| 9302 |
})) |
| 9303 |
}))); |
| 9304 |
}; |
| 9305 |
InPaintingContent.propTypes = { |
| 9306 |
setMask: import_prop_types$8.default.func.isRequired, |
| 9307 |
setIsCanvasChanged: import_prop_types$8.default.func.isRequired, |
| 9308 |
width: import_prop_types$8.default.number.isRequired, |
| 9309 |
height: import_prop_types$8.default.number.isRequired, |
| 9310 |
editImage: import_prop_types$8.default.object.isRequired |
| 9311 |
}; |
| 9312 |
|
| 9313 |
//#endregion |
| 9314 |
//#region modules/ai/assets/js/editor/pages/form-media/views/in-painting/hooks/use-in-painting.js |
| 9315 |
init_api(); |
| 9316 |
var useInPainting = function useInPainting(initialValue) { |
| 9317 |
return useImagePrompt(function fetchAction(payload) { |
| 9318 |
return getImageToImageMaskGeneration(payload); |
| 9319 |
}, initialValue); |
| 9320 |
}; |
| 9321 |
|
| 9322 |
//#endregion |
| 9323 |
//#region modules/ai/assets/js/editor/pages/form-media/views/in-painting/index.js |
| 9324 |
init_asyncToGenerator(); |
| 9325 |
init_slicedToArray(); |
| 9326 |
init_requests_ids(); |
| 9327 |
var InPainting = function InPainting() { |
| 9328 |
var _useState2 = _slicedToArray((0, react.useState)(""), 2); |
| 9329 |
var prompt = _useState2[0]; |
| 9330 |
var setPrompt = _useState2[1]; |
| 9331 |
var setGenerate = useRequestIds().setGenerate; |
| 9332 |
var _useState4 = _slicedToArray((0, react.useState)(""), 2); |
| 9333 |
var mask = _useState4[0]; |
| 9334 |
var setMask = _useState4[1]; |
| 9335 |
var _useState6 = _slicedToArray((0, react.useState)(false), 2); |
| 9336 |
var isCanvasChanged = _useState6[0]; |
| 9337 |
var setIsCanvasChanged = _useState6[1]; |
| 9338 |
var _usePromptSettings = usePromptSettings(); |
| 9339 |
var settings = _usePromptSettings.settings; |
| 9340 |
var resetSettings = _usePromptSettings.resetSettings; |
| 9341 |
var _useEditImage = useEditImage(); |
| 9342 |
var editImage = _useEditImage.editImage; |
| 9343 |
var width = _useEditImage.width; |
| 9344 |
var height = _useEditImage.height; |
| 9345 |
var _useImageActions = useImageActions(); |
| 9346 |
var use = _useImageActions.use; |
| 9347 |
var edit = _useImageActions.edit; |
| 9348 |
var isUploading = _useImageActions.isLoading; |
| 9349 |
var _useInPainting = useInPainting(); |
| 9350 |
var data = _useInPainting.data; |
| 9351 |
var send = _useInPainting.send; |
| 9352 |
var isGenerating = _useInPainting.isLoading; |
| 9353 |
var error = _useInPainting.error; |
| 9354 |
var reset = _useInPainting.reset; |
| 9355 |
var isLoading = isGenerating || isUploading; |
| 9356 |
var handleSubmit = /*#__PURE__*/ function() { |
| 9357 |
var _ref = _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee(event) { |
| 9358 |
var finalPrompt; |
| 9359 |
return import_regenerator$2.default.wrap(function(_context) { |
| 9360 |
while (1) switch (_context.prev = _context.next) { |
| 9361 |
case 0: |
| 9362 |
event.preventDefault(); |
| 9363 |
finalPrompt = prompt || "Remove object and fill based on the surroundings"; |
| 9364 |
setGenerate(); |
| 9365 |
send({ |
| 9366 |
prompt: finalPrompt, |
| 9367 |
settings, |
| 9368 |
image: editImage, |
| 9369 |
mask |
| 9370 |
}); |
| 9371 |
case 1: |
| 9372 |
case "end": return _context.stop(); |
| 9373 |
} |
| 9374 |
}, _callee); |
| 9375 |
})); |
| 9376 |
return function handleSubmit(_x) { |
| 9377 |
return _ref.apply(this, arguments); |
| 9378 |
}; |
| 9379 |
}(); |
| 9380 |
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, { |
| 9381 |
primary: (0, _wordpress_i18n.__)("Generative Fill", "elementor"), |
| 9382 |
secondary: (0, _wordpress_i18n.__)("Mark an area and edit it with a prompt.", "elementor") |
| 9383 |
}), error && /*#__PURE__*/ react.default.createElement(View.ErrorMessage, { |
| 9384 |
error, |
| 9385 |
onRetry: handleSubmit |
| 9386 |
}), /*#__PURE__*/ react.default.createElement(ImageForm, { onSubmit: handleSubmit }, /*#__PURE__*/ react.default.createElement(PromptField, { |
| 9387 |
value: prompt, |
| 9388 |
disabled: isLoading, |
| 9389 |
onChange: setPrompt, |
| 9390 |
placeholder: (0, _wordpress_i18n.__)("Describe what you want to generate in the marked area (English only)", "elementor") |
| 9391 |
}), data !== null && data !== void 0 && data.result ? /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, { |
| 9392 |
gap: 2, |
| 9393 |
sx: { my: 2.5 } |
| 9394 |
}, /*#__PURE__*/ react.default.createElement(GenerateAgainSubmit, { disabled: isLoading }), /*#__PURE__*/ react.default.createElement(NewPromptButton, { |
| 9395 |
disabled: isLoading, |
| 9396 |
onClick: function onClick() { |
| 9397 |
resetSettings(); |
| 9398 |
setPrompt(""); |
| 9399 |
reset(); |
| 9400 |
} |
| 9401 |
})) : /*#__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, { |
| 9402 |
images: data.result, |
| 9403 |
aspectRatio: editImage.aspectRatio, |
| 9404 |
onUseImage: use, |
| 9405 |
onEditImage: edit |
| 9406 |
}) : /*#__PURE__*/ react.default.createElement(InPaintingContent, { |
| 9407 |
editImage, |
| 9408 |
width, |
| 9409 |
height, |
| 9410 |
setMask, |
| 9411 |
setIsCanvasChanged |
| 9412 |
}))); |
| 9413 |
}; |
| 9414 |
|
| 9415 |
//#endregion |
| 9416 |
//#region node_modules/react-avatar-editor/dist/index.js |
| 9417 |
var require_dist = /* @__PURE__ */ __commonJSMin(((exports, module) => { |
| 9418 |
(function(e, t) { |
| 9419 |
"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); |
| 9420 |
})(exports, function(e, t) { |
| 9421 |
"use strict"; |
| 9422 |
function o(e) { |
| 9423 |
return e && "object" == typeof e && "default" in e ? e : { default: e }; |
| 9424 |
} |
| 9425 |
var n = o(e); |
| 9426 |
var i = o(t); |
| 9427 |
function r(e, t) { |
| 9428 |
for (var o = 0; o < t.length; o++) { |
| 9429 |
var n = t[o]; |
| 9430 |
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n); |
| 9431 |
} |
| 9432 |
} |
| 9433 |
function s(e, t, o) { |
| 9434 |
return t in e ? Object.defineProperty(e, t, { |
| 9435 |
value: o, |
| 9436 |
enumerable: !0, |
| 9437 |
configurable: !0, |
| 9438 |
writable: !0 |
| 9439 |
}) : e[t] = o, e; |
| 9440 |
} |
| 9441 |
function u() { |
| 9442 |
return (u = Object.assign || function(e) { |
| 9443 |
for (var t = 1; t < arguments.length; t++) { |
| 9444 |
var o = arguments[t]; |
| 9445 |
for (var n in o) Object.prototype.hasOwnProperty.call(o, n) && (e[n] = o[n]); |
| 9446 |
} |
| 9447 |
return e; |
| 9448 |
}).apply(this, arguments); |
| 9449 |
} |
| 9450 |
function a(t, e) { |
| 9451 |
var o; |
| 9452 |
var n = Object.keys(t); |
| 9453 |
return Object.getOwnPropertySymbols && (o = Object.getOwnPropertySymbols(t), e && (o = o.filter(function(e) { |
| 9454 |
return Object.getOwnPropertyDescriptor(t, e).enumerable; |
| 9455 |
})), n.push.apply(n, o)), n; |
| 9456 |
} |
| 9457 |
function y(t) { |
| 9458 |
for (var e = 1; e < arguments.length; e++) { |
| 9459 |
var o = null != arguments[e] ? arguments[e] : {}; |
| 9460 |
e % 2 ? a(Object(o), !0).forEach(function(e) { |
| 9461 |
s(t, e, o[e]); |
| 9462 |
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(o)) : a(Object(o)).forEach(function(e) { |
| 9463 |
Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(o, e)); |
| 9464 |
}); |
| 9465 |
} |
| 9466 |
return t; |
| 9467 |
} |
| 9468 |
function h(e) { |
| 9469 |
return (h = Object.setPrototypeOf ? Object.getPrototypeOf : function(e) { |
| 9470 |
return e.__proto__ || Object.getPrototypeOf(e); |
| 9471 |
})(e); |
| 9472 |
} |
| 9473 |
function c(e, t) { |
| 9474 |
return (c = Object.setPrototypeOf || function(e, t) { |
| 9475 |
return e.__proto__ = t, e; |
| 9476 |
})(e, t); |
| 9477 |
} |
| 9478 |
function l(e, t) { |
| 9479 |
if (null == e) return {}; |
| 9480 |
var o; |
| 9481 |
var n = function(e, t) { |
| 9482 |
if (null == e) return {}; |
| 9483 |
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]); |
| 9484 |
return n; |
| 9485 |
}(e, t); |
| 9486 |
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]); |
| 9487 |
return n; |
| 9488 |
} |
| 9489 |
function d(e) { |
| 9490 |
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); |
| 9491 |
return e; |
| 9492 |
} |
| 9493 |
function p(r) { |
| 9494 |
var i = function() { |
| 9495 |
if ("undefined" == typeof Reflect || !Reflect.construct) return !1; |
| 9496 |
if (Reflect.construct.sham) return !1; |
| 9497 |
if ("function" == typeof Proxy) return !0; |
| 9498 |
try { |
| 9499 |
return Date.prototype.toString.call(Reflect.construct(Date, [], function() {})), !0; |
| 9500 |
} catch (e) { |
| 9501 |
return !1; |
| 9502 |
} |
| 9503 |
}(); |
| 9504 |
return function() { |
| 9505 |
var e; |
| 9506 |
var t; |
| 9507 |
var o; |
| 9508 |
var n; |
| 9509 |
var a = h(r); |
| 9510 |
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; |
| 9511 |
}; |
| 9512 |
} |
| 9513 |
function m(e, t) { |
| 9514 |
return function(e) { |
| 9515 |
if (Array.isArray(e)) return e; |
| 9516 |
}(e) || function(e, t) { |
| 9517 |
if ("undefined" == typeof Symbol || !(Symbol.iterator in Object(e))) return; |
| 9518 |
var o = []; |
| 9519 |
var n = !0; |
| 9520 |
var a = !1; |
| 9521 |
var r = void 0; |
| 9522 |
try { |
| 9523 |
for (var i, s = e[Symbol.iterator](); !(n = (i = s.next()).done) && (o.push(i.value), !t || o.length !== t); n = !0); |
| 9524 |
} catch (e) { |
| 9525 |
a = !0, r = e; |
| 9526 |
} finally { |
| 9527 |
try { |
| 9528 |
n || null == s.return || s.return(); |
| 9529 |
} finally { |
| 9530 |
if (a) throw r; |
| 9531 |
} |
| 9532 |
} |
| 9533 |
return o; |
| 9534 |
}(e, t) || g(e, t) || function() { |
| 9535 |
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); |
| 9536 |
}(); |
| 9537 |
} |
| 9538 |
function g(e, t) { |
| 9539 |
if (e) { |
| 9540 |
if ("string" == typeof e) return f(e, t); |
| 9541 |
var o = Object.prototype.toString.call(e).slice(8, -1); |
| 9542 |
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; |
| 9543 |
} |
| 9544 |
} |
| 9545 |
function f(e, t) { |
| 9546 |
(null == t || t > e.length) && (t = e.length); |
| 9547 |
for (var o = 0, n = new Array(t); o < t; o++) n[o] = e[o]; |
| 9548 |
return n; |
| 9549 |
} |
| 9550 |
function v(a, r) { |
| 9551 |
return new Promise(function(e, t) { |
| 9552 |
var o; |
| 9553 |
var n = new Image(); |
| 9554 |
n.onload = function() { |
| 9555 |
return e(n); |
| 9556 |
}, 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; |
| 9557 |
}); |
| 9558 |
} |
| 9559 |
var b; |
| 9560 |
var w = !("undefined" == typeof window || "undefined" == typeof navigator || !("ontouchstart" in window || 0 < navigator.msMaxTouchPoints)); |
| 9561 |
var M = "undefined" != typeof File; |
| 9562 |
var O = { |
| 9563 |
touch: { |
| 9564 |
react: { |
| 9565 |
down: "onTouchStart", |
| 9566 |
mouseDown: "onMouseDown", |
| 9567 |
drag: "onTouchMove", |
| 9568 |
move: "onTouchMove", |
| 9569 |
mouseMove: "onMouseMove", |
| 9570 |
up: "onTouchEnd", |
| 9571 |
mouseUp: "onMouseUp" |
| 9572 |
}, |
| 9573 |
native: { |
| 9574 |
down: "touchstart", |
| 9575 |
mouseDown: "mousedown", |
| 9576 |
drag: "touchmove", |
| 9577 |
move: "touchmove", |
| 9578 |
mouseMove: "mousemove", |
| 9579 |
up: "touchend", |
| 9580 |
mouseUp: "mouseup" |
| 9581 |
} |
| 9582 |
}, |
| 9583 |
desktop: { |
| 9584 |
react: { |
| 9585 |
down: "onMouseDown", |
| 9586 |
drag: "onDragOver", |
| 9587 |
move: "onMouseMove", |
| 9588 |
up: "onMouseUp" |
| 9589 |
}, |
| 9590 |
native: { |
| 9591 |
down: "mousedown", |
| 9592 |
drag: "dragStart", |
| 9593 |
move: "mousemove", |
| 9594 |
up: "mouseup" |
| 9595 |
} |
| 9596 |
} |
| 9597 |
}; |
| 9598 |
var I = w ? O.touch : O.desktop; |
| 9599 |
var P = "undefined" != typeof window && window.devicePixelRatio ? window.devicePixelRatio : 1; |
| 9600 |
var C = { |
| 9601 |
x: .5, |
| 9602 |
y: .5 |
| 9603 |
}; |
| 9604 |
var x = function() { |
| 9605 |
(function(e, t) { |
| 9606 |
if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function"); |
| 9607 |
e.prototype = Object.create(t && t.prototype, { constructor: { |
| 9608 |
value: e, |
| 9609 |
writable: !0, |
| 9610 |
configurable: !0 |
| 9611 |
} }), t && c(e, t); |
| 9612 |
})(a, i["default"].Component); |
| 9613 |
var e; |
| 9614 |
var t; |
| 9615 |
var o; |
| 9616 |
var n = p(a); |
| 9617 |
function a(e) { |
| 9618 |
var v; |
| 9619 |
return function(e, t) { |
| 9620 |
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function"); |
| 9621 |
}(this, a), s(d(v = n.call(this, e)), "state", { |
| 9622 |
drag: !1, |
| 9623 |
my: null, |
| 9624 |
mx: null, |
| 9625 |
image: C |
| 9626 |
}), s(d(v), "handleImageReady", function(e) { |
| 9627 |
var t = v.getInitialSize(e.width, e.height); |
| 9628 |
t.resource = e, t.x = .5, t.y = .5, t.backgroundColor = v.props.backgroundColor, v.setState({ |
| 9629 |
drag: !1, |
| 9630 |
image: t |
| 9631 |
}, v.props.onImageReady), v.props.onLoadSuccess(t); |
| 9632 |
}), s(d(v), "clearImage", function() { |
| 9633 |
v.canvas.getContext("2d").clearRect(0, 0, v.canvas.width, v.canvas.height), v.setState({ image: C }); |
| 9634 |
}), s(d(v), "handleMouseDown", function(e) { |
| 9635 |
(e = e || window.event).preventDefault(), v.setState({ |
| 9636 |
drag: !0, |
| 9637 |
mx: null, |
| 9638 |
my: null |
| 9639 |
}); |
| 9640 |
}), s(d(v), "handleMouseUp", function() { |
| 9641 |
v.state.drag && (v.setState({ drag: !1 }), v.props.onMouseUp()); |
| 9642 |
}), s(d(v), "handleMouseMove", function(e) { |
| 9643 |
var t; |
| 9644 |
var o; |
| 9645 |
var n; |
| 9646 |
var a; |
| 9647 |
var r; |
| 9648 |
var i; |
| 9649 |
var s; |
| 9650 |
var u; |
| 9651 |
var h; |
| 9652 |
var c; |
| 9653 |
var l; |
| 9654 |
var d; |
| 9655 |
var p; |
| 9656 |
var g; |
| 9657 |
var f; |
| 9658 |
var m; |
| 9659 |
e = e || window.event, !1 !== v.state.drag && (e.preventDefault(), n = { |
| 9660 |
mx: t = e.targetTouches ? e.targetTouches[0].pageX : e.clientX, |
| 9661 |
my: o = e.targetTouches ? e.targetTouches[0].pageY : e.clientY |
| 9662 |
}, 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) { |
| 9663 |
return e * (Math.PI / 180); |
| 9664 |
}, d = Math.cos(l(m)), g = c + -a * (p = Math.sin(l(m))) + r * d, f = { |
| 9665 |
x: (h + a * d + r * p) / i + 1 / v.props.scale * v.getXScale() / 2, |
| 9666 |
y: g / s + 1 / v.props.scale * v.getYScale() / 2 |
| 9667 |
}, v.props.onPositionChange(f), n.image = y(y({}, v.state.image), f)), v.setState(n), v.props.onMouseMove(e)); |
| 9668 |
}), s(d(v), "setCanvas", function(e) { |
| 9669 |
v.canvas = e; |
| 9670 |
}), v.canvas = null, v; |
| 9671 |
} |
| 9672 |
return e = a, (t = [ |
| 9673 |
{ |
| 9674 |
key: "componentDidMount", |
| 9675 |
value: function() { |
| 9676 |
this.props.disableHiDPIScaling && (P = 1); |
| 9677 |
var e; |
| 9678 |
var t; |
| 9679 |
var o = this.canvas.getContext("2d"); |
| 9680 |
this.props.image && this.loadImage(this.props.image), this.paint(o), document && (e = !!function() { |
| 9681 |
var t = !1; |
| 9682 |
try { |
| 9683 |
var e = Object.defineProperty({}, "passive", { get: function() { |
| 9684 |
t = !0; |
| 9685 |
} }); |
| 9686 |
window.addEventListener("test", e, e), window.removeEventListener("test", e, e); |
| 9687 |
} catch (e) { |
| 9688 |
t = !1; |
| 9689 |
} |
| 9690 |
return t; |
| 9691 |
}() && { 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))); |
| 9692 |
} |
| 9693 |
}, |
| 9694 |
{ |
| 9695 |
key: "componentDidUpdate", |
| 9696 |
value: function(e, t) { |
| 9697 |
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(); |
| 9698 |
var o = this.canvas.getContext("2d"); |
| 9699 |
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(); |
| 9700 |
} |
| 9701 |
}, |
| 9702 |
{ |
| 9703 |
key: "componentWillUnmount", |
| 9704 |
value: function() { |
| 9705 |
var e; |
| 9706 |
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))); |
| 9707 |
} |
| 9708 |
}, |
| 9709 |
{ |
| 9710 |
key: "isVertical", |
| 9711 |
value: function() { |
| 9712 |
return !this.props.disableCanvasRotation && this.props.rotate % 180 != 0; |
| 9713 |
} |
| 9714 |
}, |
| 9715 |
{ |
| 9716 |
key: "getBorders", |
| 9717 |
value: function(e) { |
| 9718 |
var t = 0 < arguments.length && void 0 !== e ? e : this.props.border; |
| 9719 |
return Array.isArray(t) ? t : [t, t]; |
| 9720 |
} |
| 9721 |
}, |
| 9722 |
{ |
| 9723 |
key: "getDimensions", |
| 9724 |
value: function() { |
| 9725 |
var e = this.props; |
| 9726 |
var t = e.width; |
| 9727 |
var o = e.height; |
| 9728 |
var n = e.rotate; |
| 9729 |
var a = e.border; |
| 9730 |
var r = {}; |
| 9731 |
var i = m(this.getBorders(a), 2); |
| 9732 |
var s = i[0]; |
| 9733 |
var u = i[1]; |
| 9734 |
var h = t; |
| 9735 |
var c = o; |
| 9736 |
return this.isVertical() ? (r.width = c, r.height = h) : (r.width = h, r.height = c), r.width += 2 * s, r.height += 2 * u, { |
| 9737 |
canvas: r, |
| 9738 |
rotate: n, |
| 9739 |
width: t, |
| 9740 |
height: o, |
| 9741 |
border: a |
| 9742 |
}; |
| 9743 |
} |
| 9744 |
}, |
| 9745 |
{ |
| 9746 |
key: "getImage", |
| 9747 |
value: function() { |
| 9748 |
var e = this.getCroppingRect(); |
| 9749 |
var t = this.state.image; |
| 9750 |
e.x *= t.resource.width, e.y *= t.resource.height, e.width *= t.resource.width, e.height *= t.resource.height; |
| 9751 |
var o = document.createElement("canvas"); |
| 9752 |
this.isVertical() ? (o.width = e.height, o.height = e.width) : (o.width = e.width, o.height = e.height); |
| 9753 |
var n = o.getContext("2d"); |
| 9754 |
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; |
| 9755 |
} |
| 9756 |
}, |
| 9757 |
{ |
| 9758 |
key: "getImageScaledToCanvas", |
| 9759 |
value: function() { |
| 9760 |
var e = this.getDimensions(); |
| 9761 |
var t = e.width; |
| 9762 |
var o = e.height; |
| 9763 |
var n = document.createElement("canvas"); |
| 9764 |
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; |
| 9765 |
} |
| 9766 |
}, |
| 9767 |
{ |
| 9768 |
key: "getXScale", |
| 9769 |
value: function() { |
| 9770 |
var e = this.props.width / this.props.height; |
| 9771 |
var t = this.state.image.width / this.state.image.height; |
| 9772 |
return Math.min(1, e / t); |
| 9773 |
} |
| 9774 |
}, |
| 9775 |
{ |
| 9776 |
key: "getYScale", |
| 9777 |
value: function() { |
| 9778 |
var e = this.props.height / this.props.width; |
| 9779 |
var t = this.state.image.height / this.state.image.width; |
| 9780 |
return Math.min(1, e / t); |
| 9781 |
} |
| 9782 |
}, |
| 9783 |
{ |
| 9784 |
key: "getCroppingRect", |
| 9785 |
value: function() { |
| 9786 |
var e = this.props.position || { |
| 9787 |
x: this.state.image.x, |
| 9788 |
y: this.state.image.y |
| 9789 |
}; |
| 9790 |
var t = 1 / this.props.scale * this.getXScale(); |
| 9791 |
var o = 1 / this.props.scale * this.getYScale(); |
| 9792 |
var n = { |
| 9793 |
x: e.x - t / 2, |
| 9794 |
y: e.y - o / 2, |
| 9795 |
width: t, |
| 9796 |
height: o |
| 9797 |
}; |
| 9798 |
var a = 0; |
| 9799 |
var r = 1 - n.width; |
| 9800 |
var i = 0; |
| 9801 |
var s = 1 - n.height; |
| 9802 |
return (this.props.disableBoundaryChecks || 1 < t || 1 < o) && (a = -n.width, i = -n.height, s = r = 1), y(y({}, n), {}, { |
| 9803 |
x: Math.max(a, Math.min(n.x, r)), |
| 9804 |
y: Math.max(i, Math.min(n.y, s)) |
| 9805 |
}); |
| 9806 |
} |
| 9807 |
}, |
| 9808 |
{ |
| 9809 |
key: "loadImage", |
| 9810 |
value: function(e) { |
| 9811 |
var t; |
| 9812 |
M && e instanceof File ? this.loadingImage = (t = e, new Promise(function(o, n) { |
| 9813 |
var e = new FileReader(); |
| 9814 |
e.onload = function(e) { |
| 9815 |
try { |
| 9816 |
o(v(e.target.result)); |
| 9817 |
} catch (e) { |
| 9818 |
n(e); |
| 9819 |
} |
| 9820 |
}, e.readAsDataURL(t); |
| 9821 |
}).then(this.handleImageReady).catch(this.props.onLoadFailure)) : "string" == typeof e && (this.loadingImage = v(e, this.props.crossOrigin).then(this.handleImageReady).catch(this.props.onLoadFailure)); |
| 9822 |
} |
| 9823 |
}, |
| 9824 |
{ |
| 9825 |
key: "getInitialSize", |
| 9826 |
value: function(e, t) { |
| 9827 |
var o; |
| 9828 |
var n; |
| 9829 |
var a = this.getDimensions(); |
| 9830 |
return t / e < a.height / a.width ? n = e * ((o = this.getDimensions().height) / t) : o = t * ((n = this.getDimensions().width) / e), { |
| 9831 |
height: o, |
| 9832 |
width: n |
| 9833 |
}; |
| 9834 |
} |
| 9835 |
}, |
| 9836 |
{ |
| 9837 |
key: "paintImage", |
| 9838 |
value: function(e, t, o, n) { |
| 9839 |
var a; |
| 9840 |
var r = 3 < arguments.length && void 0 !== n ? n : P; |
| 9841 |
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()); |
| 9842 |
} |
| 9843 |
}, |
| 9844 |
{ |
| 9845 |
key: "calculatePosition", |
| 9846 |
value: function(e, t) { |
| 9847 |
e = e || this.state.image; |
| 9848 |
var o = m(this.getBorders(t), 2); |
| 9849 |
var n = o[0]; |
| 9850 |
var a = o[1]; |
| 9851 |
var r = this.getCroppingRect(); |
| 9852 |
var i = e.width * this.props.scale; |
| 9853 |
var s = e.height * this.props.scale; |
| 9854 |
var u = -r.x * i; |
| 9855 |
var h = -r.y * s; |
| 9856 |
return this.isVertical() ? (u += a, h += n) : (u += n, h += a), { |
| 9857 |
x: u, |
| 9858 |
y: h, |
| 9859 |
height: s, |
| 9860 |
width: i |
| 9861 |
}; |
| 9862 |
} |
| 9863 |
}, |
| 9864 |
{ |
| 9865 |
key: "paint", |
| 9866 |
value: function(e) { |
| 9867 |
e.save(), e.scale(P, P), e.translate(0, 0), e.fillStyle = "rgba(" + this.props.color.slice(0, 4).join(",") + ")"; |
| 9868 |
var t; |
| 9869 |
var o; |
| 9870 |
var n; |
| 9871 |
var a; |
| 9872 |
var r; |
| 9873 |
var i; |
| 9874 |
var s; |
| 9875 |
var u; |
| 9876 |
var h = this.props.borderRadius; |
| 9877 |
var c = this.getDimensions(); |
| 9878 |
var l = m(this.getBorders(c.border), 2); |
| 9879 |
var d = l[0]; |
| 9880 |
var p = l[1]; |
| 9881 |
var g = c.canvas.height; |
| 9882 |
var f = c.canvas.width; |
| 9883 |
var h = Math.max(h, 0); |
| 9884 |
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(); |
| 9885 |
} |
| 9886 |
}, |
| 9887 |
{ |
| 9888 |
key: "render", |
| 9889 |
value: function() { |
| 9890 |
var e = this.props; |
| 9891 |
var t = (e.scale, e.rotate, e.image, e.border, e.borderRadius, e.width, e.height, e.position, e.color, e.backgroundColor, e.style); |
| 9892 |
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, [ |
| 9893 |
"scale", |
| 9894 |
"rotate", |
| 9895 |
"image", |
| 9896 |
"border", |
| 9897 |
"borderRadius", |
| 9898 |
"width", |
| 9899 |
"height", |
| 9900 |
"position", |
| 9901 |
"color", |
| 9902 |
"backgroundColor", |
| 9903 |
"style", |
| 9904 |
"crossOrigin", |
| 9905 |
"onLoadFailure", |
| 9906 |
"onLoadSuccess", |
| 9907 |
"onImageReady", |
| 9908 |
"onImageChange", |
| 9909 |
"onMouseUp", |
| 9910 |
"onMouseMove", |
| 9911 |
"onPositionChange", |
| 9912 |
"disableBoundaryChecks", |
| 9913 |
"disableHiDPIScaling", |
| 9914 |
"disableCanvasRotation" |
| 9915 |
])); |
| 9916 |
var n = this.getDimensions(); |
| 9917 |
var a = { |
| 9918 |
width: n.canvas.width, |
| 9919 |
height: n.canvas.height, |
| 9920 |
cursor: this.state.drag ? "grabbing" : "grab", |
| 9921 |
touchAction: "none" |
| 9922 |
}; |
| 9923 |
var r = { |
| 9924 |
width: n.canvas.width * P, |
| 9925 |
height: n.canvas.height * P, |
| 9926 |
style: y(y({}, a), t) |
| 9927 |
}; |
| 9928 |
return r[I.react.down] = this.handleMouseDown, w && (r[I.react.mouseDown] = this.handleMouseDown), i.default.createElement("canvas", u({ ref: this.setCanvas }, r, o)); |
| 9929 |
} |
| 9930 |
} |
| 9931 |
]) && r(e.prototype, t), o && r(e, o), a; |
| 9932 |
}(); |
| 9933 |
return s(x, "propTypes", { |
| 9934 |
scale: n.default.number, |
| 9935 |
rotate: n.default.number, |
| 9936 |
image: n.default.oneOfType([n.default.string].concat(function(e) { |
| 9937 |
if (Array.isArray(e)) return f(e); |
| 9938 |
}(b = M ? [n.default.instanceOf(File)] : []) || function(e) { |
| 9939 |
if ("undefined" != typeof Symbol && Symbol.iterator in Object(e)) return Array.from(e); |
| 9940 |
}(b) || g(b) || function() { |
| 9941 |
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); |
| 9942 |
}())), |
| 9943 |
border: n.default.oneOfType([n.default.number, n.default.arrayOf(n.default.number)]), |
| 9944 |
borderRadius: n.default.number, |
| 9945 |
width: n.default.number, |
| 9946 |
height: n.default.number, |
| 9947 |
position: n.default.shape({ |
| 9948 |
x: n.default.number, |
| 9949 |
y: n.default.number |
| 9950 |
}), |
| 9951 |
color: n.default.arrayOf(n.default.number), |
| 9952 |
backgroundColor: n.default.string, |
| 9953 |
crossOrigin: n.default.oneOf([ |
| 9954 |
"", |
| 9955 |
"anonymous", |
| 9956 |
"use-credentials" |
| 9957 |
]), |
| 9958 |
onLoadFailure: n.default.func, |
| 9959 |
onLoadSuccess: n.default.func, |
| 9960 |
onImageReady: n.default.func, |
| 9961 |
onImageChange: n.default.func, |
| 9962 |
onMouseUp: n.default.func, |
| 9963 |
onMouseMove: n.default.func, |
| 9964 |
onPositionChange: n.default.func, |
| 9965 |
disableBoundaryChecks: n.default.bool, |
| 9966 |
disableHiDPIScaling: n.default.bool, |
| 9967 |
disableCanvasRotation: n.default.bool |
| 9968 |
}), s(x, "defaultProps", { |
| 9969 |
scale: 1, |
| 9970 |
rotate: 0, |
| 9971 |
border: 25, |
| 9972 |
borderRadius: 0, |
| 9973 |
width: 200, |
| 9974 |
height: 200, |
| 9975 |
color: [ |
| 9976 |
0, |
| 9977 |
0, |
| 9978 |
0, |
| 9979 |
.5 |
| 9980 |
], |
| 9981 |
onLoadFailure: function() {}, |
| 9982 |
onLoadSuccess: function() {}, |
| 9983 |
onImageReady: function() {}, |
| 9984 |
onImageChange: function() {}, |
| 9985 |
onMouseUp: function() {}, |
| 9986 |
onMouseMove: function() {}, |
| 9987 |
onPositionChange: function() {}, |
| 9988 |
disableBoundaryChecks: !1, |
| 9989 |
disableHiDPIScaling: !1, |
| 9990 |
disableCanvasRotation: !0 |
| 9991 |
}), x; |
| 9992 |
}); |
| 9993 |
})); |
| 9994 |
|
| 9995 |
//#endregion |
| 9996 |
//#region modules/ai/assets/js/editor/pages/form-media/views/out-painting/out-painting-content.js |
| 9997 |
init_asyncToGenerator(); |
| 9998 |
var import_dist = /* @__PURE__ */ __toESM(require_dist()); |
| 9999 |
var OutPaintingContent = function OutPaintingContent(_ref) { |
| 10000 |
var scale = _ref.scale; |
| 10001 |
var setMask = _ref.setMask; |
| 10002 |
var editImage = _ref.editImage; |
| 10003 |
var aspectRatio = _ref.aspectRatio; |
| 10004 |
var setImageSize = _ref.setImageSize; |
| 10005 |
var setPosition = _ref.setPosition; |
| 10006 |
var cropperRef = (0, react.useRef)(); |
| 10007 |
var position = (0, react.useRef)({ |
| 10008 |
x: .5, |
| 10009 |
y: .5 |
| 10010 |
}); |
| 10011 |
var _useImageSize = useImageSize(aspectRatio); |
| 10012 |
var width = _useImageSize.width; |
| 10013 |
var height = _useImageSize.height; |
| 10014 |
var imageSize = { |
| 10015 |
width, |
| 10016 |
height |
| 10017 |
}; |
| 10018 |
var updateMask = /*#__PURE__*/ function() { |
| 10019 |
var _ref2 = _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee() { |
| 10020 |
var imageDataURL; |
| 10021 |
return import_regenerator$2.default.wrap(function(_context) { |
| 10022 |
while (1) switch (_context.prev = _context.next) { |
| 10023 |
case 0: |
| 10024 |
_context.next = 1; |
| 10025 |
return cropperRef.current.getImageScaledToCanvas().toDataURL(); |
| 10026 |
case 1: |
| 10027 |
imageDataURL = _context.sent; |
| 10028 |
setMask(imageDataURL); |
| 10029 |
case 2: |
| 10030 |
case "end": return _context.stop(); |
| 10031 |
} |
| 10032 |
}, _callee); |
| 10033 |
})); |
| 10034 |
return function updateMask() { |
| 10035 |
return _ref2.apply(this, arguments); |
| 10036 |
}; |
| 10037 |
}(); |
| 10038 |
var _onPositionChange = /*#__PURE__*/ function() { |
| 10039 |
var _ref3 = _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee2(args) { |
| 10040 |
return import_regenerator$2.default.wrap(function(_context2) { |
| 10041 |
while (1) switch (_context2.prev = _context2.next) { |
| 10042 |
case 0: |
| 10043 |
position.current = { |
| 10044 |
x: args.x, |
| 10045 |
y: args.y |
| 10046 |
}; |
| 10047 |
_context2.next = 1; |
| 10048 |
return updateMask(); |
| 10049 |
case 1: setPosition(position.current); |
| 10050 |
case 2: |
| 10051 |
case "end": return _context2.stop(); |
| 10052 |
} |
| 10053 |
}, _callee2); |
| 10054 |
})); |
| 10055 |
return function onPositionChange(_x) { |
| 10056 |
return _ref3.apply(this, arguments); |
| 10057 |
}; |
| 10058 |
}(); |
| 10059 |
var onImageChange = /*#__PURE__*/ function() { |
| 10060 |
var _ref4 = _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee3() { |
| 10061 |
return import_regenerator$2.default.wrap(function(_context3) { |
| 10062 |
while (1) switch (_context3.prev = _context3.next) { |
| 10063 |
case 0: |
| 10064 |
imageSize = { |
| 10065 |
width: imageSize.width * scale, |
| 10066 |
height: imageSize.height * scale |
| 10067 |
}; |
| 10068 |
_context3.next = 1; |
| 10069 |
return updateMask(); |
| 10070 |
case 1: setImageSize(imageSize); |
| 10071 |
case 2: |
| 10072 |
case "end": return _context3.stop(); |
| 10073 |
} |
| 10074 |
}, _callee3); |
| 10075 |
})); |
| 10076 |
return function onImageChange() { |
| 10077 |
return _ref4.apply(this, arguments); |
| 10078 |
}; |
| 10079 |
}(); |
| 10080 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, { |
| 10081 |
alignItems: "center", |
| 10082 |
spacing: .5, |
| 10083 |
flexGrow: 1 |
| 10084 |
}, /*#__PURE__*/ react.default.createElement(import_dist.default, { |
| 10085 |
ref: cropperRef, |
| 10086 |
image: editImage.url, |
| 10087 |
style: { |
| 10088 |
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%)", |
| 10089 |
backgroundSize: "20px 20px", |
| 10090 |
backgroundPosition: "0 0, 0 10px, 10px -10px, -10px 0px", |
| 10091 |
outline: "2px dashed #000", |
| 10092 |
marginTop: "12px" |
| 10093 |
}, |
| 10094 |
color: [ |
| 10095 |
0, |
| 10096 |
0, |
| 10097 |
0, |
| 10098 |
.9 |
| 10099 |
], |
| 10100 |
rotate: 0, |
| 10101 |
border: 0, |
| 10102 |
allowZoomOut: true, |
| 10103 |
backgroundColor: "transparent", |
| 10104 |
showGrid: true, |
| 10105 |
onImageChange, |
| 10106 |
onPositionChange: function onPositionChange(args) { |
| 10107 |
return _onPositionChange(args); |
| 10108 |
}, |
| 10109 |
width, |
| 10110 |
height, |
| 10111 |
scale |
| 10112 |
})); |
| 10113 |
}; |
| 10114 |
OutPaintingContent.propTypes = { |
| 10115 |
scale: import_prop_types$8.default.number.isRequired, |
| 10116 |
setMask: import_prop_types$8.default.func.isRequired, |
| 10117 |
editImage: import_prop_types$8.default.object.isRequired, |
| 10118 |
aspectRatio: import_prop_types$8.default.string.isRequired, |
| 10119 |
setImageSize: import_prop_types$8.default.func.isRequired, |
| 10120 |
setPosition: import_prop_types$8.default.func.isRequired |
| 10121 |
}; |
| 10122 |
|
| 10123 |
//#endregion |
| 10124 |
//#region modules/ai/assets/js/editor/pages/form-media/views/out-painting/hooks/use-out-painting.js |
| 10125 |
init_api(); |
| 10126 |
var useOutPainting = function useOutPainting(initialValue) { |
| 10127 |
return useImagePrompt(function fetchAction(payload) { |
| 10128 |
return getImageToImageOutPainting(payload); |
| 10129 |
}, initialValue); |
| 10130 |
}; |
| 10131 |
|
| 10132 |
//#endregion |
| 10133 |
//#region modules/ai/assets/js/editor/pages/form-media/views/out-painting/index.js |
| 10134 |
init_defineProperty$1(); |
| 10135 |
init_asyncToGenerator(); |
| 10136 |
init_slicedToArray(); |
| 10137 |
init_requests_ids(); |
| 10138 |
var OutPainting = function OutPainting() { |
| 10139 |
var _useState2 = _slicedToArray((0, react.useState)({ |
| 10140 |
width: 0, |
| 10141 |
height: 0 |
| 10142 |
}), 2); |
| 10143 |
var imageSize = _useState2[0]; |
| 10144 |
var setImageSize = _useState2[1]; |
| 10145 |
var _useState4 = _slicedToArray((0, react.useState)({ |
| 10146 |
x: .5, |
| 10147 |
y: .5 |
| 10148 |
}), 2); |
| 10149 |
var position = _useState4[0]; |
| 10150 |
var setPosition = _useState4[1]; |
| 10151 |
var _useState6 = _slicedToArray((0, react.useState)(""), 2); |
| 10152 |
var mask = _useState6[0]; |
| 10153 |
var setMask = _useState6[1]; |
| 10154 |
var setGenerate = useRequestIds().setGenerate; |
| 10155 |
var _useEditImage = useEditImage(); |
| 10156 |
var editImage = _useEditImage.editImage; |
| 10157 |
var initialAspectRatio = _useEditImage.aspectRatio; |
| 10158 |
var _usePromptSettings = usePromptSettings({ aspectRatio: initialAspectRatio }); |
| 10159 |
var settings = _usePromptSettings.settings; |
| 10160 |
var updateSettings = _usePromptSettings.updateSettings; |
| 10161 |
var _useImageActions = useImageActions(); |
| 10162 |
var use = _useImageActions.use; |
| 10163 |
var edit = _useImageActions.edit; |
| 10164 |
var isUploading = _useImageActions.isLoading; |
| 10165 |
var _useOutPainting = useOutPainting(); |
| 10166 |
var data = _useOutPainting.data; |
| 10167 |
var send = _useOutPainting.send; |
| 10168 |
var isGenerating = _useOutPainting.isLoading; |
| 10169 |
var error = _useOutPainting.error; |
| 10170 |
var isLoading = isGenerating || isUploading; |
| 10171 |
var generatedAspectRatio = (0, react.useMemo)(function() { |
| 10172 |
return settings[IMAGE_RATIO]; |
| 10173 |
}, [data === null || data === void 0 ? void 0 : data.result]); |
| 10174 |
var hasGeneratedResult = !!(data !== null && data !== void 0 && data.result); |
| 10175 |
var handleSubmit = /*#__PURE__*/ function() { |
| 10176 |
var _ref = _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee(event) { |
| 10177 |
var imageBase64; |
| 10178 |
return import_regenerator$2.default.wrap(function(_context) { |
| 10179 |
while (1) switch (_context.prev = _context.next) { |
| 10180 |
case 0: |
| 10181 |
event.preventDefault(); |
| 10182 |
setGenerate(); |
| 10183 |
_context.next = 1; |
| 10184 |
return fetchImageAsBase64(editImage.url); |
| 10185 |
case 1: |
| 10186 |
imageBase64 = _context.sent; |
| 10187 |
send({ |
| 10188 |
settings, |
| 10189 |
image: editImage, |
| 10190 |
mask, |
| 10191 |
size: imageSize, |
| 10192 |
position, |
| 10193 |
image_base64: imageBase64 |
| 10194 |
}); |
| 10195 |
case 2: |
| 10196 |
case "end": return _context.stop(); |
| 10197 |
} |
| 10198 |
}, _callee); |
| 10199 |
})); |
| 10200 |
return function handleSubmit(_x) { |
| 10201 |
return _ref.apply(this, arguments); |
| 10202 |
}; |
| 10203 |
}(); |
| 10204 |
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, { |
| 10205 |
primary: (0, _wordpress_i18n.__)("Expand Image", "elementor"), |
| 10206 |
secondary: (0, _wordpress_i18n.__)("Position image in it’s new size to generate content around the edges.", "elementor") |
| 10207 |
}), error && /*#__PURE__*/ react.default.createElement(View.ErrorMessage, { |
| 10208 |
error, |
| 10209 |
onRetry: handleSubmit |
| 10210 |
}), /*#__PURE__*/ react.default.createElement(ImageForm, { onSubmit: handleSubmit }, /*#__PURE__*/ react.default.createElement(ImageRatioSelect, { |
| 10211 |
disabled: isLoading || hasGeneratedResult, |
| 10212 |
value: settings[IMAGE_RATIO], |
| 10213 |
onChange: function onChange(event) { |
| 10214 |
return updateSettings(_defineProperty$1({}, IMAGE_RATIO, event.target.value)); |
| 10215 |
} |
| 10216 |
}), /*#__PURE__*/ react.default.createElement(_elementor_ui.FormControl, { sx: { |
| 10217 |
width: "100%", |
| 10218 |
mb: 2.5 |
| 10219 |
} }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Slider, { |
| 10220 |
marks: true, |
| 10221 |
id: "zoom", |
| 10222 |
name: "zoom", |
| 10223 |
max: 1, |
| 10224 |
min: .1, |
| 10225 |
step: .1, |
| 10226 |
color: "secondary", |
| 10227 |
defaultValue: 1, |
| 10228 |
disabled: isLoading || hasGeneratedResult, |
| 10229 |
valueLabelDisplay: "auto", |
| 10230 |
"aria-labelledby": "image-size-slider", |
| 10231 |
"aria-label": (0, _wordpress_i18n.__)("Reference strength", "elementor"), |
| 10232 |
onChange: function onChange(_, value) { |
| 10233 |
return updateSettings(_defineProperty$1({}, IMAGE_ZOOM, value)); |
| 10234 |
} |
| 10235 |
}), /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, { |
| 10236 |
id: "image-size-slider", |
| 10237 |
variant: "caption", |
| 10238 |
gutterBottom: true |
| 10239 |
}, (0, _wordpress_i18n.__)("Original image size", "elementor"))), data !== null && data !== void 0 && data.result ? /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, { |
| 10240 |
gap: 2, |
| 10241 |
sx: { my: 2.5 } |
| 10242 |
}, /*#__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, { |
| 10243 |
onUseImage: use, |
| 10244 |
onEditImage: edit, |
| 10245 |
images: data.result, |
| 10246 |
aspectRatio: generatedAspectRatio |
| 10247 |
}) : /*#__PURE__*/ react.default.createElement(OutPaintingContent, { |
| 10248 |
setMask, |
| 10249 |
editImage, |
| 10250 |
scale: settings[IMAGE_ZOOM], |
| 10251 |
aspectRatio: settings[IMAGE_RATIO], |
| 10252 |
setImageSize, |
| 10253 |
setPosition |
| 10254 |
}))); |
| 10255 |
}; |
| 10256 |
|
| 10257 |
//#endregion |
| 10258 |
//#region modules/ai/assets/js/editor/pages/form-media/views/variations/hooks/use-image-to-image.js |
| 10259 |
init_api(); |
| 10260 |
var useImageToImage = function useImageToImage(initialValue) { |
| 10261 |
return useImagePrompt(function fetchAction(payload) { |
| 10262 |
return getImageToImageGeneration(payload); |
| 10263 |
}, initialValue); |
| 10264 |
}; |
| 10265 |
|
| 10266 |
//#endregion |
| 10267 |
//#region modules/ai/assets/js/editor/pages/form-media/views/variations/index.js |
| 10268 |
init_slicedToArray(); |
| 10269 |
init_requests_ids(); |
| 10270 |
var IMAGE_WEIGHT_DEFAULT = 45; |
| 10271 |
var Variations = function Variations() { |
| 10272 |
var _data$result; |
| 10273 |
var prompt = _slicedToArray((0, react.useState)(""), 1)[0]; |
| 10274 |
var setGenerate = useRequestIds().setGenerate; |
| 10275 |
var _useEditImage = useEditImage(); |
| 10276 |
var editImage = _useEditImage.editImage; |
| 10277 |
var initialAspectRatio = _useEditImage.aspectRatio; |
| 10278 |
var settings = usePromptSettings({ |
| 10279 |
aspectRatio: initialAspectRatio, |
| 10280 |
imageWeight: IMAGE_WEIGHT_DEFAULT |
| 10281 |
}).settings; |
| 10282 |
var _useImageToImage = useImageToImage(); |
| 10283 |
var data = _useImageToImage.data; |
| 10284 |
var send = _useImageToImage.send; |
| 10285 |
var isGenerating = _useImageToImage.isLoading; |
| 10286 |
var error = _useImageToImage.error; |
| 10287 |
var _useImageActions = useImageActions(); |
| 10288 |
var use = _useImageActions.use; |
| 10289 |
var edit = _useImageActions.edit; |
| 10290 |
var isUploading = _useImageActions.isLoading; |
| 10291 |
var isLoading = isGenerating || isUploading; |
| 10292 |
var generatedAspectRatio = (0, react.useMemo)(function() { |
| 10293 |
return settings[IMAGE_RATIO]; |
| 10294 |
}, [data === null || data === void 0 ? void 0 : data.result]); |
| 10295 |
var handleSubmit = function handleSubmit(event) { |
| 10296 |
event.preventDefault(); |
| 10297 |
setGenerate(); |
| 10298 |
send({ |
| 10299 |
prompt, |
| 10300 |
settings, |
| 10301 |
image: editImage |
| 10302 |
}); |
| 10303 |
}; |
| 10304 |
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, { |
| 10305 |
primary: (0, _wordpress_i18n.__)("Variations", "elementor"), |
| 10306 |
secondary: (0, _wordpress_i18n.__)("Create new versions of the original image.", "elementor") |
| 10307 |
}), error && /*#__PURE__*/ react.default.createElement(View.ErrorMessage, { |
| 10308 |
error, |
| 10309 |
onRetry: handleSubmit |
| 10310 |
}), /*#__PURE__*/ react.default.createElement(ImageForm, { onSubmit: handleSubmit }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, { sx: { |
| 10311 |
display: "flex", |
| 10312 |
alignItems: "center", |
| 10313 |
justifyContent: "center", |
| 10314 |
bgcolor: "action.selected" |
| 10315 |
} }, /*#__PURE__*/ react.default.createElement("img", { |
| 10316 |
src: (editImage === null || editImage === void 0 ? void 0 : editImage.image_url) || (editImage === null || editImage === void 0 ? void 0 : editImage.url), |
| 10317 |
alt: prompt, |
| 10318 |
style: { |
| 10319 |
width: "auto", |
| 10320 |
height: "auto", |
| 10321 |
maxWidth: "100%", |
| 10322 |
maxHeight: 166, |
| 10323 |
objectFit: "contained" |
| 10324 |
} |
| 10325 |
})), /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, { |
| 10326 |
gap: 2, |
| 10327 |
sx: { my: 2.5 } |
| 10328 |
}, (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, { |
| 10329 |
images: data.result, |
| 10330 |
aspectRatio: generatedAspectRatio, |
| 10331 |
onUseImage: use, |
| 10332 |
onEditImage: edit |
| 10333 |
}) : /*#__PURE__*/ react.default.createElement(ImagesPlaceholder, null))); |
| 10334 |
}; |
| 10335 |
Variations.propTypes = {}; |
| 10336 |
|
| 10337 |
//#endregion |
| 10338 |
//#region modules/ai/assets/js/editor/pages/form-media/views/replace-background/hooks/use-replace-background.js |
| 10339 |
init_api(); |
| 10340 |
var useReplaceBackground = function useReplaceBackground(initialValue) { |
| 10341 |
return useImagePrompt(function fetchAction(payload) { |
| 10342 |
return getImageToImageReplaceBackground(payload); |
| 10343 |
}, initialValue); |
| 10344 |
}; |
| 10345 |
|
| 10346 |
//#endregion |
| 10347 |
//#region modules/ai/assets/js/editor/pages/form-media/views/replace-background/index.js |
| 10348 |
init_slicedToArray(); |
| 10349 |
init_requests_ids(); |
| 10350 |
var ReplaceBackground = function ReplaceBackground() { |
| 10351 |
var _useState2 = _slicedToArray((0, react.useState)(""), 2); |
| 10352 |
var prompt = _useState2[0]; |
| 10353 |
var setPrompt = _useState2[1]; |
| 10354 |
var setGenerate = useRequestIds().setGenerate; |
| 10355 |
var editImage = useEditImage().editImage; |
| 10356 |
var _useImageActions = useImageActions(); |
| 10357 |
var use = _useImageActions.use; |
| 10358 |
var edit = _useImageActions.edit; |
| 10359 |
var isUploading = _useImageActions.isLoading; |
| 10360 |
var _useReplaceBackground = useReplaceBackground(); |
| 10361 |
var data = _useReplaceBackground.data; |
| 10362 |
var send = _useReplaceBackground.send; |
| 10363 |
var isGenerating = _useReplaceBackground.isLoading; |
| 10364 |
var error = _useReplaceBackground.error; |
| 10365 |
var navigate = useLocation().navigate; |
| 10366 |
var isLoading = isGenerating || isUploading; |
| 10367 |
var handleSubmit = function handleSubmit(event) { |
| 10368 |
event.preventDefault(); |
| 10369 |
setGenerate(); |
| 10370 |
send({ |
| 10371 |
prompt, |
| 10372 |
image: editImage |
| 10373 |
}); |
| 10374 |
}; |
| 10375 |
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, { |
| 10376 |
primary: (0, _wordpress_i18n.__)("Replace Background", "elementor"), |
| 10377 |
secondary: (0, _wordpress_i18n.__)("Generate a new background with a prompt.", "elementor") |
| 10378 |
}), error && /*#__PURE__*/ react.default.createElement(View.ErrorMessage, { |
| 10379 |
error, |
| 10380 |
onRetry: handleSubmit |
| 10381 |
}), /*#__PURE__*/ react.default.createElement(ImageForm, { onSubmit: handleSubmit }, /*#__PURE__*/ react.default.createElement(PromptField, { |
| 10382 |
value: prompt, |
| 10383 |
disabled: isLoading, |
| 10384 |
onChange: setPrompt, |
| 10385 |
placeholder: (0, _wordpress_i18n.__)("Describe what you want to generate in the background (English only)", "elementor") |
| 10386 |
}), /*#__PURE__*/ react.default.createElement(GenerateSubmit, { |
| 10387 |
disabled: isLoading || "" === prompt, |
| 10388 |
color: data !== null && data !== void 0 && data.result ? "secondary" : "primary" |
| 10389 |
}, 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, { |
| 10390 |
disabled: isLoading, |
| 10391 |
onClick: function onClick() { |
| 10392 |
return navigate(LOCATIONS.GENERATE); |
| 10393 |
} |
| 10394 |
}))), /*#__PURE__*/ react.default.createElement(View.Content, { isGenerating: isLoading }, data !== null && data !== void 0 && data.result ? /*#__PURE__*/ react.default.createElement(ImagesDisplay, { |
| 10395 |
onUseImage: use, |
| 10396 |
onEditImage: edit, |
| 10397 |
images: data.result, |
| 10398 |
aspectRatio: editImage.aspectRatio |
| 10399 |
}) : /*#__PURE__*/ react.default.createElement(SingleImagePreview, null, /*#__PURE__*/ react.default.createElement(SingleImagePreview.Image, { |
| 10400 |
src: editImage.url, |
| 10401 |
alt: editImage.alt, |
| 10402 |
style: { |
| 10403 |
width: editImage.width, |
| 10404 |
height: editImage.height |
| 10405 |
} |
| 10406 |
})))); |
| 10407 |
}; |
| 10408 |
|
| 10409 |
//#endregion |
| 10410 |
//#region modules/ai/assets/js/editor/pages/form-media/views/remove-background/hooks/use-remove-background.js |
| 10411 |
init_api(); |
| 10412 |
var useRemoveBackground = function useRemoveBackground(initialValue) { |
| 10413 |
return useImagePrompt(function fetchAction(payload) { |
| 10414 |
return getImageToImageRemoveBackground(payload); |
| 10415 |
}, initialValue); |
| 10416 |
}; |
| 10417 |
|
| 10418 |
//#endregion |
| 10419 |
//#region modules/ai/assets/js/editor/pages/form-media/views/remove-background/index.js |
| 10420 |
init_requests_ids(); |
| 10421 |
var RemoveBackground = function RemoveBackground() { |
| 10422 |
var editImage = useEditImage().editImage; |
| 10423 |
var setGenerate = useRequestIds().setGenerate; |
| 10424 |
var _useImageActions = useImageActions(); |
| 10425 |
var use = _useImageActions.use; |
| 10426 |
var edit = _useImageActions.edit; |
| 10427 |
var isUploading = _useImageActions.isLoading; |
| 10428 |
var _useRemoveBackground = useRemoveBackground(); |
| 10429 |
var data = _useRemoveBackground.data; |
| 10430 |
var send = _useRemoveBackground.send; |
| 10431 |
var isGenerating = _useRemoveBackground.isLoading; |
| 10432 |
var error = _useRemoveBackground.error; |
| 10433 |
var navigate = useLocation().navigate; |
| 10434 |
var isLoading = isGenerating || isUploading; |
| 10435 |
var _useImageSize = useImageSize(editImage.aspectRatio); |
| 10436 |
var width = _useImageSize.width; |
| 10437 |
var height = _useImageSize.height; |
| 10438 |
var handleSubmit = function handleSubmit(event) { |
| 10439 |
event.preventDefault(); |
| 10440 |
setGenerate(); |
| 10441 |
send({ image: editImage }); |
| 10442 |
}; |
| 10443 |
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, { |
| 10444 |
primary: (0, _wordpress_i18n.__)("Remove Background", "elementor"), |
| 10445 |
secondary: (0, _wordpress_i18n.__)("Create an image of the subject with a transparent background", "elementor") |
| 10446 |
}), error && /*#__PURE__*/ react.default.createElement(View.ErrorMessage, { |
| 10447 |
error, |
| 10448 |
onRetry: handleSubmit |
| 10449 |
}), /*#__PURE__*/ react.default.createElement(ImageForm, { onSubmit: handleSubmit }, data !== null && data !== void 0 && data.result ? /*#__PURE__*/ react.default.createElement(NewPromptButton, { |
| 10450 |
variant: "contained", |
| 10451 |
disabled: isLoading, |
| 10452 |
onClick: function onClick() { |
| 10453 |
return navigate(LOCATIONS.GENERATE); |
| 10454 |
} |
| 10455 |
}) : /*#__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, { |
| 10456 |
transparentContainer: true, |
| 10457 |
onUseImage: use, |
| 10458 |
onEditImage: edit, |
| 10459 |
images: data.result, |
| 10460 |
aspectRatio: editImage.aspectRatio |
| 10461 |
})) : /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, null, /*#__PURE__*/ react.default.createElement(SingleImagePreview, null, /*#__PURE__*/ react.default.createElement(SingleImagePreview.Image, { |
| 10462 |
src: editImage.url, |
| 10463 |
alt: editImage.alt, |
| 10464 |
style: { |
| 10465 |
width, |
| 10466 |
height |
| 10467 |
} |
| 10468 |
}))))); |
| 10469 |
}; |
| 10470 |
|
| 10471 |
//#endregion |
| 10472 |
//#region modules/ai/assets/js/editor/pages/form-media/views/cleanup/cleanup-content.js |
| 10473 |
init_asyncToGenerator(); |
| 10474 |
init_slicedToArray(); |
| 10475 |
var STROKE_SELECT_WIDTH = 120; |
| 10476 |
var BRUSH_COLOR = "rgba(255, 255, 255)"; |
| 10477 |
var CANVAS_COLOR = "rgba(0, 0, 0)"; |
| 10478 |
var StyledUndoIcon = (0, _elementor_ui.withDirection)(UndoIcon); |
| 10479 |
var StyledRedoIcon = (0, _elementor_ui.withDirection)(RedoIcon); |
| 10480 |
var BrushCursor = (0, _elementor_ui.styled)(_elementor_ui.Box, { shouldForwardProp: function shouldForwardProp(prop) { |
| 10481 |
return "size" === prop; |
| 10482 |
} })(function(_ref) { |
| 10483 |
var theme = _ref.theme; |
| 10484 |
var size = _ref.size; |
| 10485 |
return { |
| 10486 |
position: "absolute", |
| 10487 |
width: size, |
| 10488 |
height: size, |
| 10489 |
borderRadius: "50%", |
| 10490 |
backgroundColor: BRUSH_COLOR, |
| 10491 |
pointerEvents: "none", |
| 10492 |
transform: "translate(".concat("rtl" === theme.direction ? "50%" : "-50%", ", -50%)"), |
| 10493 |
border: "1px solid #fff" |
| 10494 |
}; |
| 10495 |
}); |
| 10496 |
var BrishSizeIcon = (0, _elementor_ui.styled)(_elementor_ui.Box, { shouldForwardProp: function shouldForwardProp(prop) { |
| 10497 |
return "size" === prop; |
| 10498 |
} })(function(_ref2) { |
| 10499 |
var theme = _ref2.theme; |
| 10500 |
var size = _ref2.size; |
| 10501 |
return { |
| 10502 |
width: size / 2, |
| 10503 |
height: size / 2, |
| 10504 |
borderRadius: "50%", |
| 10505 |
backgroundColor: theme.palette.secondary.main |
| 10506 |
}; |
| 10507 |
}); |
| 10508 |
var CleanupContent = function CleanupContent(_ref3) { |
| 10509 |
var editImage = _ref3.editImage; |
| 10510 |
var setMask = _ref3.setMask; |
| 10511 |
var setIsCanvasChanged = _ref3.setIsCanvasChanged; |
| 10512 |
var canvasWidth = _ref3.width; |
| 10513 |
var canvasHeight = _ref3.height; |
| 10514 |
var sketchRef = (0, react.useRef)(); |
| 10515 |
var _useState2 = _slicedToArray((0, react.useState)(30), 2); |
| 10516 |
var stroke = _useState2[0]; |
| 10517 |
var setStroke = _useState2[1]; |
| 10518 |
var brushCursorRef = (0, react.useRef)(); |
| 10519 |
(0, react.useEffect)(function() { |
| 10520 |
var canvas = document.querySelector(".eui-in-painting-canvas"); |
| 10521 |
var positionElement = function positionElement(e) { |
| 10522 |
var _canvas$getBoundingCl = canvas.getBoundingClientRect(); |
| 10523 |
var left = _canvas$getBoundingCl.left; |
| 10524 |
var top = _canvas$getBoundingCl.top; |
| 10525 |
var width = _canvas$getBoundingCl.width; |
| 10526 |
var height = _canvas$getBoundingCl.height; |
| 10527 |
var x = e.clientX - left; |
| 10528 |
var y = e.clientY - top; |
| 10529 |
if (x > 0 && x < width && y > 0 && y < height) { |
| 10530 |
brushCursorRef.current.style.left = "".concat(x, "px"); |
| 10531 |
brushCursorRef.current.style.top = "".concat(y, "px"); |
| 10532 |
} |
| 10533 |
}; |
| 10534 |
window.addEventListener("mousemove", positionElement); |
| 10535 |
return function() { |
| 10536 |
window.removeEventListener("mousemove", positionElement); |
| 10537 |
}; |
| 10538 |
}, [stroke]); |
| 10539 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, { |
| 10540 |
alignItems: "flex-start", |
| 10541 |
spacing: .5, |
| 10542 |
flexGrow: 1 |
| 10543 |
}, /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, { |
| 10544 |
width: "100%", |
| 10545 |
direction: "row", |
| 10546 |
spacing: 3, |
| 10547 |
alignSelf: "center", |
| 10548 |
justifyContent: "center", |
| 10549 |
sx: { mb: 2.5 } |
| 10550 |
}, /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, { |
| 10551 |
direction: "row", |
| 10552 |
gap: 1 |
| 10553 |
}, /*#__PURE__*/ react.default.createElement(_elementor_ui.Tooltip, { title: (0, _wordpress_i18n.__)("Undo", "elementor") }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Button, { |
| 10554 |
variant: "outlined", |
| 10555 |
color: "secondary", |
| 10556 |
onClick: function onClick() { |
| 10557 |
return sketchRef.current.undo(); |
| 10558 |
}, |
| 10559 |
sx: { px: 0 } |
| 10560 |
}, /*#__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, { |
| 10561 |
variant: "outlined", |
| 10562 |
color: "secondary", |
| 10563 |
onClick: function onClick() { |
| 10564 |
return sketchRef.current.redo(); |
| 10565 |
}, |
| 10566 |
sx: { px: 0 } |
| 10567 |
}, /*#__PURE__*/ react.default.createElement(StyledRedoIcon, null)))), /*#__PURE__*/ react.default.createElement(_elementor_ui.FormControl, { |
| 10568 |
size: "small", |
| 10569 |
color: "secondary", |
| 10570 |
sx: { minWidth: STROKE_SELECT_WIDTH } |
| 10571 |
}, /*#__PURE__*/ react.default.createElement(_elementor_ui.InputLabel, { id: "stroke" }, "Stroke"), /*#__PURE__*/ react.default.createElement(_elementor_ui.Select, { |
| 10572 |
autoWidth: true, |
| 10573 |
label: "Stroke", |
| 10574 |
value: stroke, |
| 10575 |
id: "demo-simple-select", |
| 10576 |
labelId: "demo-simple-select-label", |
| 10577 |
onChange: function onChange(e) { |
| 10578 |
return setStroke(e.target.value); |
| 10579 |
}, |
| 10580 |
MenuProps: { |
| 10581 |
PaperProps: { sx: { maxWidth: STROKE_SELECT_WIDTH } }, |
| 10582 |
MenuListProps: { sx: { minWidth: STROKE_SELECT_WIDTH } } |
| 10583 |
}, |
| 10584 |
sx: { "& .MuiSelect-select .MuiListItemIcon-root": { |
| 10585 |
mr: .25, |
| 10586 |
width: "initial", |
| 10587 |
minWidth: "initial", |
| 10588 |
justifyContent: "flex-start" |
| 10589 |
} } |
| 10590 |
}, [ |
| 10591 |
10, |
| 10592 |
20, |
| 10593 |
30, |
| 10594 |
40, |
| 10595 |
50 |
| 10596 |
].map(function(value) { |
| 10597 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.MenuItem, { |
| 10598 |
key: "stroke-width-option-" + value, |
| 10599 |
value |
| 10600 |
}, /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, { |
| 10601 |
direction: "row", |
| 10602 |
alignItems: "center", |
| 10603 |
gap: 1 |
| 10604 |
}, /*#__PURE__*/ react.default.createElement(_elementor_ui.ListItemIcon, { sx: { |
| 10605 |
width: 30, |
| 10606 |
display: "flex", |
| 10607 |
justifyContent: "center" |
| 10608 |
} }, /*#__PURE__*/ react.default.createElement(BrishSizeIcon, { size: value })), /*#__PURE__*/ react.default.createElement(_elementor_ui.ListItemText, null, value))); |
| 10609 |
})))), /*#__PURE__*/ react.default.createElement("div", { style: { |
| 10610 |
margin: "0 auto", |
| 10611 |
position: "relative", |
| 10612 |
cursor: "none", |
| 10613 |
overflow: "hidden" |
| 10614 |
} }, /*#__PURE__*/ react.default.createElement(BrushCursor, { |
| 10615 |
ref: brushCursorRef, |
| 10616 |
size: stroke |
| 10617 |
}), /*#__PURE__*/ react.default.createElement(ReactSketchCanvas, { |
| 10618 |
className: "eui-in-painting-canvas", |
| 10619 |
withViewBox: true, |
| 10620 |
ref: sketchRef, |
| 10621 |
height: canvasHeight + "px", |
| 10622 |
width: canvasWidth + "px", |
| 10623 |
strokeWidth: stroke, |
| 10624 |
strokeColor: BRUSH_COLOR, |
| 10625 |
canvasColor: CANVAS_COLOR, |
| 10626 |
backgroundImage: editImage.url, |
| 10627 |
onStroke: function onStroke() { |
| 10628 |
return setIsCanvasChanged(true); |
| 10629 |
}, |
| 10630 |
onChange: /*#__PURE__*/ _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee() { |
| 10631 |
var svg; |
| 10632 |
return import_regenerator$2.default.wrap(function(_context) { |
| 10633 |
while (1) switch (_context.prev = _context.next) { |
| 10634 |
case 0: |
| 10635 |
_context.next = 1; |
| 10636 |
return sketchRef.current.exportSvg(); |
| 10637 |
case 1: |
| 10638 |
svg = _context.sent; |
| 10639 |
setMask(svg); |
| 10640 |
case 2: |
| 10641 |
case "end": return _context.stop(); |
| 10642 |
} |
| 10643 |
}, _callee); |
| 10644 |
})) |
| 10645 |
}))); |
| 10646 |
}; |
| 10647 |
CleanupContent.propTypes = { |
| 10648 |
setMask: import_prop_types$8.default.func.isRequired, |
| 10649 |
setIsCanvasChanged: import_prop_types$8.default.func.isRequired, |
| 10650 |
width: import_prop_types$8.default.number.isRequired, |
| 10651 |
height: import_prop_types$8.default.number.isRequired, |
| 10652 |
editImage: import_prop_types$8.default.object.isRequired |
| 10653 |
}; |
| 10654 |
|
| 10655 |
//#endregion |
| 10656 |
//#region modules/ai/assets/js/editor/pages/form-media/views/cleanup/hooks/use-cleanup.js |
| 10657 |
init_api(); |
| 10658 |
var useCleanup = function useCleanup(initialValue) { |
| 10659 |
return useImagePrompt(function fetchAction(payload) { |
| 10660 |
return getImageToImageMaskCleanup(payload); |
| 10661 |
}, initialValue); |
| 10662 |
}; |
| 10663 |
|
| 10664 |
//#endregion |
| 10665 |
//#region modules/ai/assets/js/editor/pages/form-media/views/cleanup/index.js |
| 10666 |
init_asyncToGenerator(); |
| 10667 |
init_slicedToArray(); |
| 10668 |
init_requests_ids(); |
| 10669 |
var Cleanup = function Cleanup() { |
| 10670 |
var setGenerate = useRequestIds().setGenerate; |
| 10671 |
var _useState2 = _slicedToArray((0, react.useState)(""), 2); |
| 10672 |
var mask = _useState2[0]; |
| 10673 |
var setMask = _useState2[1]; |
| 10674 |
var _useState4 = _slicedToArray((0, react.useState)(false), 2); |
| 10675 |
var isCanvasChanged = _useState4[0]; |
| 10676 |
var setIsCanvasChanged = _useState4[1]; |
| 10677 |
var _usePromptSettings = usePromptSettings(); |
| 10678 |
var settings = _usePromptSettings.settings; |
| 10679 |
var resetSettings = _usePromptSettings.resetSettings; |
| 10680 |
var _useEditImage = useEditImage(); |
| 10681 |
var editImage = _useEditImage.editImage; |
| 10682 |
var width = _useEditImage.width; |
| 10683 |
var height = _useEditImage.height; |
| 10684 |
var _useImageActions = useImageActions(); |
| 10685 |
var use = _useImageActions.use; |
| 10686 |
var edit = _useImageActions.edit; |
| 10687 |
var isUploading = _useImageActions.isLoading; |
| 10688 |
var _useCleanup = useCleanup(); |
| 10689 |
var data = _useCleanup.data; |
| 10690 |
var send = _useCleanup.send; |
| 10691 |
var isGenerating = _useCleanup.isLoading; |
| 10692 |
var error = _useCleanup.error; |
| 10693 |
var reset = _useCleanup.reset; |
| 10694 |
var isLoading = isGenerating || isUploading; |
| 10695 |
var handleSubmit = /*#__PURE__*/ function() { |
| 10696 |
var _ref = _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee(event) { |
| 10697 |
return import_regenerator$2.default.wrap(function(_context) { |
| 10698 |
while (1) switch (_context.prev = _context.next) { |
| 10699 |
case 0: |
| 10700 |
event.preventDefault(); |
| 10701 |
setGenerate(); |
| 10702 |
send({ |
| 10703 |
settings, |
| 10704 |
image: editImage, |
| 10705 |
mask |
| 10706 |
}); |
| 10707 |
case 1: |
| 10708 |
case "end": return _context.stop(); |
| 10709 |
} |
| 10710 |
}, _callee); |
| 10711 |
})); |
| 10712 |
return function handleSubmit(_x) { |
| 10713 |
return _ref.apply(this, arguments); |
| 10714 |
}; |
| 10715 |
}(); |
| 10716 |
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, { |
| 10717 |
primary: (0, _wordpress_i18n.__)("Cleanup", "elementor"), |
| 10718 |
secondary: (0, _wordpress_i18n.__)("Remove unwanted area from your image.", "elementor") |
| 10719 |
}), error && /*#__PURE__*/ react.default.createElement(View.ErrorMessage, { |
| 10720 |
error, |
| 10721 |
onRetry: handleSubmit |
| 10722 |
}), /*#__PURE__*/ react.default.createElement(ImageForm, { onSubmit: handleSubmit }, data !== null && data !== void 0 && data.result ? /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, { |
| 10723 |
gap: 2, |
| 10724 |
sx: { my: 2.5 } |
| 10725 |
}, /*#__PURE__*/ react.default.createElement(GenerateAgainSubmit, { disabled: isLoading }), /*#__PURE__*/ react.default.createElement(NewPromptButton, { |
| 10726 |
disabled: isLoading, |
| 10727 |
onClick: function onClick() { |
| 10728 |
resetSettings(); |
| 10729 |
reset(); |
| 10730 |
} |
| 10731 |
})) : /*#__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, { |
| 10732 |
images: data.result, |
| 10733 |
aspectRatio: editImage.aspectRatio, |
| 10734 |
onUseImage: use, |
| 10735 |
onEditImage: edit |
| 10736 |
}) : /*#__PURE__*/ react.default.createElement(CleanupContent, { |
| 10737 |
editImage, |
| 10738 |
width, |
| 10739 |
height, |
| 10740 |
setMask, |
| 10741 |
setIsCanvasChanged |
| 10742 |
}))); |
| 10743 |
}; |
| 10744 |
|
| 10745 |
//#endregion |
| 10746 |
//#region modules/ai/assets/js/editor/pages/form-media/views/generate/hooks/use-text-to-image.js |
| 10747 |
init_api(); |
| 10748 |
var useTextToImage = function useTextToImage(initialValue) { |
| 10749 |
return useImagePrompt(getTextToImageGeneration, initialValue); |
| 10750 |
}; |
| 10751 |
|
| 10752 |
//#endregion |
| 10753 |
//#region node_modules/react-colorful/dist/index.mjs |
| 10754 |
function u() { |
| 10755 |
return (u = Object.assign || function(e) { |
| 10756 |
for (var r = 1; r < arguments.length; r++) { |
| 10757 |
var t = arguments[r]; |
| 10758 |
for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n]); |
| 10759 |
} |
| 10760 |
return e; |
| 10761 |
}).apply(this, arguments); |
| 10762 |
} |
| 10763 |
function c(e, r) { |
| 10764 |
if (null == e) return {}; |
| 10765 |
var t; |
| 10766 |
var n; |
| 10767 |
var o = {}; |
| 10768 |
var a = Object.keys(e); |
| 10769 |
for (n = 0; n < a.length; n++) r.indexOf(t = a[n]) >= 0 || (o[t] = e[t]); |
| 10770 |
return o; |
| 10771 |
} |
| 10772 |
function i(e) { |
| 10773 |
var t = (0, react$1.useRef)(e); |
| 10774 |
var n = (0, react$1.useRef)(function(e) { |
| 10775 |
t.current && t.current(e); |
| 10776 |
}); |
| 10777 |
return t.current = e, n.current; |
| 10778 |
} |
| 10779 |
var s = function(e, r, t) { |
| 10780 |
return void 0 === r && (r = 0), void 0 === t && (t = 1), e > t ? t : e < r ? r : e; |
| 10781 |
}; |
| 10782 |
var f = function(e) { |
| 10783 |
return "touches" in e; |
| 10784 |
}; |
| 10785 |
var v = function(e) { |
| 10786 |
return e && e.ownerDocument.defaultView || self; |
| 10787 |
}; |
| 10788 |
var d = function(e, r, t) { |
| 10789 |
var n = e.getBoundingClientRect(); |
| 10790 |
var o = f(r) ? function(e, r) { |
| 10791 |
for (var t = 0; t < e.length; t++) if (e[t].identifier === r) return e[t]; |
| 10792 |
return e[0]; |
| 10793 |
}(r.touches, t) : r; |
| 10794 |
return { |
| 10795 |
left: s((o.pageX - (n.left + v(e).pageXOffset)) / n.width), |
| 10796 |
top: s((o.pageY - (n.top + v(e).pageYOffset)) / n.height) |
| 10797 |
}; |
| 10798 |
}; |
| 10799 |
var h = function(e) { |
| 10800 |
!f(e) && e.preventDefault(); |
| 10801 |
}; |
| 10802 |
var m = react$1.default.memo(function(o) { |
| 10803 |
var a = o.onMove; |
| 10804 |
var l = o.onKey; |
| 10805 |
var s = c(o, ["onMove", "onKey"]); |
| 10806 |
var m = (0, react$1.useRef)(null); |
| 10807 |
var g = i(a); |
| 10808 |
var p = i(l); |
| 10809 |
var b = (0, react$1.useRef)(null); |
| 10810 |
var _ = (0, react$1.useRef)(!1); |
| 10811 |
var x = (0, react$1.useMemo)(function() { |
| 10812 |
var e = function(e) { |
| 10813 |
h(e), (f(e) ? e.touches.length > 0 : e.buttons > 0) && m.current ? g(d(m.current, e, b.current)) : t(!1); |
| 10814 |
}; |
| 10815 |
var r = function() { |
| 10816 |
return t(!1); |
| 10817 |
}; |
| 10818 |
function t(t) { |
| 10819 |
var n = _.current; |
| 10820 |
var o = v(m.current); |
| 10821 |
var a = t ? o.addEventListener : o.removeEventListener; |
| 10822 |
a(n ? "touchmove" : "mousemove", e), a(n ? "touchend" : "mouseup", r); |
| 10823 |
} |
| 10824 |
return [ |
| 10825 |
function(e) { |
| 10826 |
var r = e.nativeEvent; |
| 10827 |
var n = m.current; |
| 10828 |
if (n && (h(r), !function(e, r) { |
| 10829 |
return r && !f(e); |
| 10830 |
}(r, _.current) && n)) { |
| 10831 |
if (f(r)) { |
| 10832 |
_.current = !0; |
| 10833 |
var o = r.changedTouches || []; |
| 10834 |
o.length && (b.current = o[0].identifier); |
| 10835 |
} |
| 10836 |
n.focus(), g(d(n, r, b.current)), t(!0); |
| 10837 |
} |
| 10838 |
}, |
| 10839 |
function(e) { |
| 10840 |
var r = e.which || e.keyCode; |
| 10841 |
r < 37 || r > 40 || (e.preventDefault(), p({ |
| 10842 |
left: 39 === r ? .05 : 37 === r ? -.05 : 0, |
| 10843 |
top: 40 === r ? .05 : 38 === r ? -.05 : 0 |
| 10844 |
})); |
| 10845 |
}, |
| 10846 |
t |
| 10847 |
]; |
| 10848 |
}, [p, g]); |
| 10849 |
var C = x[0]; |
| 10850 |
var E = x[1]; |
| 10851 |
var H = x[2]; |
| 10852 |
return (0, react$1.useEffect)(function() { |
| 10853 |
return H; |
| 10854 |
}, [H]), react$1.default.createElement("div", u({}, s, { |
| 10855 |
onTouchStart: C, |
| 10856 |
onMouseDown: C, |
| 10857 |
className: "react-colorful__interactive", |
| 10858 |
ref: m, |
| 10859 |
onKeyDown: E, |
| 10860 |
tabIndex: 0, |
| 10861 |
role: "slider" |
| 10862 |
})); |
| 10863 |
}); |
| 10864 |
var g = function(e) { |
| 10865 |
return e.filter(Boolean).join(" "); |
| 10866 |
}; |
| 10867 |
var p = function(r) { |
| 10868 |
var t = r.color; |
| 10869 |
var n = r.left; |
| 10870 |
var o = r.top; |
| 10871 |
var a = void 0 === o ? .5 : o; |
| 10872 |
var l = g(["react-colorful__pointer", r.className]); |
| 10873 |
return react$1.default.createElement("div", { |
| 10874 |
className: l, |
| 10875 |
style: { |
| 10876 |
top: 100 * a + "%", |
| 10877 |
left: 100 * n + "%" |
| 10878 |
} |
| 10879 |
}, react$1.default.createElement("div", { |
| 10880 |
className: "react-colorful__pointer-fill", |
| 10881 |
style: { backgroundColor: t } |
| 10882 |
})); |
| 10883 |
}; |
| 10884 |
var b = function(e, r, t) { |
| 10885 |
return void 0 === r && (r = 0), void 0 === t && (t = Math.pow(10, r)), Math.round(t * e) / t; |
| 10886 |
}; |
| 10887 |
var _ = { |
| 10888 |
grad: .9, |
| 10889 |
turn: 360, |
| 10890 |
rad: 360 / (2 * Math.PI) |
| 10891 |
}; |
| 10892 |
var x = function(e) { |
| 10893 |
return L(C(e)); |
| 10894 |
}; |
| 10895 |
var C = function(e) { |
| 10896 |
return "#" === e[0] && (e = e.substring(1)), e.length < 6 ? { |
| 10897 |
r: parseInt(e[0] + e[0], 16), |
| 10898 |
g: parseInt(e[1] + e[1], 16), |
| 10899 |
b: parseInt(e[2] + e[2], 16), |
| 10900 |
a: 4 === e.length ? b(parseInt(e[3] + e[3], 16) / 255, 2) : 1 |
| 10901 |
} : { |
| 10902 |
r: parseInt(e.substring(0, 2), 16), |
| 10903 |
g: parseInt(e.substring(2, 4), 16), |
| 10904 |
b: parseInt(e.substring(4, 6), 16), |
| 10905 |
a: 8 === e.length ? b(parseInt(e.substring(6, 8), 16) / 255, 2) : 1 |
| 10906 |
}; |
| 10907 |
}; |
| 10908 |
var w = function(e) { |
| 10909 |
return K(I(e)); |
| 10910 |
}; |
| 10911 |
var y = function(e) { |
| 10912 |
var r = e.s; |
| 10913 |
var t = e.v; |
| 10914 |
var n = e.a; |
| 10915 |
var o = (200 - r) * t / 100; |
| 10916 |
return { |
| 10917 |
h: b(e.h), |
| 10918 |
s: b(o > 0 && o < 200 ? r * t / 100 / (o <= 100 ? o : 200 - o) * 100 : 0), |
| 10919 |
l: b(o / 2), |
| 10920 |
a: b(n, 2) |
| 10921 |
}; |
| 10922 |
}; |
| 10923 |
var q = function(e) { |
| 10924 |
var r = y(e); |
| 10925 |
return "hsl(" + r.h + ", " + r.s + "%, " + r.l + "%)"; |
| 10926 |
}; |
| 10927 |
var I = function(e) { |
| 10928 |
var r = e.h; |
| 10929 |
var t = e.s; |
| 10930 |
var n = e.v; |
| 10931 |
var o = e.a; |
| 10932 |
r = r / 360 * 6, t /= 100, n /= 100; |
| 10933 |
var a = Math.floor(r); |
| 10934 |
var l = n * (1 - t); |
| 10935 |
var u = n * (1 - (r - a) * t); |
| 10936 |
var c = n * (1 - (1 - r + a) * t); |
| 10937 |
var i = a % 6; |
| 10938 |
return { |
| 10939 |
r: b(255 * [ |
| 10940 |
n, |
| 10941 |
u, |
| 10942 |
l, |
| 10943 |
l, |
| 10944 |
c, |
| 10945 |
n |
| 10946 |
][i]), |
| 10947 |
g: b(255 * [ |
| 10948 |
c, |
| 10949 |
n, |
| 10950 |
n, |
| 10951 |
u, |
| 10952 |
l, |
| 10953 |
l |
| 10954 |
][i]), |
| 10955 |
b: b(255 * [ |
| 10956 |
l, |
| 10957 |
l, |
| 10958 |
c, |
| 10959 |
n, |
| 10960 |
n, |
| 10961 |
u |
| 10962 |
][i]), |
| 10963 |
a: b(o, 2) |
| 10964 |
}; |
| 10965 |
}; |
| 10966 |
var D = function(e) { |
| 10967 |
var r = e.toString(16); |
| 10968 |
return r.length < 2 ? "0" + r : r; |
| 10969 |
}; |
| 10970 |
var K = function(e) { |
| 10971 |
var r = e.r; |
| 10972 |
var t = e.g; |
| 10973 |
var n = e.b; |
| 10974 |
var o = e.a; |
| 10975 |
var a = o < 1 ? D(b(255 * o)) : ""; |
| 10976 |
return "#" + D(r) + D(t) + D(n) + a; |
| 10977 |
}; |
| 10978 |
var L = function(e) { |
| 10979 |
var r = e.r; |
| 10980 |
var t = e.g; |
| 10981 |
var n = e.b; |
| 10982 |
var o = e.a; |
| 10983 |
var a = Math.max(r, t, n); |
| 10984 |
var l = a - Math.min(r, t, n); |
| 10985 |
var u = l ? a === r ? (t - n) / l : a === t ? 2 + (n - r) / l : 4 + (r - t) / l : 0; |
| 10986 |
return { |
| 10987 |
h: b(60 * (u < 0 ? u + 6 : u)), |
| 10988 |
s: b(a ? l / a * 100 : 0), |
| 10989 |
v: b(a / 255 * 100), |
| 10990 |
a: o |
| 10991 |
}; |
| 10992 |
}; |
| 10993 |
var S = react$1.default.memo(function(r) { |
| 10994 |
var t = r.hue; |
| 10995 |
var n = r.onChange; |
| 10996 |
var o = g(["react-colorful__hue", r.className]); |
| 10997 |
return react$1.default.createElement("div", { className: o }, react$1.default.createElement(m, { |
| 10998 |
onMove: function(e) { |
| 10999 |
n({ h: 360 * e.left }); |
| 11000 |
}, |
| 11001 |
onKey: function(e) { |
| 11002 |
n({ h: s(t + 360 * e.left, 0, 360) }); |
| 11003 |
}, |
| 11004 |
"aria-label": "Hue", |
| 11005 |
"aria-valuenow": b(t), |
| 11006 |
"aria-valuemax": "360", |
| 11007 |
"aria-valuemin": "0" |
| 11008 |
}, react$1.default.createElement(p, { |
| 11009 |
className: "react-colorful__hue-pointer", |
| 11010 |
left: t / 360, |
| 11011 |
color: q({ |
| 11012 |
h: t, |
| 11013 |
s: 100, |
| 11014 |
v: 100, |
| 11015 |
a: 1 |
| 11016 |
}) |
| 11017 |
}))); |
| 11018 |
}); |
| 11019 |
var T = react$1.default.memo(function(r) { |
| 11020 |
var t = r.hsva; |
| 11021 |
var n = r.onChange; |
| 11022 |
var o = { backgroundColor: q({ |
| 11023 |
h: t.h, |
| 11024 |
s: 100, |
| 11025 |
v: 100, |
| 11026 |
a: 1 |
| 11027 |
}) }; |
| 11028 |
return react$1.default.createElement("div", { |
| 11029 |
className: "react-colorful__saturation", |
| 11030 |
style: o |
| 11031 |
}, react$1.default.createElement(m, { |
| 11032 |
onMove: function(e) { |
| 11033 |
n({ |
| 11034 |
s: 100 * e.left, |
| 11035 |
v: 100 - 100 * e.top |
| 11036 |
}); |
| 11037 |
}, |
| 11038 |
onKey: function(e) { |
| 11039 |
n({ |
| 11040 |
s: s(t.s + 100 * e.left, 0, 100), |
| 11041 |
v: s(t.v - 100 * e.top, 0, 100) |
| 11042 |
}); |
| 11043 |
}, |
| 11044 |
"aria-label": "Color", |
| 11045 |
"aria-valuetext": "Saturation " + b(t.s) + "%, Brightness " + b(t.v) + "%" |
| 11046 |
}, react$1.default.createElement(p, { |
| 11047 |
className: "react-colorful__saturation-pointer", |
| 11048 |
top: 1 - t.v / 100, |
| 11049 |
left: t.s / 100, |
| 11050 |
color: q(t) |
| 11051 |
}))); |
| 11052 |
}); |
| 11053 |
var F = function(e, r) { |
| 11054 |
if (e === r) return !0; |
| 11055 |
for (var t in e) if (e[t] !== r[t]) return !1; |
| 11056 |
return !0; |
| 11057 |
}; |
| 11058 |
var X = function(e, r) { |
| 11059 |
return e.toLowerCase() === r.toLowerCase() || F(C(e), C(r)); |
| 11060 |
}; |
| 11061 |
function Y(e, t, l) { |
| 11062 |
var u = i(l); |
| 11063 |
var c = (0, react$1.useState)(function() { |
| 11064 |
return e.toHsva(t); |
| 11065 |
}); |
| 11066 |
var s = c[0]; |
| 11067 |
var f = c[1]; |
| 11068 |
var v = (0, react$1.useRef)({ |
| 11069 |
color: t, |
| 11070 |
hsva: s |
| 11071 |
}); |
| 11072 |
(0, react$1.useEffect)(function() { |
| 11073 |
if (!e.equal(t, v.current.color)) { |
| 11074 |
var r = e.toHsva(t); |
| 11075 |
v.current = { |
| 11076 |
hsva: r, |
| 11077 |
color: t |
| 11078 |
}, f(r); |
| 11079 |
} |
| 11080 |
}, [t, e]), (0, react$1.useEffect)(function() { |
| 11081 |
var r; |
| 11082 |
F(s, v.current.hsva) || e.equal(r = e.fromHsva(s), v.current.color) || (v.current = { |
| 11083 |
hsva: s, |
| 11084 |
color: r |
| 11085 |
}, u(r)); |
| 11086 |
}, [ |
| 11087 |
s, |
| 11088 |
e, |
| 11089 |
u |
| 11090 |
]); |
| 11091 |
return [s, (0, react$1.useCallback)(function(e) { |
| 11092 |
f(function(r) { |
| 11093 |
return Object.assign({}, r, e); |
| 11094 |
}); |
| 11095 |
}, [])]; |
| 11096 |
} |
| 11097 |
var R; |
| 11098 |
var V = "undefined" != typeof window ? react$1.useLayoutEffect : react$1.useEffect; |
| 11099 |
var $ = function() { |
| 11100 |
return R || ("undefined" != typeof __webpack_nonce__ ? __webpack_nonce__ : void 0); |
| 11101 |
}; |
| 11102 |
var J = /* @__PURE__ */ new Map(); |
| 11103 |
var Q = function(e) { |
| 11104 |
V(function() { |
| 11105 |
var r = e.current ? e.current.ownerDocument : document; |
| 11106 |
if (void 0 !== r && !J.has(r)) { |
| 11107 |
var t = r.createElement("style"); |
| 11108 |
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); |
| 11109 |
var n = $(); |
| 11110 |
n && t.setAttribute("nonce", n), r.head.appendChild(t); |
| 11111 |
} |
| 11112 |
}, []); |
| 11113 |
}; |
| 11114 |
var U = function(t) { |
| 11115 |
var n = t.className; |
| 11116 |
var o = t.colorModel; |
| 11117 |
var a = t.color; |
| 11118 |
var l = void 0 === a ? o.defaultColor : a; |
| 11119 |
var i = t.onChange; |
| 11120 |
var s = c(t, [ |
| 11121 |
"className", |
| 11122 |
"colorModel", |
| 11123 |
"color", |
| 11124 |
"onChange" |
| 11125 |
]); |
| 11126 |
var f = (0, react$1.useRef)(null); |
| 11127 |
Q(f); |
| 11128 |
var v = Y(o, l, i); |
| 11129 |
var d = v[0]; |
| 11130 |
var h = v[1]; |
| 11131 |
var m = g(["react-colorful", n]); |
| 11132 |
return react$1.default.createElement("div", u({}, s, { |
| 11133 |
ref: f, |
| 11134 |
className: m |
| 11135 |
}), react$1.default.createElement(T, { |
| 11136 |
hsva: d, |
| 11137 |
onChange: h |
| 11138 |
}), react$1.default.createElement(S, { |
| 11139 |
hue: d.h, |
| 11140 |
onChange: h, |
| 11141 |
className: "react-colorful__last-control" |
| 11142 |
})); |
| 11143 |
}; |
| 11144 |
var W = { |
| 11145 |
defaultColor: "000", |
| 11146 |
toHsva: x, |
| 11147 |
fromHsva: function(e) { |
| 11148 |
return w({ |
| 11149 |
h: e.h, |
| 11150 |
s: e.s, |
| 11151 |
v: e.v, |
| 11152 |
a: 1 |
| 11153 |
}); |
| 11154 |
}, |
| 11155 |
equal: X |
| 11156 |
}; |
| 11157 |
var Z = function(r) { |
| 11158 |
return react$1.default.createElement(U, u({}, r, { colorModel: W })); |
| 11159 |
}; |
| 11160 |
|
| 11161 |
//#endregion |
| 11162 |
//#region modules/ai/assets/js/editor/pages/form-media/components/color-picker.js |
| 11163 |
init_defineProperty$1(); |
| 11164 |
init_slicedToArray(); |
| 11165 |
function ownKeys$12(e, r) { |
| 11166 |
var t = Object.keys(e); |
| 11167 |
if (Object.getOwnPropertySymbols) { |
| 11168 |
var o = Object.getOwnPropertySymbols(e); |
| 11169 |
r && (o = o.filter(function(r) { |
| 11170 |
return Object.getOwnPropertyDescriptor(e, r).enumerable; |
| 11171 |
})), t.push.apply(t, o); |
| 11172 |
} |
| 11173 |
return t; |
| 11174 |
} |
| 11175 |
__name(ownKeys$12, "ownKeys"); |
| 11176 |
function _objectSpread$12(e) { |
| 11177 |
for (var r = 1; r < arguments.length; r++) { |
| 11178 |
var t = null != arguments[r] ? arguments[r] : {}; |
| 11179 |
r % 2 ? ownKeys$12(Object(t), !0).forEach(function(r) { |
| 11180 |
_defineProperty$1(e, r, t[r]); |
| 11181 |
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$12(Object(t)).forEach(function(r) { |
| 11182 |
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); |
| 11183 |
}); |
| 11184 |
} |
| 11185 |
return e; |
| 11186 |
} |
| 11187 |
__name(_objectSpread$12, "_objectSpread"); |
| 11188 |
var ColorInput = function ColorInput(_ref) { |
| 11189 |
var _elementorCommon$conf; |
| 11190 |
var _elementorCommon; |
| 11191 |
var label = _ref.label; |
| 11192 |
var color = _ref.color; |
| 11193 |
var onChange = _ref.onChange; |
| 11194 |
var disabled = _ref.disabled; |
| 11195 |
var _useState2 = _slicedToArray((0, react.useState)(false), 2); |
| 11196 |
var isOpened = _useState2[0]; |
| 11197 |
var setIsOpened = _useState2[1]; |
| 11198 |
var anchorEl = (0, react.useRef)(); |
| 11199 |
var _useState4 = _slicedToArray((0, react.useState)(170001), 2); |
| 11200 |
var zIndex = _useState4[0]; |
| 11201 |
var setZIndex = _useState4[1]; |
| 11202 |
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; |
| 11203 |
(0, react.useEffect)(function() { |
| 11204 |
if (anchorEl.current) { |
| 11205 |
var element = anchorEl.current; |
| 11206 |
var currentZIndex = 0; |
| 11207 |
while (element && element !== document.body) { |
| 11208 |
var computedZIndex = window.getComputedStyle(element).zIndex; |
| 11209 |
if (computedZIndex !== "auto") { |
| 11210 |
currentZIndex = parseInt(computedZIndex, 10) || 0; |
| 11211 |
break; |
| 11212 |
} |
| 11213 |
element = element.parentElement; |
| 11214 |
} |
| 11215 |
setZIndex(currentZIndex > 0 ? currentZIndex + 1 : 170001); |
| 11216 |
} |
| 11217 |
}, [isOpened]); |
| 11218 |
var handleClick = function handleClick() { |
| 11219 |
return setIsOpened(true); |
| 11220 |
}; |
| 11221 |
var handleClose = function handleClose() { |
| 11222 |
setIsOpened(false); |
| 11223 |
}; |
| 11224 |
var handleKeyDown = function handleKeyDown(event) { |
| 11225 |
if ("Enter" === event.key || " " === event.key) { |
| 11226 |
event.preventDefault(); |
| 11227 |
handleClick(); |
| 11228 |
} |
| 11229 |
}; |
| 11230 |
var handleTextFieldChange = function handleTextFieldChange(event) { |
| 11231 |
onChange("#".concat(event.target.value)); |
| 11232 |
}; |
| 11233 |
var handleColorPickerChange = function handleColorPickerChange(colorValue) { |
| 11234 |
onChange(colorValue); |
| 11235 |
}; |
| 11236 |
var id = isOpened ? "simple-popover" : void 0; |
| 11237 |
return /*#__PURE__*/ react.default.createElement("div", { |
| 11238 |
className: "el-ai-color-input-wrapper", |
| 11239 |
style: _objectSpread$12({ |
| 11240 |
display: "flex", |
| 11241 |
alignItems: "center" |
| 11242 |
}, disabled ? { |
| 11243 |
pointerEvents: "none", |
| 11244 |
opacity: .5 |
| 11245 |
} : {}) |
| 11246 |
}, /*#__PURE__*/ react.default.createElement(_elementor_ui.FormLabel, { sx: { |
| 11247 |
whiteSpace: "nowrap", |
| 11248 |
flex: 4 |
| 11249 |
} }, label), /*#__PURE__*/ react.default.createElement("button", { |
| 11250 |
type: "button", |
| 11251 |
onClick: handleClick, |
| 11252 |
onKeyDown: handleKeyDown, |
| 11253 |
style: { |
| 11254 |
cursor: "pointer", |
| 11255 |
borderRadius: "4px", |
| 11256 |
marginRight: "8px", |
| 11257 |
marginLeft: "8px", |
| 11258 |
background: color, |
| 11259 |
width: "100%", |
| 11260 |
height: "auto", |
| 11261 |
borderColor: "rgba(0, 0, 0, 0.23)", |
| 11262 |
borderWidth: "1px", |
| 11263 |
borderStyle: "solid", |
| 11264 |
aspectRatio: "1 / 1", |
| 11265 |
flex: 1.1 |
| 11266 |
}, |
| 11267 |
"aria-describedby": id, |
| 11268 |
ref: anchorEl |
| 11269 |
}), /*#__PURE__*/ react.default.createElement(StyledTextField, { |
| 11270 |
value: color.substring(1, 7), |
| 11271 |
color: "secondary", |
| 11272 |
fullWidth: true, |
| 11273 |
InputProps: { |
| 11274 |
autoComplete: "off", |
| 11275 |
color: "secondary", |
| 11276 |
sx: { height: "100%" }, |
| 11277 |
startAdornment: /*#__PURE__*/ react.default.createElement(_elementor_ui.InputAdornment, { position: "start" }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, { |
| 11278 |
variant: "body1", |
| 11279 |
color: "secondary" |
| 11280 |
}, "#")) |
| 11281 |
}, |
| 11282 |
onChange: handleTextFieldChange, |
| 11283 |
sx: { |
| 11284 |
flex: 3, |
| 11285 |
height: "40px" |
| 11286 |
} |
| 11287 |
}), /*#__PURE__*/ react.default.createElement(_elementor_ui.Popover, { |
| 11288 |
id, |
| 11289 |
anchorOrigin: { |
| 11290 |
vertical: "bottom", |
| 11291 |
horizontal: isRTL ? "right" : "left" |
| 11292 |
}, |
| 11293 |
transformOrigin: { |
| 11294 |
vertical: "top", |
| 11295 |
horizontal: isRTL ? "right" : "left" |
| 11296 |
}, |
| 11297 |
onClose: handleClose, |
| 11298 |
open: isOpened, |
| 11299 |
anchorEl: anchorEl.current, |
| 11300 |
style: { |
| 11301 |
zIndex, |
| 11302 |
overflow: "hidden" |
| 11303 |
} |
| 11304 |
}, /*#__PURE__*/ react.default.createElement("div", { |
| 11305 |
className: "el-ai-custom-color-picker", |
| 11306 |
style: { |
| 11307 |
height: "min-content", |
| 11308 |
overflow: "hidden" |
| 11309 |
} |
| 11310 |
}, /*#__PURE__*/ react.default.createElement(Z, { |
| 11311 |
color, |
| 11312 |
onChange: handleColorPickerChange |
| 11313 |
})))); |
| 11314 |
}; |
| 11315 |
var StyledTextField = (0, _elementor_ui.styled)(_elementor_ui_TextField.default)(function() { |
| 11316 |
return { ".wp-admin & .MuiInputBase-input, & .MuiInputBase-input:focus": { |
| 11317 |
backgroundColor: "initial", |
| 11318 |
boxShadow: "none", |
| 11319 |
border: 0, |
| 11320 |
color: "inherit", |
| 11321 |
outline: 0, |
| 11322 |
padding: 0, |
| 11323 |
fontFamily: "inherit", |
| 11324 |
minHeight: "2.4375em" |
| 11325 |
} }; |
| 11326 |
}); |
| 11327 |
ColorInput.propTypes = { |
| 11328 |
label: import_prop_types$8.default.string, |
| 11329 |
color: import_prop_types$8.default.string, |
| 11330 |
onChange: import_prop_types$8.default.func.isRequired, |
| 11331 |
disabled: import_prop_types$8.default.bool |
| 11332 |
}; |
| 11333 |
|
| 11334 |
//#endregion |
| 11335 |
//#region modules/ai/assets/js/editor/pages/form-media/views/product-image-unification/hooks/use-product-image-unification.js |
| 11336 |
init_api(); |
| 11337 |
var useProductImageUnification = function useProductImageUnification(initialValue) { |
| 11338 |
return useImagePrompt((0, react.useRef)(function(payload) { |
| 11339 |
return getProductImageUnification(payload, true); |
| 11340 |
}).current, initialValue); |
| 11341 |
}; |
| 11342 |
|
| 11343 |
//#endregion |
| 11344 |
//#region modules/ai/assets/js/editor/pages/form-media/views/product-image-unification/components/product-image.js |
| 11345 |
init_defineProperty$1(); |
| 11346 |
var ProductImage = function ProductImage(_ref) { |
| 11347 |
var productId = _ref.productId; |
| 11348 |
var ratio = _ref.ratio; |
| 11349 |
var bgColor = _ref.bgColor; |
| 11350 |
var image = _ref.image; |
| 11351 |
var onUpdate = _ref.onUpdate; |
| 11352 |
var isUploading = useImageActions().isLoading; |
| 11353 |
var _useProductImageUnifi = useProductImageUnification(_defineProperty$1(_defineProperty$1(_defineProperty$1({ productId }, IMAGE_RATIO, ratio), IMAGE_BACKGROUND_COLOR, bgColor), "image", image)); |
| 11354 |
var data = _useProductImageUnifi.data; |
| 11355 |
var isGenerating = _useProductImageUnifi.isLoading; |
| 11356 |
var error = _useProductImageUnifi.error; |
| 11357 |
var send = _useProductImageUnifi.send; |
| 11358 |
var sendUsageData = _useProductImageUnifi.sendUsageData; |
| 11359 |
(0, react.useEffect)(function() { |
| 11360 |
if (onUpdate) onUpdate(data, isGenerating || isUploading, error, send, productId, ratio, bgColor, image, sendUsageData); |
| 11361 |
}, [ |
| 11362 |
data, |
| 11363 |
isGenerating, |
| 11364 |
error, |
| 11365 |
send, |
| 11366 |
productId, |
| 11367 |
ratio, |
| 11368 |
bgColor, |
| 11369 |
image, |
| 11370 |
isUploading, |
| 11371 |
onUpdate, |
| 11372 |
sendUsageData |
| 11373 |
]); |
| 11374 |
return /*#__PURE__*/ react.default.createElement("div", { style: { visibility: "hidden" } }); |
| 11375 |
}; |
| 11376 |
ProductImage.propTypes = { |
| 11377 |
productId: import_prop_types$8.default.number, |
| 11378 |
ratio: import_prop_types$8.default.string, |
| 11379 |
bgColor: import_prop_types$8.default.string, |
| 11380 |
image: import_prop_types$8.default.object, |
| 11381 |
onUpdate: import_prop_types$8.default.func |
| 11382 |
}; |
| 11383 |
|
| 11384 |
//#endregion |
| 11385 |
//#region modules/ai/assets/js/editor/pages/form-media/views/product-image-unification/index.js |
| 11386 |
init_defineProperty$1(); |
| 11387 |
init_asyncToGenerator(); |
| 11388 |
init_slicedToArray(); |
| 11389 |
init_requests_ids(); |
| 11390 |
function ownKeys$11(e, r) { |
| 11391 |
var t = Object.keys(e); |
| 11392 |
if (Object.getOwnPropertySymbols) { |
| 11393 |
var o = Object.getOwnPropertySymbols(e); |
| 11394 |
r && (o = o.filter(function(r) { |
| 11395 |
return Object.getOwnPropertyDescriptor(e, r).enumerable; |
| 11396 |
})), t.push.apply(t, o); |
| 11397 |
} |
| 11398 |
return t; |
| 11399 |
} |
| 11400 |
__name(ownKeys$11, "ownKeys"); |
| 11401 |
function _objectSpread$11(e) { |
| 11402 |
for (var r = 1; r < arguments.length; r++) { |
| 11403 |
var t = null != arguments[r] ? arguments[r] : {}; |
| 11404 |
r % 2 ? ownKeys$11(Object(t), !0).forEach(function(r) { |
| 11405 |
_defineProperty$1(e, r, t[r]); |
| 11406 |
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$11(Object(t)).forEach(function(r) { |
| 11407 |
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); |
| 11408 |
}); |
| 11409 |
} |
| 11410 |
return e; |
| 11411 |
} |
| 11412 |
__name(_objectSpread$11, "_objectSpread"); |
| 11413 |
var ProductImageUnification = function ProductImageUnification(_ref) { |
| 11414 |
var _products$images$leng; |
| 11415 |
var _products$images; |
| 11416 |
var _Object$values; |
| 11417 |
var _products$images$leng2; |
| 11418 |
var _products$images2; |
| 11419 |
var _products$images$leng3; |
| 11420 |
var _products$images3; |
| 11421 |
var _errorlessProducts$le; |
| 11422 |
var _products$images4; |
| 11423 |
var onClose = _ref.onClose; |
| 11424 |
var setGenerate = useRequestIds().setGenerate; |
| 11425 |
var products = useEditImage().editImage; |
| 11426 |
var _usePromptSettings = usePromptSettings(); |
| 11427 |
var settings = _usePromptSettings.settings; |
| 11428 |
var updateSettings = _usePromptSettings.updateSettings; |
| 11429 |
var _useState2 = _slicedToArray((0, react.useState)({}), 2); |
| 11430 |
var productsData = _useState2[0]; |
| 11431 |
var setProductsData = _useState2[1]; |
| 11432 |
var _useState4 = _slicedToArray((0, react.useState)({}), 2); |
| 11433 |
var loadingMap = _useState4[0]; |
| 11434 |
var setLoadingMap = _useState4[1]; |
| 11435 |
var _useState6 = _slicedToArray((0, react.useState)({}), 2); |
| 11436 |
var errorMap = _useState6[0]; |
| 11437 |
var setErrorMap = _useState6[1]; |
| 11438 |
var _useState8 = _slicedToArray((0, react.useState)({}), 2); |
| 11439 |
var checkboxColorMap = _useState8[0]; |
| 11440 |
var setCheckboxColorMap = _useState8[1]; |
| 11441 |
var _useState0 = _slicedToArray((0, react.useState)(false), 2); |
| 11442 |
var wasGeneratedOnce = _useState0[0]; |
| 11443 |
var setWasGeneratedOnce = _useState0[1]; |
| 11444 |
var useMultipleImages = useImageActions().useMultipleImages; |
| 11445 |
var _useState10 = _slicedToArray((0, react.useState)(false), 2); |
| 11446 |
var isSavingImages = _useState10[0]; |
| 11447 |
var setIsSavingImages = _useState10[1]; |
| 11448 |
var errorlessProducts = Object.values(productsData).filter(function(_ref2) { |
| 11449 |
var _errorMap$productId; |
| 11450 |
return !((_errorMap$productId = errorMap[_ref2.productId]) !== null && _errorMap$productId !== void 0 && _errorMap$productId.errorGenerating); |
| 11451 |
}); |
| 11452 |
var use = (0, react.useCallback)(/*#__PURE__*/ _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee() { |
| 11453 |
var generatedImages; |
| 11454 |
var imagesToSave; |
| 11455 |
return import_regenerator$2.default.wrap(function(_context) { |
| 11456 |
while (1) switch (_context.prev = _context.next) { |
| 11457 |
case 0: |
| 11458 |
setIsSavingImages(true); |
| 11459 |
generatedImages = errorlessProducts.filter(function(_ref4) { |
| 11460 |
var data = _ref4.data; |
| 11461 |
return _ref4.wasGenerated && (data === null || data === void 0 ? void 0 : data.isChecked) && (data === null || data === void 0 ? void 0 : data.productId) !== void 0; |
| 11462 |
}); |
| 11463 |
imagesToSave = generatedImages.map(function(_ref5) { |
| 11464 |
var data = _ref5.data; |
| 11465 |
return _objectSpread$11(_objectSpread$11({}, data), {}, { |
| 11466 |
editor_post_id: data.productId, |
| 11467 |
unique_id: "ai-product-unification-".concat(data.productId) |
| 11468 |
}); |
| 11469 |
}); |
| 11470 |
_context.next = 1; |
| 11471 |
return useMultipleImages(imagesToSave); |
| 11472 |
case 1: |
| 11473 |
generatedImages.forEach(function(_ref6) { |
| 11474 |
var sendUsageData = _ref6.sendUsageData; |
| 11475 |
sendUsageData(); |
| 11476 |
}); |
| 11477 |
onClose(); |
| 11478 |
case 2: |
| 11479 |
case "end": return _context.stop(); |
| 11480 |
} |
| 11481 |
}, _callee); |
| 11482 |
})), [ |
| 11483 |
onClose, |
| 11484 |
errorlessProducts, |
| 11485 |
useMultipleImages |
| 11486 |
]); |
| 11487 |
var generatedAspectRatio = (0, react.useMemo)(function() { |
| 11488 |
return settings[IMAGE_RATIO]; |
| 11489 |
}, [settings]); |
| 11490 |
var generatedBgColor = (0, react.useMemo)(function() { |
| 11491 |
return settings[IMAGE_BACKGROUND_COLOR]; |
| 11492 |
}, [settings]); |
| 11493 |
var onProductUpdate = (0, react.useCallback)(function(res, isLoadingResult, errorGenerating, _req, productId, ratio, bgColor, image, sendUsageData) { |
| 11494 |
setLoadingMap(function(prevState) { |
| 11495 |
return _objectSpread$11(_objectSpread$11({}, prevState), {}, _defineProperty$1({}, productId, !!isLoadingResult)); |
| 11496 |
}); |
| 11497 |
setErrorMap(function(prevState) { |
| 11498 |
return _objectSpread$11(_objectSpread$11({}, prevState), {}, _defineProperty$1({}, productId, { errorGenerating })); |
| 11499 |
}); |
| 11500 |
setProductsData(function(prevState) { |
| 11501 |
var _res$result; |
| 11502 |
var _ref7; |
| 11503 |
var _res$result$; |
| 11504 |
var _res$result2; |
| 11505 |
var _prevState$productId; |
| 11506 |
var _prevState$productId$; |
| 11507 |
var _prevState$productId2; |
| 11508 |
var _checkboxColorMap$pro; |
| 11509 |
return _objectSpread$11(_objectSpread$11({}, prevState), {}, _defineProperty$1({}, productId, _objectSpread$11(_objectSpread$11({}, prevState[productId]), {}, { |
| 11510 |
productId, |
| 11511 |
res, |
| 11512 |
req: function req() { |
| 11513 |
return _req({ |
| 11514 |
postId: productId, |
| 11515 |
settings: _defineProperty$1(_defineProperty$1({}, IMAGE_RATIO, ratio), IMAGE_BACKGROUND_COLOR, bgColor), |
| 11516 |
image |
| 11517 |
}); |
| 11518 |
}, |
| 11519 |
sendUsageData, |
| 11520 |
wasGenerated: (res === null || res === void 0 || (_res$result = res.result) === null || _res$result === void 0 ? void 0 : _res$result[0]) !== void 0, |
| 11521 |
data: _objectSpread$11(_objectSpread$11({ 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 : {}), {}, { |
| 11522 |
seed: productId, |
| 11523 |
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, |
| 11524 |
isLoading: isLoadingResult, |
| 11525 |
checkboxColor: (_checkboxColorMap$pro = checkboxColorMap[productId]) !== null && _checkboxColorMap$pro !== void 0 ? _checkboxColorMap$pro : "rgba(0, 0, 0, 0.54)" |
| 11526 |
}) |
| 11527 |
}))); |
| 11528 |
}); |
| 11529 |
}, [checkboxColorMap]); |
| 11530 |
var isLoading = errorlessProducts.some(function(_ref8) { |
| 11531 |
return loadingMap[_ref8.productId]; |
| 11532 |
}); |
| 11533 |
var isError = Object.values(errorMap).length && Object.values(errorMap).every(function(_ref9) { |
| 11534 |
return _ref9.errorGenerating; |
| 11535 |
}); |
| 11536 |
var thumbnailThreshold = 10; |
| 11537 |
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; |
| 11538 |
var selectedProducts = errorlessProducts.filter(function(_ref0) { |
| 11539 |
var data = _ref0.data; |
| 11540 |
return data.isChecked && !data.isLoading; |
| 11541 |
}); |
| 11542 |
var handleSubmit = (0, react.useCallback)(function(event) { |
| 11543 |
event.preventDefault(); |
| 11544 |
setGenerate(); |
| 11545 |
setWasGeneratedOnce(true); |
| 11546 |
var isLightColor = function isLightColor(color) { |
| 11547 |
var rgb = parseInt(color.slice(1), 16); |
| 11548 |
var r = rgb >> 16 & 255; |
| 11549 |
var g = rgb >> 8 & 255; |
| 11550 |
var b = rgb >> 0 & 255; |
| 11551 |
return .299 * r + .587 * g + .114 * b > 128; |
| 11552 |
}; |
| 11553 |
var productsToUnify = (errorlessProducts.length ? errorlessProducts : Object.values(productsData)).filter(function(product) { |
| 11554 |
var _product$data; |
| 11555 |
return ((_product$data = product.data) === null || _product$data === void 0 ? void 0 : _product$data.isChecked) && product.req; |
| 11556 |
}); |
| 11557 |
var newCheckboxColor = isLightColor(generatedBgColor) ? "rgba(0, 0, 0, 0.54)" : "rgba( 255, 255, 255, 0.7 )"; |
| 11558 |
if (productsToUnify.find(function(product) { |
| 11559 |
return checkboxColorMap[product.productId] !== newCheckboxColor; |
| 11560 |
})) setCheckboxColorMap(function(prevState) { |
| 11561 |
var newColorMap = _objectSpread$11({}, prevState); |
| 11562 |
productsToUnify.forEach(function(product) { |
| 11563 |
newColorMap[product.productId] = newCheckboxColor; |
| 11564 |
}); |
| 11565 |
return newColorMap; |
| 11566 |
}); |
| 11567 |
productsToUnify.forEach(function(product) { |
| 11568 |
return product.req().catch(function() {}); |
| 11569 |
}); |
| 11570 |
}, [ |
| 11571 |
checkboxColorMap, |
| 11572 |
errorlessProducts, |
| 11573 |
generatedBgColor, |
| 11574 |
productsData, |
| 11575 |
setGenerate |
| 11576 |
]); |
| 11577 |
return /*#__PURE__*/ react.default.createElement(View, null, /*#__PURE__*/ react.default.createElement(View.Panel, null, /*#__PURE__*/ react.default.createElement(View.PanelHeading, { |
| 11578 |
primary: (0, _wordpress_i18n.__)("Unify images", "elementor"), |
| 11579 |
secondary: (0, _wordpress_i18n.__)("Select a set of parameters and AI will automate your adjustments:", "elementor") |
| 11580 |
}), isError && /*#__PURE__*/ react.default.createElement(View.ErrorMessage, { |
| 11581 |
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, |
| 11582 |
onRetry: handleSubmit |
| 11583 |
}), /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, { gap: 2 }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, { sx: { |
| 11584 |
display: "flex", |
| 11585 |
flexWrap: "wrap", |
| 11586 |
width: "100%", |
| 11587 |
"& .MuiAvatar-root": { margin: .5 } |
| 11588 |
} }, products === null || products === void 0 ? void 0 : products.images.slice(0, exceedThumbnailThreshold ? thumbnailThreshold - 1 : thumbnailThreshold).map(function(img) { |
| 11589 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Avatar, { |
| 11590 |
key: img.productId, |
| 11591 |
alt: img.productId + "", |
| 11592 |
src: img.image_url, |
| 11593 |
variant: "square", |
| 11594 |
sx: { |
| 11595 |
width: 50, |
| 11596 |
height: 50 |
| 11597 |
} |
| 11598 |
}); |
| 11599 |
}), exceedThumbnailThreshold && /*#__PURE__*/ react.default.createElement(_elementor_ui.Avatar, { |
| 11600 |
variant: "square", |
| 11601 |
sx: { |
| 11602 |
bgcolor: "lightgray", |
| 11603 |
width: 50, |
| 11604 |
height: 50 |
| 11605 |
} |
| 11606 |
}, ((_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, { |
| 11607 |
gap: 2, |
| 11608 |
sx: { my: 2.5 } |
| 11609 |
}, /*#__PURE__*/ react.default.createElement(ColorInput, { |
| 11610 |
label: (0, _wordpress_i18n.__)("Background Color", "elementor"), |
| 11611 |
color: generatedBgColor, |
| 11612 |
onChange: function onChange(color) { |
| 11613 |
return updateSettings(_defineProperty$1({}, IMAGE_BACKGROUND_COLOR, color)); |
| 11614 |
}, |
| 11615 |
disabled: isLoading |
| 11616 |
}), /*#__PURE__*/ react.default.createElement(ImageRatioSelect, { |
| 11617 |
disabled: true, |
| 11618 |
value: generatedAspectRatio, |
| 11619 |
onChange: function onChange(event) { |
| 11620 |
return updateSettings(_defineProperty$1({}, IMAGE_RATIO, event.target.value)); |
| 11621 |
} |
| 11622 |
}), /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, { |
| 11623 |
gap: 2, |
| 11624 |
sx: { my: 2.5 } |
| 11625 |
}, 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: { |
| 11626 |
display: "flex", |
| 11627 |
flexDirection: "column", |
| 11628 |
height: "100%", |
| 11629 |
alignItems: "center", |
| 11630 |
justifyContent: "center", |
| 11631 |
minHeight: "76vh" |
| 11632 |
} }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, { sx: { |
| 11633 |
flex: 1, |
| 11634 |
overflowY: "auto", |
| 11635 |
display: "flex", |
| 11636 |
flexDirection: "column", |
| 11637 |
height: "100%", |
| 11638 |
alignItems: "center", |
| 11639 |
justifyContent: "center", |
| 11640 |
overflowX: "hidden" |
| 11641 |
} }, wasGeneratedOnce ? /*#__PURE__*/ react.default.createElement(react.default.Fragment, null, errorlessProducts.length > 1 && errorlessProducts.some(function(_ref1) { |
| 11642 |
return !_ref1.data.isLoading; |
| 11643 |
}) && /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, { sx: { |
| 11644 |
display: "flex", |
| 11645 |
flexDirection: "row", |
| 11646 |
alignItems: "inherit", |
| 11647 |
justifyContent: "space-between", |
| 11648 |
width: "100%" |
| 11649 |
} }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, { |
| 11650 |
variant: "body2", |
| 11651 |
color: "secondary" |
| 11652 |
}, (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, { |
| 11653 |
variant: "text", |
| 11654 |
color: "secondary", |
| 11655 |
onClick: function onClick() { |
| 11656 |
var isChecked = !selectedProducts.some(function(product) { |
| 11657 |
var _product$data2; |
| 11658 |
return (_product$data2 = product.data) === null || _product$data2 === void 0 ? void 0 : _product$data2.isChecked; |
| 11659 |
}); |
| 11660 |
setProductsData(function(prevState) { |
| 11661 |
var newState = _objectSpread$11({}, prevState); |
| 11662 |
Object.values(newState).forEach(function(product) { |
| 11663 |
var _product$data3; |
| 11664 |
if (isChecked !== ((_product$data3 = product.data) === null || _product$data3 === void 0 ? void 0 : _product$data3.isChecked)) newState[product.productId] = _objectSpread$11(_objectSpread$11({}, product), {}, { data: _objectSpread$11(_objectSpread$11({}, product.data), {}, { isChecked }) }); |
| 11665 |
}); |
| 11666 |
return newState; |
| 11667 |
}); |
| 11668 |
} |
| 11669 |
}, selectedProducts.some(function(product) { |
| 11670 |
var _product$data4; |
| 11671 |
return (_product$data4 = product.data) === null || _product$data4 === void 0 ? void 0 : _product$data4.isChecked; |
| 11672 |
}) ? (0, _wordpress_i18n.__)("Clear all", "elementor") : (0, _wordpress_i18n.__)("Select all", "elementor"))), /*#__PURE__*/ react.default.createElement(ImagesDisplay, { |
| 11673 |
images: errorlessProducts.map(function(product) { |
| 11674 |
return product.data; |
| 11675 |
}), |
| 11676 |
cols: function getCols() { |
| 11677 |
var dataLength = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 1; |
| 11678 |
return Math.min(Math.ceil(Math.sqrt(dataLength !== null && dataLength !== void 0 ? dataLength : 1)), 4); |
| 11679 |
}((_errorlessProducts$le = errorlessProducts.length) !== null && _errorlessProducts$le !== void 0 ? _errorlessProducts$le : 1), |
| 11680 |
overlay: false, |
| 11681 |
onSelectChange: function onSelectChange(productId, isChecked) { |
| 11682 |
return setProductsData(function(prevState) { |
| 11683 |
var _prevState$productId3; |
| 11684 |
if ((_prevState$productId3 = prevState[productId]) !== null && _prevState$productId3 !== void 0 && _prevState$productId3.data) prevState[productId].data.isChecked = isChecked; |
| 11685 |
return _objectSpread$11({}, prevState); |
| 11686 |
}); |
| 11687 |
} |
| 11688 |
})) : /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, { |
| 11689 |
component: "img", |
| 11690 |
src: window.UnifyProductImagesConfig.placeholder, |
| 11691 |
alt: (0, _wordpress_i18n.__)("Example GIF", "elementor") |
| 11692 |
})), wasGeneratedOnce && !isError && errorlessProducts.length && errorlessProducts.some(function(_ref10) { |
| 11693 |
var data = _ref10.data; |
| 11694 |
var errorGenerating = _ref10.errorGenerating; |
| 11695 |
var wasGenerated = _ref10.wasGenerated; |
| 11696 |
return (data === null || data === void 0 ? void 0 : data.isChecked) && !(data !== null && data !== void 0 && data.isLoadingResult) && !errorGenerating && wasGenerated; |
| 11697 |
}) && /*#__PURE__*/ react.default.createElement(ImageActions.UseImage, { |
| 11698 |
onClick: use, |
| 11699 |
sx: { |
| 11700 |
alignSelf: "flex-end", |
| 11701 |
mt: 2 |
| 11702 |
} |
| 11703 |
}))), (_products$images4 = products.images) === null || _products$images4 === void 0 ? void 0 : _products$images4.filter(function(img) { |
| 11704 |
return img.productId; |
| 11705 |
}).map(function(img) { |
| 11706 |
return /*#__PURE__*/ react.default.createElement(ProductImage, { |
| 11707 |
key: "product-".concat(img.productId), |
| 11708 |
productId: img.productId, |
| 11709 |
ratio: settings[IMAGE_RATIO], |
| 11710 |
bgColor: settings[IMAGE_BACKGROUND_COLOR], |
| 11711 |
image: img, |
| 11712 |
onUpdate: onProductUpdate |
| 11713 |
}); |
| 11714 |
})); |
| 11715 |
}; |
| 11716 |
ProductImageUnification.propTypes = { onClose: import_prop_types$8.default.func }; |
| 11717 |
|
| 11718 |
//#endregion |
| 11719 |
//#region modules/ai/assets/js/editor/pages/form-media/views/isolate-objects/hooks/use-isolate-objects.js |
| 11720 |
init_api(); |
| 11721 |
var useIsolateObject = function useIsolateObject(initialValue) { |
| 11722 |
return useImagePrompt(function fetchAction(payload) { |
| 11723 |
return getImageToImageIsolateObjects(payload); |
| 11724 |
}, initialValue); |
| 11725 |
}; |
| 11726 |
|
| 11727 |
//#endregion |
| 11728 |
//#region modules/ai/assets/js/editor/pages/form-media/views/isolate-objects/index.js |
| 11729 |
init_defineProperty$1(); |
| 11730 |
init_requests_ids(); |
| 11731 |
var IsolateObject = function IsolateObject() { |
| 11732 |
var editImage = useEditImage().editImage; |
| 11733 |
var setGenerate = useRequestIds().setGenerate; |
| 11734 |
var _useImageActions = useImageActions(); |
| 11735 |
var use = _useImageActions.use; |
| 11736 |
var edit = _useImageActions.edit; |
| 11737 |
var isUploading = _useImageActions.isLoading; |
| 11738 |
var _usePromptSettings = usePromptSettings(); |
| 11739 |
var settings = _usePromptSettings.settings; |
| 11740 |
var updateSettings = _usePromptSettings.updateSettings; |
| 11741 |
var _useIsolateObject = useIsolateObject(); |
| 11742 |
var data = _useIsolateObject.data; |
| 11743 |
var send = _useIsolateObject.send; |
| 11744 |
var isGenerating = _useIsolateObject.isLoading; |
| 11745 |
var error = _useIsolateObject.error; |
| 11746 |
var isLoading = isGenerating || isUploading; |
| 11747 |
var _useImageSize = useImageSize(editImage.aspectRatio); |
| 11748 |
var width = _useImageSize.width; |
| 11749 |
var height = _useImageSize.height; |
| 11750 |
var generatedAspectRatio = (0, react.useMemo)(function() { |
| 11751 |
return settings[IMAGE_RATIO]; |
| 11752 |
}, [settings]); |
| 11753 |
var generatedBgColor = (0, react.useMemo)(function() { |
| 11754 |
return settings[IMAGE_BACKGROUND_COLOR]; |
| 11755 |
}, [settings]); |
| 11756 |
var handleSubmit = function handleSubmit(event) { |
| 11757 |
event.preventDefault(); |
| 11758 |
setGenerate(); |
| 11759 |
send({ |
| 11760 |
image: editImage, |
| 11761 |
settings: _defineProperty$1(_defineProperty$1({}, IMAGE_RATIO, generatedAspectRatio), IMAGE_BACKGROUND_COLOR, generatedBgColor), |
| 11762 |
featureIdentifier: FEATURE_IDENTIFIER.ISOLATE_OBJECT |
| 11763 |
}); |
| 11764 |
}; |
| 11765 |
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, { |
| 11766 |
primary: (0, _wordpress_i18n.__)("Isolate Object", "elementor"), |
| 11767 |
secondary: (0, _wordpress_i18n.__)("Remove the background, center your object, and add a drop shadow for a clean look.", "elementor") |
| 11768 |
}), error && /*#__PURE__*/ react.default.createElement(View.ErrorMessage, { |
| 11769 |
error, |
| 11770 |
onRetry: handleSubmit |
| 11771 |
}), /*#__PURE__*/ react.default.createElement(ImageForm, { onSubmit: handleSubmit }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, { |
| 11772 |
gap: 2, |
| 11773 |
sx: { my: 2.5 } |
| 11774 |
}, /*#__PURE__*/ react.default.createElement(ColorInput, { |
| 11775 |
label: (0, _wordpress_i18n.__)("Background Color", "elementor"), |
| 11776 |
color: generatedBgColor, |
| 11777 |
onChange: function onChange(color) { |
| 11778 |
return updateSettings(_defineProperty$1({}, IMAGE_BACKGROUND_COLOR, color)); |
| 11779 |
}, |
| 11780 |
disabled: isLoading |
| 11781 |
}), /*#__PURE__*/ react.default.createElement(GenerateSubmit, { |
| 11782 |
disabled: isLoading, |
| 11783 |
loading: isLoading |
| 11784 |
}, (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, { |
| 11785 |
transparentContainer: true, |
| 11786 |
onUseImage: use, |
| 11787 |
onEditImage: edit, |
| 11788 |
images: data.result, |
| 11789 |
aspectRatio: editImage.aspectRatio |
| 11790 |
})) : /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, null, /*#__PURE__*/ react.default.createElement(SingleImagePreview, null, /*#__PURE__*/ react.default.createElement(SingleImagePreview.Image, { |
| 11791 |
src: editImage.url, |
| 11792 |
alt: editImage.alt, |
| 11793 |
style: { |
| 11794 |
width, |
| 11795 |
height |
| 11796 |
} |
| 11797 |
}))))); |
| 11798 |
}; |
| 11799 |
|
| 11800 |
//#endregion |
| 11801 |
//#region modules/ai/assets/js/editor/pages/form-media/media-outlet.js |
| 11802 |
init_loader(); |
| 11803 |
init_prompt_history_action_context(); |
| 11804 |
var MediaOutlet = function MediaOutlet(_ref) { |
| 11805 |
var _ref$additionalOption = _ref.additionalOptions; |
| 11806 |
var additionalOptions = _ref$additionalOption === void 0 ? null : _ref$additionalOption; |
| 11807 |
var _ref$onClose = _ref.onClose; |
| 11808 |
var onClose = _ref$onClose === void 0 ? null : _ref$onClose; |
| 11809 |
var editImage = useEditImage().editImage; |
| 11810 |
var _useLocation = useLocation({ current: (additionalOptions === null || additionalOptions === void 0 ? void 0 : additionalOptions.location) || LOCATIONS.GENERATE }); |
| 11811 |
var current = _useLocation.current; |
| 11812 |
var navigate = _useLocation.navigate; |
| 11813 |
(0, react.useEffect)(function() { |
| 11814 |
if ((additionalOptions === null || additionalOptions === void 0 ? void 0 : additionalOptions.location) && additionalOptions.location !== LOCATIONS.GENERATE) { |
| 11815 |
navigate(additionalOptions.location); |
| 11816 |
return; |
| 11817 |
} |
| 11818 |
if (editImage.url) if (new RegExp(IMAGE_PLACEHOLDERS_HOSTS.WIREFRAME).test(new URL(editImage.url).host)) navigate(LOCATIONS.GENERATE); |
| 11819 |
else if ("url" === editImage.source || editImage.id) navigate(LOCATIONS.IMAGE_TOOLS); |
| 11820 |
else navigate(LOCATIONS.GENERATE); |
| 11821 |
}, [ |
| 11822 |
editImage.id, |
| 11823 |
editImage.url, |
| 11824 |
editImage.source, |
| 11825 |
additionalOptions === null || additionalOptions === void 0 ? void 0 : additionalOptions.location |
| 11826 |
]); |
| 11827 |
useSubscribeOnPromptHistoryAction([{ |
| 11828 |
type: ACTION_TYPES.RESTORE, |
| 11829 |
handler: function handler() { |
| 11830 |
if (current !== LOCATIONS.GENERATE) navigate(LOCATIONS.GENERATE); |
| 11831 |
} |
| 11832 |
}]); |
| 11833 |
if (!current) return /*#__PURE__*/ react.default.createElement(View, { alignItems: "center" }, /*#__PURE__*/ react.default.createElement(Loader, null)); |
| 11834 |
return /*#__PURE__*/ react.default.createElement(react.default.Fragment, null, current === LOCATIONS.GENERATE && /*#__PURE__*/ react.default.createElement(Generate, { |
| 11835 |
textToImageHook: additionalOptions !== null && additionalOptions !== void 0 && additionalOptions.textToImageHook ? additionalOptions === null || additionalOptions === void 0 ? void 0 : additionalOptions.textToImageHook : useTextToImage, |
| 11836 |
predefinedPrompt: additionalOptions === null || additionalOptions === void 0 ? void 0 : additionalOptions.predefinedPrompt, |
| 11837 |
initialSettings: additionalOptions === null || additionalOptions === void 0 ? void 0 : additionalOptions.initialSettings |
| 11838 |
}), 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)); |
| 11839 |
}; |
| 11840 |
MediaOutlet.propTypes = { |
| 11841 |
additionalOptions: import_prop_types$8.default.object, |
| 11842 |
onClose: import_prop_types$8.default.func |
| 11843 |
}; |
| 11844 |
|
| 11845 |
//#endregion |
| 11846 |
//#region modules/ai/assets/js/editor/pages/form-media/components/unsaved-changes-alert.js |
| 11847 |
init_extends(); |
| 11848 |
init_objectWithoutProperties$1(); |
| 11849 |
var _excluded$14 = ["onClose", "onCancel"]; |
| 11850 |
var UnsavedChangesAlert$1 = function UnsavedChangesAlert(_ref) { |
| 11851 |
var onClose = _ref.onClose; |
| 11852 |
var onCancel = _ref.onCancel; |
| 11853 |
var props = _objectWithoutProperties$1(_ref, _excluded$14); |
| 11854 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Dialog, _extends$1({ |
| 11855 |
sx: { zIndex: 2e5 }, |
| 11856 |
"aria-labelledby": "unsaved-changes-alert-title", |
| 11857 |
"aria-describedby": "unsaved-changes-alert-description" |
| 11858 |
}, 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, { |
| 11859 |
onClick: onCancel, |
| 11860 |
color: "secondary" |
| 11861 |
}, (0, _wordpress_i18n.__)("Cancel", "elementor")), /*#__PURE__*/ react.default.createElement(_elementor_ui.Button, { |
| 11862 |
onClick: onClose, |
| 11863 |
color: "error", |
| 11864 |
variant: "contained" |
| 11865 |
}, (0, _wordpress_i18n.__)("Yes, leave", "elementor")))); |
| 11866 |
}; |
| 11867 |
UnsavedChangesAlert$1.propTypes = { |
| 11868 |
onClose: import_prop_types$8.default.func, |
| 11869 |
onCancel: import_prop_types$8.default.func |
| 11870 |
}; |
| 11871 |
|
| 11872 |
//#endregion |
| 11873 |
//#region node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteral.js |
| 11874 |
function _taggedTemplateLiteral(e, t) { |
| 11875 |
return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); |
| 11876 |
} |
| 11877 |
|
| 11878 |
//#endregion |
| 11879 |
//#region modules/ai/assets/js/editor/components/prompt-history/history-button.js |
| 11880 |
init_extends(); |
| 11881 |
init_objectWithoutProperties$1(); |
| 11882 |
var _excluded$13 = ["isActive"]; |
| 11883 |
var _templateObject$5; |
| 11884 |
var StyledHistoryButton = (0, _elementor_ui.styled)(_elementor_ui.IconButton)(_templateObject$5 || (_templateObject$5 = _taggedTemplateLiteral([ |
| 11885 |
"\n margin-right: ", |
| 11886 |
";\n\n ", |
| 11887 |
"\n" |
| 11888 |
])), function(_ref) { |
| 11889 |
return _ref.theme.spacing(2); |
| 11890 |
}, function(_ref2) { |
| 11891 |
var isActive = _ref2.isActive; |
| 11892 |
var theme = _ref2.theme; |
| 11893 |
return isActive && "\n background-color: ".concat(theme.palette.action.hover, ";\n color: ").concat(theme.palette.text.tertiary, ";\n "); |
| 11894 |
}); |
| 11895 |
var PromptHistoryButton = function PromptHistoryButton(_ref3) { |
| 11896 |
var isActive = _ref3.isActive; |
| 11897 |
var props = _objectWithoutProperties$1(_ref3, _excluded$13); |
| 11898 |
return /*#__PURE__*/ react.default.createElement(StyledHistoryButton, _extends$1({ |
| 11899 |
"aria-label": (0, _wordpress_i18n.__)("Show prompt history", "elementor"), |
| 11900 |
type: "button", |
| 11901 |
size: "small", |
| 11902 |
isActive |
| 11903 |
}, props), /*#__PURE__*/ react.default.createElement(_elementor_icons.HistoryIcon, null)); |
| 11904 |
}; |
| 11905 |
PromptHistoryButton.propTypes = { isActive: import_prop_types$8.default.bool.isRequired }; |
| 11906 |
|
| 11907 |
//#endregion |
| 11908 |
//#region modules/ai/assets/js/editor/hooks/use-prompt-history.js |
| 11909 |
init_asyncToGenerator(); |
| 11910 |
init_slicedToArray(); |
| 11911 |
init_defineProperty$1(); |
| 11912 |
init_api(); |
| 11913 |
function ownKeys$10(e, r) { |
| 11914 |
var t = Object.keys(e); |
| 11915 |
if (Object.getOwnPropertySymbols) { |
| 11916 |
var o = Object.getOwnPropertySymbols(e); |
| 11917 |
r && (o = o.filter(function(r) { |
| 11918 |
return Object.getOwnPropertyDescriptor(e, r).enumerable; |
| 11919 |
})), t.push.apply(t, o); |
| 11920 |
} |
| 11921 |
return t; |
| 11922 |
} |
| 11923 |
__name(ownKeys$10, "ownKeys"); |
| 11924 |
function _objectSpread$10(e) { |
| 11925 |
for (var r = 1; r < arguments.length; r++) { |
| 11926 |
var t = null != arguments[r] ? arguments[r] : {}; |
| 11927 |
r % 2 ? ownKeys$10(Object(t), !0).forEach(function(r) { |
| 11928 |
_defineProperty$1(e, r, t[r]); |
| 11929 |
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$10(Object(t)).forEach(function(r) { |
| 11930 |
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); |
| 11931 |
}); |
| 11932 |
} |
| 11933 |
return e; |
| 11934 |
} |
| 11935 |
__name(_objectSpread$10, "_objectSpread"); |
| 11936 |
var getImageThumbnailURL = function getImageThumbnailURL(base, imageURL) { |
| 11937 |
if (!base) return imageURL; |
| 11938 |
return "".concat(base, "/?o=").concat(btoa(imageURL, false)); |
| 11939 |
}; |
| 11940 |
var normalizeItems = function normalizeItems(response) { |
| 11941 |
var meta = response.meta; |
| 11942 |
var items = response.items; |
| 11943 |
return items === null || items === void 0 ? void 0 : items.map(function(item) { |
| 11944 |
var _item$request; |
| 11945 |
var _item$request2; |
| 11946 |
var _item$request3; |
| 11947 |
var _item$response; |
| 11948 |
var _item$response2; |
| 11949 |
var _item$response3; |
| 11950 |
return { |
| 11951 |
id: item === null || item === void 0 ? void 0 : item.elementorApiId, |
| 11952 |
date: item === null || item === void 0 ? void 0 : item.createdAt, |
| 11953 |
action: item === null || item === void 0 ? void 0 : item.action, |
| 11954 |
prompt: item === null || item === void 0 || (_item$request = item.request) === null || _item$request === void 0 ? void 0 : _item$request.prompt, |
| 11955 |
imageType: item === null || item === void 0 || (_item$request2 = item.request) === null || _item$request2 === void 0 ? void 0 : _item$request2.image_type, |
| 11956 |
ratio: item === null || item === void 0 || (_item$request3 = item.request) === null || _item$request3 === void 0 ? void 0 : _item$request3.ratio, |
| 11957 |
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, |
| 11958 |
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, |
| 11959 |
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) { |
| 11960 |
return _objectSpread$10(_objectSpread$10({}, image), {}, { image_url: getImageThumbnailURL(meta.thumbnailUrl, image.image_url) }); |
| 11961 |
}) |
| 11962 |
}; |
| 11963 |
}); |
| 11964 |
}; |
| 11965 |
var usePromptHistory = function usePromptHistory(historyType) { |
| 11966 |
var _useState2 = _slicedToArray((0, react.useState)(false), 2); |
| 11967 |
var isLoading = _useState2[0]; |
| 11968 |
var setIsLoading = _useState2[1]; |
| 11969 |
var _useState4 = _slicedToArray((0, react.useState)({}), 2); |
| 11970 |
var data = _useState4[0]; |
| 11971 |
var setData = _useState4[1]; |
| 11972 |
var _useState6 = _slicedToArray((0, react.useState)(""), 2); |
| 11973 |
var error = _useState6[0]; |
| 11974 |
var setError = _useState6[1]; |
| 11975 |
var fetchData = /*#__PURE__*/ function() { |
| 11976 |
var _ref2 = _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee(_ref) { |
| 11977 |
var page; |
| 11978 |
var limit; |
| 11979 |
return import_regenerator$2.default.wrap(function(_context) { |
| 11980 |
while (1) switch (_context.prev = _context.next) { |
| 11981 |
case 0: |
| 11982 |
page = _ref.page, limit = _ref.limit; |
| 11983 |
return _context.abrupt("return", new Promise(function(resolve, reject) { |
| 11984 |
setIsLoading(true); |
| 11985 |
getHistory(historyType, page, limit).then(function(response) { |
| 11986 |
var clone = JSON.parse(JSON.stringify(data)); |
| 11987 |
clone.meta = response.meta; |
| 11988 |
clone.items = [].concat(_toConsumableArray((clone === null || clone === void 0 ? void 0 : clone.items) || []), _toConsumableArray(normalizeItems(response))); |
| 11989 |
setData(clone); |
| 11990 |
resolve(true); |
| 11991 |
}).catch(function(err) { |
| 11992 |
var finalError = (err === null || err === void 0 ? void 0 : err.responseText) || err; |
| 11993 |
setError(finalError); |
| 11994 |
reject(finalError); |
| 11995 |
}).finally(function() { |
| 11996 |
return setIsLoading(false); |
| 11997 |
}); |
| 11998 |
})); |
| 11999 |
case 1: |
| 12000 |
case "end": return _context.stop(); |
| 12001 |
} |
| 12002 |
}, _callee); |
| 12003 |
})); |
| 12004 |
return function fetchData(_x) { |
| 12005 |
return _ref2.apply(this, arguments); |
| 12006 |
}; |
| 12007 |
}(); |
| 12008 |
return { |
| 12009 |
isLoading, |
| 12010 |
error, |
| 12011 |
items: data.items, |
| 12012 |
meta: data.meta, |
| 12013 |
fetchData, |
| 12014 |
deleteItemById: function deleteItemById(id) { |
| 12015 |
var itemIndex = data.items.findIndex(function(item) { |
| 12016 |
return item.id === id; |
| 12017 |
}); |
| 12018 |
if (-1 === itemIndex) return false; |
| 12019 |
var clone = JSON.parse(JSON.stringify(data)); |
| 12020 |
clone.items.splice(itemIndex, 1); |
| 12021 |
setData(clone); |
| 12022 |
return true; |
| 12023 |
} |
| 12024 |
}; |
| 12025 |
}; |
| 12026 |
|
| 12027 |
//#endregion |
| 12028 |
//#region modules/ai/assets/js/editor/components/prompt-history/parts/modal-header.js |
| 12029 |
var StyledContent$2 = (0, _elementor_ui.styled)(_elementor_ui.Box)(function(_ref) { |
| 12030 |
var theme = _ref.theme; |
| 12031 |
return { |
| 12032 |
marginTop: 0, |
| 12033 |
padding: theme.spacing(1.5), |
| 12034 |
borderBottom: "1px solid ".concat(theme.palette.action.focus), |
| 12035 |
display: "flex", |
| 12036 |
alignItems: "center", |
| 12037 |
justifyContent: "space-between" |
| 12038 |
}; |
| 12039 |
}); |
| 12040 |
var PromptHistoryModalHeader = function PromptHistoryModalHeader(_ref2) { |
| 12041 |
var onClose = _ref2.onClose; |
| 12042 |
return /*#__PURE__*/ react.default.createElement(StyledContent$2, null, /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, { |
| 12043 |
fontWeight: "bolder", |
| 12044 |
variant: "h6", |
| 12045 |
sx: { userSelect: "none" } |
| 12046 |
}, (0, _wordpress_i18n.__)("History", "elementor")), /*#__PURE__*/ react.default.createElement(_elementor_ui.IconButton, { |
| 12047 |
size: "small", |
| 12048 |
"aria-label": (0, _wordpress_i18n.__)("Hide prompt history", "elementor"), |
| 12049 |
onClick: onClose |
| 12050 |
}, /*#__PURE__*/ react.default.createElement(_elementor_icons.XIcon, { fontSize: "small" }))); |
| 12051 |
}; |
| 12052 |
PromptHistoryModalHeader.propTypes = { onClose: import_prop_types$8.default.func.isRequired }; |
| 12053 |
|
| 12054 |
//#endregion |
| 12055 |
//#region modules/ai/assets/js/editor/hooks/use-delete-prompt-history-item.js |
| 12056 |
init_asyncToGenerator(); |
| 12057 |
init_slicedToArray(); |
| 12058 |
init_api(); |
| 12059 |
var useDeletePromptHistoryItem = function useDeletePromptHistoryItem() { |
| 12060 |
var _useState2 = _slicedToArray((0, react.useState)(false), 2); |
| 12061 |
var isLoading = _useState2[0]; |
| 12062 |
var setIsLoading = _useState2[1]; |
| 12063 |
var _useState4 = _slicedToArray((0, react.useState)(""), 2); |
| 12064 |
var error = _useState4[0]; |
| 12065 |
var setError = _useState4[1]; |
| 12066 |
return { |
| 12067 |
isLoading, |
| 12068 |
error, |
| 12069 |
deleteItem: /* @__PURE__ */ function() { |
| 12070 |
var _ref = _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee(id) { |
| 12071 |
return import_regenerator$2.default.wrap(function(_context) { |
| 12072 |
while (1) switch (_context.prev = _context.next) { |
| 12073 |
case 0: return _context.abrupt("return", new Promise(function(resolve, reject) { |
| 12074 |
setError(""); |
| 12075 |
setIsLoading(true); |
| 12076 |
deleteHistoryItem(id).then(function() { |
| 12077 |
resolve(true); |
| 12078 |
}).catch(function(err) { |
| 12079 |
var finalError = (err === null || err === void 0 ? void 0 : err.responseText) || err; |
| 12080 |
setError(finalError); |
| 12081 |
reject(finalError); |
| 12082 |
}).finally(function() { |
| 12083 |
return setIsLoading(false); |
| 12084 |
}); |
| 12085 |
})); |
| 12086 |
case 1: |
| 12087 |
case "end": return _context.stop(); |
| 12088 |
} |
| 12089 |
}, _callee); |
| 12090 |
})); |
| 12091 |
return function deleteItem(_x) { |
| 12092 |
return _ref.apply(this, arguments); |
| 12093 |
}; |
| 12094 |
}() |
| 12095 |
}; |
| 12096 |
}; |
| 12097 |
|
| 12098 |
//#endregion |
| 12099 |
//#region modules/ai/assets/js/editor/helpers/date-helpers.js |
| 12100 |
/** |
| 12101 |
* Formats a date (like wp_date() in PHP), translating it into site's locale. |
| 12102 |
* |
| 12103 |
* @param {string} format PHP-style formatting string. |
| 12104 |
* @param {Date | string | undefined} date Date object |
| 12105 |
* @param {string | number | undefined=} timezone Timezone to output result in or a UTC offset. Defaults to timezone from site. |
| 12106 |
* @return {string} |
| 12107 |
*/ |
| 12108 |
var translateDate = function translateDate(format, date, timezone) { |
| 12109 |
var _window$wp; |
| 12110 |
if ((_window$wp = window.wp) !== null && _window$wp !== void 0 && _window$wp.date) { |
| 12111 |
var _window$wp2; |
| 12112 |
var dateI18n = ((_window$wp2 = window.wp) === null || _window$wp2 === void 0 ? void 0 : _window$wp2.date).dateI18n; |
| 12113 |
return dateI18n(format, date, timezone); |
| 12114 |
} |
| 12115 |
return date; |
| 12116 |
}; |
| 12117 |
/** |
| 12118 |
* Returns difference in days between two dates |
| 12119 |
* |
| 12120 |
* @param {Date} firstDate |
| 12121 |
* @param {Date} secondDate |
| 12122 |
* @return {number} Positive or negative number in days |
| 12123 |
*/ |
| 12124 |
var daysDiff = function daysDiff(firstDate, secondDate) { |
| 12125 |
var MS_PER_DAY = 1e3 * 60 * 60 * 24; |
| 12126 |
var firstUTC = Date.UTC(firstDate.getFullYear(), firstDate.getMonth(), firstDate.getDate()); |
| 12127 |
var secondUTC = Date.UTC(secondDate.getFullYear(), secondDate.getMonth(), secondDate.getDate()); |
| 12128 |
return Math.floor((secondUTC - firstUTC) / MS_PER_DAY); |
| 12129 |
}; |
| 12130 |
|
| 12131 |
//#endregion |
| 12132 |
//#region modules/ai/assets/js/editor/icons/restore-icon.js |
| 12133 |
init_extends(); |
| 12134 |
var RestoreIcon = react.default.forwardRef(function(props, ref) { |
| 12135 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.SvgIcon, _extends$1({ viewBox: "0 0 24 24" }, props, { ref }), /*#__PURE__*/ react.default.createElement("path", { |
| 12136 |
fillRule: "evenodd", |
| 12137 |
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", |
| 12138 |
clipRule: "evenodd" |
| 12139 |
})); |
| 12140 |
}); |
| 12141 |
|
| 12142 |
//#endregion |
| 12143 |
//#region modules/ai/assets/js/editor/components/tooltip.js |
| 12144 |
init_extends(); |
| 12145 |
init_objectWithoutProperties$1(); |
| 12146 |
var _excluded$12 = ["children"]; |
| 12147 |
var Tooltip$3 = function Tooltip(_ref) { |
| 12148 |
var children = _ref.children; |
| 12149 |
var props = _objectWithoutProperties$1(_ref, _excluded$12); |
| 12150 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Tooltip, _extends$1({ componentsProps: { tooltip: { sx: { |
| 12151 |
"&.MuiTooltip-tooltip[class*=\"MuiTooltip-tooltipPlacement\"]": { |
| 12152 |
m: 0, |
| 12153 |
fontSize: "10px", |
| 12154 |
fontWeight: 500, |
| 12155 |
lineHeight: "1.4em" |
| 12156 |
}, |
| 12157 |
py: .5, |
| 12158 |
px: 1 |
| 12159 |
} } } }, props), children); |
| 12160 |
}; |
| 12161 |
Tooltip$3.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]) }; |
| 12162 |
|
| 12163 |
//#endregion |
| 12164 |
//#region modules/ai/assets/js/editor/components/prompt-history/parts/modal-item-action-button.js |
| 12165 |
init_extends(); |
| 12166 |
init_objectWithoutProperties$1(); |
| 12167 |
var _excluded$11 = ["tooltipTitle"]; |
| 12168 |
var ActionButton = function ActionButton(_ref) { |
| 12169 |
var tooltipTitle = _ref.tooltipTitle; |
| 12170 |
var props = _objectWithoutProperties$1(_ref, _excluded$11); |
| 12171 |
return /*#__PURE__*/ react.default.createElement(Tooltip$3, { |
| 12172 |
title: tooltipTitle, |
| 12173 |
placement: "top" |
| 12174 |
}, /*#__PURE__*/ react.default.createElement(_elementor_ui.IconButton, _extends$1({ |
| 12175 |
type: "button", |
| 12176 |
size: "small", |
| 12177 |
disableRipple: true, |
| 12178 |
disableFocusRipple: true, |
| 12179 |
disableTouchRipple: true |
| 12180 |
}, props))); |
| 12181 |
}; |
| 12182 |
ActionButton.propTypes = { tooltipTitle: import_prop_types$8.default.string.isRequired }; |
| 12183 |
|
| 12184 |
//#endregion |
| 12185 |
//#region modules/ai/assets/js/editor/icons/text-icon.js |
| 12186 |
init_extends(); |
| 12187 |
var TextIcon = react.default.forwardRef(function(props, ref) { |
| 12188 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.SvgIcon, _extends$1({ viewBox: "0 0 24 24" }, props, { ref }), /*#__PURE__*/ react.default.createElement("path", { |
| 12189 |
fillRule: "evenodd", |
| 12190 |
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", |
| 12191 |
clipRule: "evenodd" |
| 12192 |
}), /*#__PURE__*/ react.default.createElement("path", { |
| 12193 |
fillRule: "evenodd", |
| 12194 |
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", |
| 12195 |
clipRule: "evenodd" |
| 12196 |
}), /*#__PURE__*/ react.default.createElement("path", { |
| 12197 |
fillRule: "evenodd", |
| 12198 |
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", |
| 12199 |
clipRule: "evenodd" |
| 12200 |
})); |
| 12201 |
}); |
| 12202 |
|
| 12203 |
//#endregion |
| 12204 |
//#region modules/ai/assets/js/editor/icons/code-icon.js |
| 12205 |
init_extends(); |
| 12206 |
var CodeIcon = react.default.forwardRef(function(props, ref) { |
| 12207 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.SvgIcon, _extends$1({ viewBox: "0 0 24 24" }, props, { ref }), /*#__PURE__*/ react.default.createElement("path", { |
| 12208 |
fillRule: "evenodd", |
| 12209 |
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", |
| 12210 |
clipRule: "evenodd" |
| 12211 |
})); |
| 12212 |
}); |
| 12213 |
|
| 12214 |
//#endregion |
| 12215 |
//#region modules/ai/assets/js/editor/components/prompt-history/parts/action-icon.js |
| 12216 |
var FALLBACK_ICON = /*#__PURE__*/ react.default.createElement(_elementor_icons.AIIcon, { "data-testid": "e-ph-fi" }); |
| 12217 |
var ICONS_BY_ACTIONS = Object.freeze({ |
| 12218 |
"enhance-image-prompt": /*#__PURE__*/ react.default.createElement(TextIcon, null), |
| 12219 |
"get-text": /*#__PURE__*/ react.default.createElement(TextIcon, null), |
| 12220 |
"edit-text": /*#__PURE__*/ react.default.createElement(TextIcon, null), |
| 12221 |
"custom-css": /*#__PURE__*/ react.default.createElement(CodeIcon, null), |
| 12222 |
"custom-code": /*#__PURE__*/ react.default.createElement(CodeIcon, null) |
| 12223 |
}); |
| 12224 |
var PromptHistoryActionIcon = function PromptHistoryActionIcon(_ref) { |
| 12225 |
var action = _ref.action; |
| 12226 |
if (ICONS_BY_ACTIONS[action]) return ICONS_BY_ACTIONS[action]; |
| 12227 |
return FALLBACK_ICON; |
| 12228 |
}; |
| 12229 |
PromptHistoryActionIcon.propTypes = { action: import_prop_types$8.default.string.isRequired }; |
| 12230 |
|
| 12231 |
//#endregion |
| 12232 |
//#region modules/ai/assets/js/editor/components/prompt-history/parts/modal-item-title.js |
| 12233 |
var _templateObject$4; |
| 12234 |
var StyledTitle = (0, _elementor_ui.styled)(_elementor_ui.Typography)(_templateObject$4 || (_templateObject$4 = _taggedTemplateLiteral(["\n margin-bottom: ", ";\n"])), function(_ref) { |
| 12235 |
return _ref.theme.spacing(.5); |
| 12236 |
}); |
| 12237 |
var PromptHistoryItemTitle = function PromptHistoryItemTitle(_ref2) { |
| 12238 |
var prompt = _ref2.prompt; |
| 12239 |
return /*#__PURE__*/ react.default.createElement(Tooltip$3, { |
| 12240 |
title: prompt, |
| 12241 |
arrow: false, |
| 12242 |
placement: "bottom-start" |
| 12243 |
}, /*#__PURE__*/ react.default.createElement(StyledTitle, { |
| 12244 |
variant: "body2", |
| 12245 |
noWrap: true, |
| 12246 |
paragraph: true |
| 12247 |
}, prompt)); |
| 12248 |
}; |
| 12249 |
PromptHistoryItemTitle.propTypes = { prompt: import_prop_types$8.default.string.isRequired }; |
| 12250 |
|
| 12251 |
//#endregion |
| 12252 |
//#region modules/ai/assets/js/editor/components/prompt-history/parts/modal-item-secondary-content.js |
| 12253 |
var _templateObject$3; |
| 12254 |
var _templateObject2$1; |
| 12255 |
var StyledDateSubtitle = (0, _elementor_ui.styled)(_elementor_ui.Typography)(_templateObject$3 || (_templateObject$3 = _taggedTemplateLiteral(["\n color: ", ";\n"])), function(_ref) { |
| 12256 |
return _ref.theme.palette.secondary.light; |
| 12257 |
}); |
| 12258 |
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) { |
| 12259 |
return _ref2.theme.spacing(.5); |
| 12260 |
}); |
| 12261 |
var PromptHistoryItemSecondaryContent = function PromptHistoryItemSecondaryContent(_ref3) { |
| 12262 |
var date = _ref3.date; |
| 12263 |
var thumbnails = _ref3.thumbnails; |
| 12264 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, { |
| 12265 |
direction: "column", |
| 12266 |
width: "90%" |
| 12267 |
}, /*#__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, { |
| 12268 |
flexDirection: "row", |
| 12269 |
mt: 1 |
| 12270 |
}, thumbnails.map( |
| 12271 |
/** |
| 12272 |
* @param {Object} thumb |
| 12273 |
* @return {React.ReactNode} |
| 12274 |
*/ |
| 12275 |
function(thumb) { |
| 12276 |
return /*#__PURE__*/ react.default.createElement(StyledImage, { |
| 12277 |
key: "thumbnail-".concat(thumb.seed), |
| 12278 |
alt: "", |
| 12279 |
src: thumb.image_url |
| 12280 |
}); |
| 12281 |
} |
| 12282 |
))); |
| 12283 |
}; |
| 12284 |
PromptHistoryItemSecondaryContent.propTypes = { |
| 12285 |
date: import_prop_types$8.default.string.isRequired, |
| 12286 |
thumbnails: import_prop_types$8.default.array |
| 12287 |
}; |
| 12288 |
|
| 12289 |
//#endregion |
| 12290 |
//#region modules/ai/assets/js/editor/components/prompt-history/parts/modal-item.js |
| 12291 |
init_objectWithoutProperties$1(); |
| 12292 |
init_prompt_history_action_context(); |
| 12293 |
var _excluded$10 = [ |
| 12294 |
"id", |
| 12295 |
"date", |
| 12296 |
"onHistoryItemDelete" |
| 12297 |
]; |
| 12298 |
var _templateObject$2; |
| 12299 |
var _templateObject2; |
| 12300 |
var _templateObject3; |
| 12301 |
var _templateObject4; |
| 12302 |
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) { |
| 12303 |
var actionsCount = _ref.actionsCount; |
| 12304 |
return "calc(100% - ".concat(actionsCount, " * 26px)"); |
| 12305 |
}); |
| 12306 |
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) { |
| 12307 |
return _ref2.theme.spacing(.5, 2); |
| 12308 |
}); |
| 12309 |
var StyledListItemIcon = (0, _elementor_ui.styled)(_elementor_ui.ListItemIcon)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral([ |
| 12310 |
"\n min-width: auto;\n\n & > .MuiSvgIcon-root {\n margin-right: ", |
| 12311 |
";\n font-size: 1rem;\n position: relative;\n top: ", |
| 12312 |
";\n }\n" |
| 12313 |
])), function(_ref3) { |
| 12314 |
return _ref3.theme.spacing(1.5); |
| 12315 |
}, function(_ref4) { |
| 12316 |
return _ref4.theme.spacing(.5); |
| 12317 |
}); |
| 12318 |
var StyledButtonsWrapper = (0, _elementor_ui.styled)(_elementor_ui.Box)(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n & .MuiSvgIcon-root {\n font-size: 1rem;\n }\n"]))); |
| 12319 |
var PromptHistoryItem = function PromptHistoryItem(_ref5) { |
| 12320 |
var id = _ref5.id; |
| 12321 |
var date = _ref5.date; |
| 12322 |
var onHistoryItemDelete = _ref5.onHistoryItemDelete; |
| 12323 |
var props = _objectWithoutProperties$1(_ref5, _excluded$10); |
| 12324 |
var _usePromptHistoryActi = usePromptHistoryAction(); |
| 12325 |
var getAllowedActions = _usePromptHistoryActi.getAllowedActions; |
| 12326 |
var onPromptReuse = _usePromptHistoryActi.onPromptReuse; |
| 12327 |
var onResultEdit = _usePromptHistoryActi.onResultEdit; |
| 12328 |
var onImagesRestore = _usePromptHistoryActi.onImagesRestore; |
| 12329 |
var action = props.action; |
| 12330 |
var prompt = props.prompt; |
| 12331 |
var text = props.text; |
| 12332 |
var images = props.images; |
| 12333 |
var thumbnails = props.thumbnails; |
| 12334 |
var imageType = props.imageType; |
| 12335 |
var ratio = props.ratio; |
| 12336 |
var allowedActions = getAllowedActions(); |
| 12337 |
return /*#__PURE__*/ react.default.createElement(StyledListItem, { |
| 12338 |
tabIndex: "0", |
| 12339 |
"data-testid": "e-ph-i", |
| 12340 |
disableGutters: true, |
| 12341 |
disablePadding: true, |
| 12342 |
actionsCount: Object.keys(allowedActions).length |
| 12343 |
}, /*#__PURE__*/ react.default.createElement(StyledListItemButton, { |
| 12344 |
component: "div", |
| 12345 |
role: void 0 |
| 12346 |
}, /*#__PURE__*/ react.default.createElement(StyledListItemIcon, null, /*#__PURE__*/ react.default.createElement(PromptHistoryActionIcon, { action })), /*#__PURE__*/ react.default.createElement(_elementor_ui.ListItemText, { |
| 12347 |
disableTypography: true, |
| 12348 |
primary: /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, { |
| 12349 |
direction: "row", |
| 12350 |
justifyContent: "space-between", |
| 12351 |
alignItems: "center", |
| 12352 |
height: "16px" |
| 12353 |
}, /*#__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, { |
| 12354 |
onClick: function onClick() { |
| 12355 |
return onHistoryItemDelete(id); |
| 12356 |
}, |
| 12357 |
"aria-label": (0, _wordpress_i18n.__)("Remove item", "elementor"), |
| 12358 |
tooltipTitle: (0, _wordpress_i18n.__)("Remove", "elementor") |
| 12359 |
}, /*#__PURE__*/ react.default.createElement(_elementor_icons.TrashIcon, null)), allowedActions[ACTION_TYPES.REUSE] && /*#__PURE__*/ react.default.createElement(ActionButton, { |
| 12360 |
onClick: function onClick() { |
| 12361 |
return onPromptReuse(id, prompt); |
| 12362 |
}, |
| 12363 |
"aria-label": (0, _wordpress_i18n.__)("Reuse prompt", "elementor"), |
| 12364 |
tooltipTitle: (0, _wordpress_i18n.__)("Reuse prompt", "elementor") |
| 12365 |
}, /*#__PURE__*/ react.default.createElement(RefreshIcon, null)), allowedActions[ACTION_TYPES.RESTORE] && /*#__PURE__*/ react.default.createElement(ActionButton, { |
| 12366 |
onClick: function onClick() { |
| 12367 |
return onImagesRestore(id, { |
| 12368 |
prompt, |
| 12369 |
images, |
| 12370 |
imageType, |
| 12371 |
ratio |
| 12372 |
}); |
| 12373 |
}, |
| 12374 |
"aria-label": (0, _wordpress_i18n.__)("Restore", "elementor"), |
| 12375 |
tooltipTitle: (0, _wordpress_i18n.__)("Restore", "elementor") |
| 12376 |
}, /*#__PURE__*/ react.default.createElement(RestoreIcon, null)), allowedActions[ACTION_TYPES.EDIT] && /*#__PURE__*/ react.default.createElement(ActionButton, { |
| 12377 |
onClick: function onClick() { |
| 12378 |
return onResultEdit(id, text); |
| 12379 |
}, |
| 12380 |
"aria-label": (0, _wordpress_i18n.__)("Edit result", "elementor"), |
| 12381 |
tooltipTitle: (0, _wordpress_i18n.__)("Edit", "elementor") |
| 12382 |
}, /*#__PURE__*/ react.default.createElement(EditIcon$1, null)))), |
| 12383 |
secondary: /*#__PURE__*/ react.default.createElement(PromptHistoryItemSecondaryContent, { |
| 12384 |
date, |
| 12385 |
thumbnails |
| 12386 |
}) |
| 12387 |
}))); |
| 12388 |
}; |
| 12389 |
PromptHistoryItem.propTypes = { |
| 12390 |
id: import_prop_types$8.default.string.isRequired, |
| 12391 |
action: import_prop_types$8.default.string.isRequired, |
| 12392 |
prompt: import_prop_types$8.default.string.isRequired, |
| 12393 |
date: import_prop_types$8.default.string.isRequired, |
| 12394 |
onHistoryItemDelete: import_prop_types$8.default.func.isRequired, |
| 12395 |
text: import_prop_types$8.default.string, |
| 12396 |
images: import_prop_types$8.default.array, |
| 12397 |
thumbnails: import_prop_types$8.default.array, |
| 12398 |
imageType: import_prop_types$8.default.string, |
| 12399 |
ratio: import_prop_types$8.default.string |
| 12400 |
}; |
| 12401 |
|
| 12402 |
//#endregion |
| 12403 |
//#region modules/ai/assets/js/editor/components/prompt-history/parts/modal-period.js |
| 12404 |
init_extends(); |
| 12405 |
init_objectWithoutProperties$1(); |
| 12406 |
var _excluded$9 = ["id", "date"]; |
| 12407 |
var StyledPeriodList = (0, _elementor_ui.styled)(_elementor_ui.List)(function(_ref) { |
| 12408 |
var theme = _ref.theme; |
| 12409 |
return { borderBottom: "1px solid ".concat(theme.palette.action.focus) }; |
| 12410 |
}); |
| 12411 |
var StyledPeriodTitle = (0, _elementor_ui.styled)(_elementor_ui.Typography)(function(_ref2) { |
| 12412 |
var theme = _ref2.theme; |
| 12413 |
return { |
| 12414 |
padding: theme.spacing(1.5, 2), |
| 12415 |
color: theme.palette.secondary.light |
| 12416 |
}; |
| 12417 |
}); |
| 12418 |
var DATE_FORMAT = (0, _wordpress_i18n.__)("F j, g:i A", "elementor"); |
| 12419 |
var PromptHistoryPeriod = function PromptHistoryPeriod(_ref3) { |
| 12420 |
var periodTitle = _ref3.periodTitle; |
| 12421 |
var historyItems = _ref3.historyItems; |
| 12422 |
var _onHistoryItemDelete = _ref3.onHistoryItemDelete; |
| 12423 |
return /*#__PURE__*/ react.default.createElement(StyledPeriodList, { |
| 12424 |
"data-testid": "e-ph-p", |
| 12425 |
subheader: /*#__PURE__*/ react.default.createElement(_elementor_ui.ListSubheader, { |
| 12426 |
disableSticky: true, |
| 12427 |
disableGutters: true |
| 12428 |
}, /*#__PURE__*/ react.default.createElement(StyledPeriodTitle, { |
| 12429 |
variant: "body2", |
| 12430 |
role: "heading", |
| 12431 |
"aria-level": "6" |
| 12432 |
}, periodTitle)) |
| 12433 |
}, historyItems.map(function(_ref4) { |
| 12434 |
var id = _ref4.id; |
| 12435 |
var date = _ref4.date; |
| 12436 |
var props = _objectWithoutProperties$1(_ref4, _excluded$9); |
| 12437 |
return /*#__PURE__*/ react.default.createElement(PromptHistoryItem, _extends$1({ |
| 12438 |
key: id, |
| 12439 |
date: translateDate(DATE_FORMAT, date), |
| 12440 |
onHistoryItemDelete: function onHistoryItemDelete() { |
| 12441 |
return _onHistoryItemDelete(id); |
| 12442 |
}, |
| 12443 |
id |
| 12444 |
}, props)); |
| 12445 |
})); |
| 12446 |
}; |
| 12447 |
PromptHistoryPeriod.propTypes = { |
| 12448 |
periodTitle: import_prop_types$8.default.string.isRequired, |
| 12449 |
historyItems: import_prop_types$8.default.array.isRequired, |
| 12450 |
onHistoryItemDelete: import_prop_types$8.default.func.isRequired |
| 12451 |
}; |
| 12452 |
|
| 12453 |
//#endregion |
| 12454 |
//#region modules/ai/assets/js/editor/components/prompt-history/helpers/history-period-helpers.js |
| 12455 |
init_defineProperty$1(); |
| 12456 |
function _createForOfIteratorHelper(r, e) { |
| 12457 |
var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; |
| 12458 |
if (!t) { |
| 12459 |
if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { |
| 12460 |
t && (r = t); |
| 12461 |
var _n = 0; |
| 12462 |
var F = function F() {}; |
| 12463 |
return { |
| 12464 |
s: F, |
| 12465 |
n: function n() { |
| 12466 |
return _n >= r.length ? { done: !0 } : { |
| 12467 |
done: !1, |
| 12468 |
value: r[_n++] |
| 12469 |
}; |
| 12470 |
}, |
| 12471 |
e: function e(r) { |
| 12472 |
throw r; |
| 12473 |
}, |
| 12474 |
f: F |
| 12475 |
}; |
| 12476 |
} |
| 12477 |
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); |
| 12478 |
} |
| 12479 |
var o; |
| 12480 |
var a = !0; |
| 12481 |
var u = !1; |
| 12482 |
return { |
| 12483 |
s: function s() { |
| 12484 |
t = t.call(r); |
| 12485 |
}, |
| 12486 |
n: function n() { |
| 12487 |
var r = t.next(); |
| 12488 |
return a = r.done, r; |
| 12489 |
}, |
| 12490 |
e: function e(r) { |
| 12491 |
u = !0, o = r; |
| 12492 |
}, |
| 12493 |
f: function f() { |
| 12494 |
try { |
| 12495 |
a || null == t.return || t.return(); |
| 12496 |
} finally { |
| 12497 |
if (u) throw o; |
| 12498 |
} |
| 12499 |
} |
| 12500 |
}; |
| 12501 |
} |
| 12502 |
function _unsupportedIterableToArray(r, a) { |
| 12503 |
if (r) { |
| 12504 |
if ("string" == typeof r) return _arrayLikeToArray(r, a); |
| 12505 |
var t = {}.toString.call(r).slice(8, -1); |
| 12506 |
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; |
| 12507 |
} |
| 12508 |
} |
| 12509 |
function _arrayLikeToArray(r, a) { |
| 12510 |
(null == a || a > r.length) && (a = r.length); |
| 12511 |
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; |
| 12512 |
return n; |
| 12513 |
} |
| 12514 |
var DATE_KEY = "date"; |
| 12515 |
var LAST_7_DAYS_KEY = "7-days"; |
| 12516 |
var LAST_30_DAYS_KEY = "30-days"; |
| 12517 |
var MONTH_FORMAT = (0, _wordpress_i18n.__)("F", "elementor"); |
| 12518 |
/** |
| 12519 |
* Sorts items in ascending order by date. |
| 12520 |
* |
| 12521 |
* @param {Array} historyData |
| 12522 |
* @return {Array} |
| 12523 |
*/ |
| 12524 |
var sortPromptHistoryData = function sortPromptHistoryData(historyData) { |
| 12525 |
return _toConsumableArray(historyData).sort(function(a, b) { |
| 12526 |
return new Date(b[DATE_KEY]) - new Date(a[DATE_KEY]); |
| 12527 |
}); |
| 12528 |
}; |
| 12529 |
/** |
| 12530 |
* Groups prompt history data by time periods. |
| 12531 |
* |
| 12532 |
* @param {Array} historyData |
| 12533 |
* @return {Object.<string, {label: string, items: any[]}>} |
| 12534 |
*/ |
| 12535 |
var groupPromptHistoryData = function groupPromptHistoryData(historyData) { |
| 12536 |
var data = sortPromptHistoryData(historyData); |
| 12537 |
var currentDate = /* @__PURE__ */ new Date(); |
| 12538 |
var result = _defineProperty$1(_defineProperty$1({}, LAST_7_DAYS_KEY, { |
| 12539 |
label: (0, _wordpress_i18n.__)("Last 7 days", "elementor"), |
| 12540 |
items: [] |
| 12541 |
}), LAST_30_DAYS_KEY, { |
| 12542 |
label: (0, _wordpress_i18n.__)("Last 30 days", "elementor"), |
| 12543 |
items: [] |
| 12544 |
}); |
| 12545 |
var _iterator = _createForOfIteratorHelper(data); |
| 12546 |
var _step; |
| 12547 |
try { |
| 12548 |
for (_iterator.s(); !(_step = _iterator.n()).done;) { |
| 12549 |
var item = _step.value; |
| 12550 |
var date = new Date(item[DATE_KEY]); |
| 12551 |
var diff = daysDiff(date, currentDate); |
| 12552 |
if (diff <= 7) { |
| 12553 |
result[LAST_7_DAYS_KEY].items.push(item); |
| 12554 |
continue; |
| 12555 |
} |
| 12556 |
if (diff <= 30) { |
| 12557 |
result[LAST_30_DAYS_KEY].items.push(item); |
| 12558 |
continue; |
| 12559 |
} |
| 12560 |
var month = date.getMonth(); |
| 12561 |
if (!result[month]) result[month] = { |
| 12562 |
label: translateDate(MONTH_FORMAT, date), |
| 12563 |
items: [] |
| 12564 |
}; |
| 12565 |
result[month].items.push(item); |
| 12566 |
} |
| 12567 |
} catch (err) { |
| 12568 |
_iterator.e(err); |
| 12569 |
} finally { |
| 12570 |
_iterator.f(); |
| 12571 |
} |
| 12572 |
return result; |
| 12573 |
}; |
| 12574 |
var renderPeriods = function renderPeriods(_ref) { |
| 12575 |
var _groupData$LAST_7_DAY; |
| 12576 |
var _groupData$LAST_30_DA; |
| 12577 |
var items = _ref.items; |
| 12578 |
var onDelete = _ref.onDelete; |
| 12579 |
var groupData = groupPromptHistoryData(items); |
| 12580 |
var periods = []; |
| 12581 |
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, { |
| 12582 |
periodTitle: groupData[LAST_7_DAYS_KEY].label, |
| 12583 |
onHistoryItemDelete: onDelete, |
| 12584 |
historyItems: groupData[LAST_7_DAYS_KEY].items |
| 12585 |
})); |
| 12586 |
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, { |
| 12587 |
periodTitle: groupData[LAST_30_DAYS_KEY].label, |
| 12588 |
onHistoryItemDelete: onDelete, |
| 12589 |
historyItems: groupData[LAST_30_DAYS_KEY].items |
| 12590 |
})); |
| 12591 |
for (var i = 12; i >= 0; i--) if (groupData[i]) periods.push(/*#__PURE__*/ react.default.createElement(PromptHistoryPeriod, { |
| 12592 |
periodTitle: groupData[i].label, |
| 12593 |
onHistoryItemDelete: onDelete, |
| 12594 |
historyItems: groupData[i].items |
| 12595 |
})); |
| 12596 |
return periods; |
| 12597 |
}; |
| 12598 |
|
| 12599 |
//#endregion |
| 12600 |
//#region modules/ai/assets/js/editor/components/prompt-history/parts/modal-empty.js |
| 12601 |
init_history_types(); |
| 12602 |
var PromptHistoryEmpty = function PromptHistoryEmpty(_ref) { |
| 12603 |
var historyType = _ref.historyType; |
| 12604 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, { |
| 12605 |
justifyContent: "center", |
| 12606 |
sx: { |
| 12607 |
height: "100%", |
| 12608 |
textAlign: "center" |
| 12609 |
}, |
| 12610 |
"data-testid": "e-ph-empty" |
| 12611 |
}, /*#__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)))); |
| 12612 |
}; |
| 12613 |
PromptHistoryEmpty.propTypes = { historyType: import_prop_types$8.default.oneOf(Object.values(HISTORY_TYPES)).isRequired }; |
| 12614 |
|
| 12615 |
//#endregion |
| 12616 |
//#region node_modules/react-infinite-scroller/src/InfiniteScroll.js |
| 12617 |
init_objectWithoutProperties(); |
| 12618 |
init_defineProperty(); |
| 12619 |
var _excluded$8 = [ |
| 12620 |
"children", |
| 12621 |
"element", |
| 12622 |
"hasMore", |
| 12623 |
"initialLoad", |
| 12624 |
"isReverse", |
| 12625 |
"loader", |
| 12626 |
"loadMore", |
| 12627 |
"pageStart", |
| 12628 |
"ref", |
| 12629 |
"threshold", |
| 12630 |
"useCapture", |
| 12631 |
"useWindow", |
| 12632 |
"getScrollParent" |
| 12633 |
]; |
| 12634 |
var InfiniteScroll = class extends react.Component { |
| 12635 |
constructor(props) { |
| 12636 |
super(props); |
| 12637 |
this.scrollListener = this.scrollListener.bind(this); |
| 12638 |
this.eventListenerOptions = this.eventListenerOptions.bind(this); |
| 12639 |
this.mousewheelListener = this.mousewheelListener.bind(this); |
| 12640 |
} |
| 12641 |
componentDidMount() { |
| 12642 |
this.pageLoaded = this.props.pageStart; |
| 12643 |
this.options = this.eventListenerOptions(); |
| 12644 |
this.attachScrollListener(); |
| 12645 |
} |
| 12646 |
componentDidUpdate() { |
| 12647 |
if (this.props.isReverse && this.loadMore) { |
| 12648 |
const parentElement = this.getParentElement(this.scrollComponent); |
| 12649 |
parentElement.scrollTop = parentElement.scrollHeight - this.beforeScrollHeight + this.beforeScrollTop; |
| 12650 |
this.loadMore = false; |
| 12651 |
} |
| 12652 |
this.attachScrollListener(); |
| 12653 |
} |
| 12654 |
componentWillUnmount() { |
| 12655 |
this.detachScrollListener(); |
| 12656 |
this.detachMousewheelListener(); |
| 12657 |
} |
| 12658 |
isPassiveSupported() { |
| 12659 |
let passive = false; |
| 12660 |
const testOptions = { get passive() { |
| 12661 |
passive = true; |
| 12662 |
} }; |
| 12663 |
try { |
| 12664 |
document.addEventListener("test", null, testOptions); |
| 12665 |
document.removeEventListener("test", null, testOptions); |
| 12666 |
} catch (e) {} |
| 12667 |
return passive; |
| 12668 |
} |
| 12669 |
eventListenerOptions() { |
| 12670 |
let options = this.props.useCapture; |
| 12671 |
if (this.isPassiveSupported()) options = { |
| 12672 |
useCapture: this.props.useCapture, |
| 12673 |
passive: true |
| 12674 |
}; |
| 12675 |
else options = { passive: false }; |
| 12676 |
return options; |
| 12677 |
} |
| 12678 |
setDefaultLoader(loader) { |
| 12679 |
this.defaultLoader = loader; |
| 12680 |
} |
| 12681 |
detachMousewheelListener() { |
| 12682 |
let scrollEl = window; |
| 12683 |
if (this.props.useWindow === false) scrollEl = this.scrollComponent.parentNode; |
| 12684 |
scrollEl.removeEventListener("mousewheel", this.mousewheelListener, this.options ? this.options : this.props.useCapture); |
| 12685 |
} |
| 12686 |
detachScrollListener() { |
| 12687 |
let scrollEl = window; |
| 12688 |
if (this.props.useWindow === false) scrollEl = this.getParentElement(this.scrollComponent); |
| 12689 |
scrollEl.removeEventListener("scroll", this.scrollListener, this.options ? this.options : this.props.useCapture); |
| 12690 |
scrollEl.removeEventListener("resize", this.scrollListener, this.options ? this.options : this.props.useCapture); |
| 12691 |
} |
| 12692 |
getParentElement(el) { |
| 12693 |
const scrollParent = this.props.getScrollParent && this.props.getScrollParent(); |
| 12694 |
if (scrollParent != null) return scrollParent; |
| 12695 |
return el && el.parentNode; |
| 12696 |
} |
| 12697 |
filterProps(props) { |
| 12698 |
return props; |
| 12699 |
} |
| 12700 |
attachScrollListener() { |
| 12701 |
const parentElement = this.getParentElement(this.scrollComponent); |
| 12702 |
if (!this.props.hasMore || !parentElement) return; |
| 12703 |
let scrollEl = window; |
| 12704 |
if (this.props.useWindow === false) scrollEl = parentElement; |
| 12705 |
scrollEl.addEventListener("mousewheel", this.mousewheelListener, this.options ? this.options : this.props.useCapture); |
| 12706 |
scrollEl.addEventListener("scroll", this.scrollListener, this.options ? this.options : this.props.useCapture); |
| 12707 |
scrollEl.addEventListener("resize", this.scrollListener, this.options ? this.options : this.props.useCapture); |
| 12708 |
if (this.props.initialLoad) this.scrollListener(); |
| 12709 |
} |
| 12710 |
mousewheelListener(e) { |
| 12711 |
if (e.deltaY === 1 && !this.isPassiveSupported()) e.preventDefault(); |
| 12712 |
} |
| 12713 |
scrollListener() { |
| 12714 |
const el = this.scrollComponent; |
| 12715 |
const scrollEl = window; |
| 12716 |
const parentNode = this.getParentElement(el); |
| 12717 |
let offset; |
| 12718 |
if (this.props.useWindow) { |
| 12719 |
const doc = document.documentElement || document.body.parentNode || document.body; |
| 12720 |
const scrollTop = scrollEl.pageYOffset !== void 0 ? scrollEl.pageYOffset : doc.scrollTop; |
| 12721 |
if (this.props.isReverse) offset = scrollTop; |
| 12722 |
else offset = this.calculateOffset(el, scrollTop); |
| 12723 |
} else if (this.props.isReverse) offset = parentNode.scrollTop; |
| 12724 |
else offset = el.scrollHeight - parentNode.scrollTop - parentNode.clientHeight; |
| 12725 |
if (offset < Number(this.props.threshold) && el && el.offsetParent !== null) { |
| 12726 |
this.detachScrollListener(); |
| 12727 |
this.beforeScrollHeight = parentNode.scrollHeight; |
| 12728 |
this.beforeScrollTop = parentNode.scrollTop; |
| 12729 |
if (typeof this.props.loadMore === "function") { |
| 12730 |
this.props.loadMore(this.pageLoaded += 1); |
| 12731 |
this.loadMore = true; |
| 12732 |
} |
| 12733 |
} |
| 12734 |
} |
| 12735 |
calculateOffset(el, scrollTop) { |
| 12736 |
if (!el) return 0; |
| 12737 |
return this.calculateTopPosition(el) + (el.offsetHeight - scrollTop - window.innerHeight); |
| 12738 |
} |
| 12739 |
calculateTopPosition(el) { |
| 12740 |
if (!el) return 0; |
| 12741 |
return el.offsetTop + this.calculateTopPosition(el.offsetParent); |
| 12742 |
} |
| 12743 |
render() { |
| 12744 |
const renderProps = this.filterProps(this.props); |
| 12745 |
const { children, element, hasMore, initialLoad, isReverse, loader, loadMore, pageStart, ref, threshold, useCapture, useWindow, getScrollParent } = renderProps, props = _objectWithoutProperties(renderProps, _excluded$8); |
| 12746 |
props.ref = (node) => { |
| 12747 |
this.scrollComponent = node; |
| 12748 |
if (ref) ref(node); |
| 12749 |
}; |
| 12750 |
const childrenArray = [children]; |
| 12751 |
if (hasMore) { |
| 12752 |
if (loader) isReverse ? childrenArray.unshift(loader) : childrenArray.push(loader); |
| 12753 |
else if (this.defaultLoader) isReverse ? childrenArray.unshift(this.defaultLoader) : childrenArray.push(this.defaultLoader); |
| 12754 |
} |
| 12755 |
return react.default.createElement(element, props, childrenArray); |
| 12756 |
} |
| 12757 |
}; |
| 12758 |
_defineProperty(InfiniteScroll, "propTypes", { |
| 12759 |
children: import_prop_types$8.default.node.isRequired, |
| 12760 |
element: import_prop_types$8.default.node, |
| 12761 |
hasMore: import_prop_types$8.default.bool, |
| 12762 |
initialLoad: import_prop_types$8.default.bool, |
| 12763 |
isReverse: import_prop_types$8.default.bool, |
| 12764 |
loader: import_prop_types$8.default.node, |
| 12765 |
loadMore: import_prop_types$8.default.func.isRequired, |
| 12766 |
pageStart: import_prop_types$8.default.number, |
| 12767 |
ref: import_prop_types$8.default.func, |
| 12768 |
getScrollParent: import_prop_types$8.default.func, |
| 12769 |
threshold: import_prop_types$8.default.number, |
| 12770 |
useCapture: import_prop_types$8.default.bool, |
| 12771 |
useWindow: import_prop_types$8.default.bool |
| 12772 |
}); |
| 12773 |
_defineProperty(InfiniteScroll, "defaultProps", { |
| 12774 |
element: "div", |
| 12775 |
hasMore: false, |
| 12776 |
initialLoad: true, |
| 12777 |
pageStart: 0, |
| 12778 |
ref: null, |
| 12779 |
threshold: 250, |
| 12780 |
useWindow: true, |
| 12781 |
isReverse: false, |
| 12782 |
useCapture: false, |
| 12783 |
loader: null, |
| 12784 |
getScrollParent: null |
| 12785 |
}); |
| 12786 |
|
| 12787 |
//#endregion |
| 12788 |
//#region modules/ai/assets/js/editor/components/prompt-history/parts/modal-upgrade.js |
| 12789 |
init_defineProperty$1(); |
| 12790 |
init_history_types(); |
| 12791 |
var VARIANT_FULL = "full"; |
| 12792 |
var VARIANT_SMALL = "small"; |
| 12793 |
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")); |
| 12794 |
var actionUrl = "https://go.elementor.com/ai-popup-purchase-dropdown/"; |
| 12795 |
var getMessage = function getMessage(variant, historyType) { |
| 12796 |
return (0, _wordpress_i18n.sprintf)(messages[variant] || messages[VARIANT_FULL], getTranslatedPromptHistoryType(historyType)); |
| 12797 |
}; |
| 12798 |
var PromptHistoryUpgrade = function PromptHistoryUpgrade(_ref) { |
| 12799 |
var variant = _ref.variant; |
| 12800 |
var historyType = _ref.historyType; |
| 12801 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, { |
| 12802 |
justifyContent: "center", |
| 12803 |
sx: { |
| 12804 |
height: VARIANT_SMALL === variant ? "auto" : "100%", |
| 12805 |
textAlign: "center", |
| 12806 |
p: 2 |
| 12807 |
}, |
| 12808 |
"data-testid": "e-ph-upgrade-".concat(variant) |
| 12809 |
}, /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, { |
| 12810 |
variant: "body1", |
| 12811 |
sx: { marginBottom: 2 } |
| 12812 |
}, getMessage(variant, historyType)), /*#__PURE__*/ react.default.createElement(_elementor_ui.Button, { |
| 12813 |
variant: "contained", |
| 12814 |
color: "promotion", |
| 12815 |
size: "small", |
| 12816 |
href: actionUrl, |
| 12817 |
target: "_blank", |
| 12818 |
rel: "noopener noreferrer", |
| 12819 |
startIcon: /*#__PURE__*/ react.default.createElement(_elementor_icons.UpgradeIcon, null), |
| 12820 |
sx: { |
| 12821 |
width: "50%", |
| 12822 |
alignSelf: "center", |
| 12823 |
"&:hover": { color: "promotion.contrastText" } |
| 12824 |
} |
| 12825 |
}, (0, _wordpress_i18n.__)("Upgrade now", "elementor"))); |
| 12826 |
}; |
| 12827 |
PromptHistoryUpgrade.propTypes = { |
| 12828 |
variant: import_prop_types$8.default.oneOf([VARIANT_FULL, VARIANT_SMALL]).isRequired, |
| 12829 |
historyType: import_prop_types$8.default.oneOf(Object.values(HISTORY_TYPES)).isRequired |
| 12830 |
}; |
| 12831 |
|
| 12832 |
//#endregion |
| 12833 |
//#region modules/ai/assets/js/editor/components/prompt-history/parts/modal-container.js |
| 12834 |
init_extends(); |
| 12835 |
init_objectWithoutProperties$1(); |
| 12836 |
init_prompt_history_context(); |
| 12837 |
var _excluded$7 = ["children"]; |
| 12838 |
var _templateObject$1; |
| 12839 |
var StyledContent$1 = (0, _elementor_ui.styled)(_elementor_ui.Box)(_templateObject$1 || (_templateObject$1 = _taggedTemplateLiteral([ |
| 12840 |
"\n width: 360px;\n position: relative;\n margin-top: ", |
| 12841 |
";\n margin-right: ", |
| 12842 |
";\n background-color: ", |
| 12843 |
";\n border-radius: ", |
| 12844 |
";\n height: ", |
| 12845 |
";\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" |
| 12846 |
])), function(_ref) { |
| 12847 |
return _ref.theme.spacing(2); |
| 12848 |
}, function(_ref2) { |
| 12849 |
return _ref2.theme.spacing(2); |
| 12850 |
}, function(_ref3) { |
| 12851 |
return _ref3.theme.palette.background.paper; |
| 12852 |
}, function(_ref4) { |
| 12853 |
var theme = _ref4.theme; |
| 12854 |
return "".concat(theme.shape.borderRadius, "px"); |
| 12855 |
}, function(_ref5) { |
| 12856 |
var height = _ref5.height; |
| 12857 |
return "calc( ".concat(height, "px - 32px )"); |
| 12858 |
}); |
| 12859 |
var ModalContainer = function ModalContainer(_ref6) { |
| 12860 |
var children = _ref6.children; |
| 12861 |
var props = _objectWithoutProperties$1(_ref6, _excluded$7); |
| 12862 |
var _usePromptHistoryCont = usePromptHistoryContext(); |
| 12863 |
var isOpen = _usePromptHistoryCont.isOpen; |
| 12864 |
var isModalOpen = _usePromptHistoryCont.isModalOpen; |
| 12865 |
var onClose = _usePromptHistoryCont.onClose; |
| 12866 |
var getContainerHeight = _usePromptHistoryCont.getContainerHeight; |
| 12867 |
var getContainer = _usePromptHistoryCont.getContainer; |
| 12868 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Modal, _extends$1({ |
| 12869 |
container: getContainer(), |
| 12870 |
open: isModalOpen, |
| 12871 |
hideBackdrop: true, |
| 12872 |
onClose, |
| 12873 |
sx: { position: "absolute" } |
| 12874 |
}, props), /*#__PURE__*/ react.default.createElement(_elementor_ui.Backdrop, { |
| 12875 |
open: true, |
| 12876 |
sx: { |
| 12877 |
position: "absolute", |
| 12878 |
justifyContent: "flex-end", |
| 12879 |
alignItems: "flex-start" |
| 12880 |
}, |
| 12881 |
"aria-hidden": false |
| 12882 |
}, /*#__PURE__*/ react.default.createElement(_elementor_ui.Slide, { |
| 12883 |
direction: "left", |
| 12884 |
in: isOpen, |
| 12885 |
timeout: 500, |
| 12886 |
easing: "ease-in-out" |
| 12887 |
}, /*#__PURE__*/ react.default.createElement(StyledContent$1, { |
| 12888 |
"aria-label": (0, _wordpress_i18n.__)("Prompt history modal", "elementor"), |
| 12889 |
height: getContainerHeight() |
| 12890 |
}, children)))); |
| 12891 |
}; |
| 12892 |
ModalContainer.propTypes = { |
| 12893 |
isOpen: import_prop_types$8.default.bool.isRequired, |
| 12894 |
isModalOpen: import_prop_types$8.default.bool.isRequired, |
| 12895 |
onClose: import_prop_types$8.default.func.isRequired, |
| 12896 |
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]) |
| 12897 |
}; |
| 12898 |
|
| 12899 |
//#endregion |
| 12900 |
//#region modules/ai/assets/js/editor/components/prompt-history/history-modal.js |
| 12901 |
init_asyncToGenerator(); |
| 12902 |
init_prompt_error_message(); |
| 12903 |
init_prompt_history_context(); |
| 12904 |
var ITEMS_LIMIT = 10; |
| 12905 |
var FREE_PLAN_ERRORS = ["invalid_connect_data", "no_subscription"]; |
| 12906 |
var PromptHistoryModal = function PromptHistoryModal(props) { |
| 12907 |
var lastRun = (0, react.useRef)(function() {}); |
| 12908 |
var scrollContainer = (0, react.useRef)(null); |
| 12909 |
var _usePromptHistoryCont = usePromptHistoryContext(); |
| 12910 |
var historyType = _usePromptHistoryCont.historyType; |
| 12911 |
var onClose = _usePromptHistoryCont.onClose; |
| 12912 |
var _usePromptHistory = usePromptHistory(historyType); |
| 12913 |
var items = _usePromptHistory.items; |
| 12914 |
var meta = _usePromptHistory.meta; |
| 12915 |
var isHistoryFetchingInProgress = _usePromptHistory.isLoading; |
| 12916 |
var historyFetchingError = _usePromptHistory.error; |
| 12917 |
var fetchData = _usePromptHistory.fetchData; |
| 12918 |
var deleteItemFromState = _usePromptHistory.deleteItemById; |
| 12919 |
var _useDeletePromptHisto = useDeletePromptHistoryItem(); |
| 12920 |
var isDeletingInProgress = _useDeletePromptHisto.isLoading; |
| 12921 |
var historyDeletingError = _useDeletePromptHisto.error; |
| 12922 |
var deleteItem = _useDeletePromptHisto.deleteItem; |
| 12923 |
var error = historyFetchingError || historyDeletingError; |
| 12924 |
var isLoading = isHistoryFetchingInProgress || isDeletingInProgress; |
| 12925 |
var isLastPage = meta && (meta === null || meta === void 0 ? void 0 : meta.currentPage) === (meta === null || meta === void 0 ? void 0 : meta.totalPages); |
| 12926 |
var showUpgrade = (items === null || items === void 0 ? void 0 : items.length) > 0 && (meta === null || meta === void 0 ? void 0 : meta.allowedDays) < 90 && isLastPage; |
| 12927 |
(0, react.useEffect)(function() { |
| 12928 |
lastRun.current = /*#__PURE__*/ _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee() { |
| 12929 |
return import_regenerator$2.default.wrap(function(_context) { |
| 12930 |
while (1) switch (_context.prev = _context.next) { |
| 12931 |
case 0: return _context.abrupt("return", fetchData({ |
| 12932 |
page: 1, |
| 12933 |
limit: ITEMS_LIMIT |
| 12934 |
})); |
| 12935 |
case 1: |
| 12936 |
case "end": return _context.stop(); |
| 12937 |
} |
| 12938 |
}, _callee); |
| 12939 |
})); |
| 12940 |
lastRun.current(); |
| 12941 |
}, []); |
| 12942 |
var loadNext = function loadNext() { |
| 12943 |
if (isLoading || isLastPage) return; |
| 12944 |
lastRun.current = /*#__PURE__*/ _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee2() { |
| 12945 |
return import_regenerator$2.default.wrap(function(_context2) { |
| 12946 |
while (1) switch (_context2.prev = _context2.next) { |
| 12947 |
case 0: return _context2.abrupt("return", fetchData({ |
| 12948 |
page: meta.currentPage + 1, |
| 12949 |
limit: ITEMS_LIMIT |
| 12950 |
})); |
| 12951 |
case 1: |
| 12952 |
case "end": return _context2.stop(); |
| 12953 |
} |
| 12954 |
}, _callee2); |
| 12955 |
})); |
| 12956 |
lastRun.current(); |
| 12957 |
}; |
| 12958 |
var onHistoryItemDelete = /*#__PURE__*/ function() { |
| 12959 |
var _ref3 = _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee4(id) { |
| 12960 |
return import_regenerator$2.default.wrap(function(_context4) { |
| 12961 |
while (1) switch (_context4.prev = _context4.next) { |
| 12962 |
case 0: |
| 12963 |
lastRun.current = /*#__PURE__*/ _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee3() { |
| 12964 |
return import_regenerator$2.default.wrap(function(_context3) { |
| 12965 |
while (1) switch (_context3.prev = _context3.next) { |
| 12966 |
case 0: |
| 12967 |
_context3.next = 1; |
| 12968 |
return deleteItem(id); |
| 12969 |
case 1: return _context3.abrupt("return", _context3.sent); |
| 12970 |
case 2: |
| 12971 |
case "end": return _context3.stop(); |
| 12972 |
} |
| 12973 |
}, _callee3); |
| 12974 |
})); |
| 12975 |
_context4.next = 1; |
| 12976 |
return lastRun.current(); |
| 12977 |
case 1: if (!historyDeletingError) deleteItemFromState(id); |
| 12978 |
case 2: |
| 12979 |
case "end": return _context4.stop(); |
| 12980 |
} |
| 12981 |
}, _callee4); |
| 12982 |
})); |
| 12983 |
return function onHistoryItemDelete(_x) { |
| 12984 |
return _ref3.apply(this, arguments); |
| 12985 |
}; |
| 12986 |
}(); |
| 12987 |
return /*#__PURE__*/ react.default.createElement(ModalContainer, props, /*#__PURE__*/ react.default.createElement(PromptHistoryModalHeader, { onClose }), error && !FREE_PLAN_ERRORS.includes(error) && /*#__PURE__*/ react.default.createElement(PromptErrorMessage, { |
| 12988 |
error, |
| 12989 |
onRetry: lastRun.current, |
| 12990 |
sx: { |
| 12991 |
position: "absolute", |
| 12992 |
zIndex: 1, |
| 12993 |
marginTop: isLoading ? .5 : "revert" |
| 12994 |
} |
| 12995 |
}), isLoading && /*#__PURE__*/ react.default.createElement(_elementor_ui.LinearProgress, { |
| 12996 |
role: "progressbar", |
| 12997 |
"aria-label": (0, _wordpress_i18n.__)("Loading", "elementor"), |
| 12998 |
color: "secondary" |
| 12999 |
}), /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, { |
| 13000 |
sx: { |
| 13001 |
overflowY: "scroll", |
| 13002 |
height: "85%" |
| 13003 |
}, |
| 13004 |
ref: scrollContainer |
| 13005 |
}, error && FREE_PLAN_ERRORS.includes(error) && /*#__PURE__*/ react.default.createElement(PromptHistoryUpgrade, { |
| 13006 |
variant: "full", |
| 13007 |
historyType |
| 13008 |
}), !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, { |
| 13009 |
loadMore: loadNext, |
| 13010 |
getScrollParent: function getScrollParent() { |
| 13011 |
return scrollContainer.current; |
| 13012 |
}, |
| 13013 |
useWindow: false, |
| 13014 |
isReverse: false, |
| 13015 |
threshold: 30, |
| 13016 |
initialLoad: false, |
| 13017 |
hasMore: !isLastPage |
| 13018 |
}, renderPeriods({ |
| 13019 |
items, |
| 13020 |
onDelete: onHistoryItemDelete |
| 13021 |
})), showUpgrade && /*#__PURE__*/ react.default.createElement(PromptHistoryUpgrade, { |
| 13022 |
variant: "small", |
| 13023 |
historyType |
| 13024 |
}))); |
| 13025 |
}; |
| 13026 |
|
| 13027 |
//#endregion |
| 13028 |
//#region modules/ai/assets/js/editor/components/prompt-history/index.js |
| 13029 |
init_prompt_history_context(); |
| 13030 |
var PROMPT_HISTORY_MODAL_ID = "prompt-history-modal"; |
| 13031 |
var PromptHistory = function PromptHistory() { |
| 13032 |
var _usePromptHistoryCont = usePromptHistoryContext(); |
| 13033 |
var isOpen = _usePromptHistoryCont.isOpen; |
| 13034 |
var isModalOpen = _usePromptHistoryCont.isModalOpen; |
| 13035 |
var onOpen = _usePromptHistoryCont.onOpen; |
| 13036 |
var onClose = _usePromptHistoryCont.onClose; |
| 13037 |
return /*#__PURE__*/ react.default.createElement(react.default.Fragment, null, /*#__PURE__*/ react.default.createElement(PromptHistoryButton, { |
| 13038 |
isActive: isOpen, |
| 13039 |
onClick: function onClick() { |
| 13040 |
return isOpen ? onClose() : onOpen(); |
| 13041 |
}, |
| 13042 |
"aria-haspopup": "dialog", |
| 13043 |
"aria-controls": PROMPT_HISTORY_MODAL_ID |
| 13044 |
}), isModalOpen && /*#__PURE__*/ react.default.createElement(PromptHistoryModal, { id: PROMPT_HISTORY_MODAL_ID })); |
| 13045 |
}; |
| 13046 |
|
| 13047 |
//#endregion |
| 13048 |
//#region modules/ai/assets/js/editor/pages/form-media/index.js |
| 13049 |
init_extends(); |
| 13050 |
init_slicedToArray(); |
| 13051 |
init_defineProperty$1(); |
| 13052 |
function ownKeys$9(e, r) { |
| 13053 |
var t = Object.keys(e); |
| 13054 |
if (Object.getOwnPropertySymbols) { |
| 13055 |
var o = Object.getOwnPropertySymbols(e); |
| 13056 |
r && (o = o.filter(function(r) { |
| 13057 |
return Object.getOwnPropertyDescriptor(e, r).enumerable; |
| 13058 |
})), t.push.apply(t, o); |
| 13059 |
} |
| 13060 |
return t; |
| 13061 |
} |
| 13062 |
__name(ownKeys$9, "ownKeys"); |
| 13063 |
function _objectSpread$9(e) { |
| 13064 |
for (var r = 1; r < arguments.length; r++) { |
| 13065 |
var t = null != arguments[r] ? arguments[r] : {}; |
| 13066 |
r % 2 ? ownKeys$9(Object(t), !0).forEach(function(r) { |
| 13067 |
_defineProperty$1(e, r, t[r]); |
| 13068 |
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$9(Object(t)).forEach(function(r) { |
| 13069 |
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); |
| 13070 |
}); |
| 13071 |
} |
| 13072 |
return e; |
| 13073 |
} |
| 13074 |
__name(_objectSpread$9, "_objectSpread"); |
| 13075 |
var initialData = { |
| 13076 |
isAllSaved: false, |
| 13077 |
hasUnsavedChanges: false |
| 13078 |
}; |
| 13079 |
var SET_UNSAVED_CHANGES = "SET_UNSAVED_CHANGES"; |
| 13080 |
var SAVE_AND_CLOSE = "SAVE_AND_CLOSE"; |
| 13081 |
var reducer = function reducer(state, _ref) { |
| 13082 |
var type = _ref.type; |
| 13083 |
var payload = _ref.payload; |
| 13084 |
switch (type) { |
| 13085 |
case SET_UNSAVED_CHANGES: return _objectSpread$9(_objectSpread$9({}, state), {}, { |
| 13086 |
hasUnsavedChanges: payload, |
| 13087 |
isAllSaved: payload ? false : state.isAllSaved |
| 13088 |
}); |
| 13089 |
case SAVE_AND_CLOSE: return _objectSpread$9(_objectSpread$9({}, state), {}, { |
| 13090 |
isAllSaved: true, |
| 13091 |
hasUnsavedChanges: false |
| 13092 |
}); |
| 13093 |
default: throw Error("Unknown action."); |
| 13094 |
} |
| 13095 |
}; |
| 13096 |
var FormMedia = function FormMedia(_ref2) { |
| 13097 |
var onClose = _ref2.onClose; |
| 13098 |
var DialogProps = _ref2.DialogProps; |
| 13099 |
var getControlValue = _ref2.getControlValue; |
| 13100 |
var setControlValue = _ref2.setControlValue; |
| 13101 |
var additionalOptions = _ref2.additionalOptions; |
| 13102 |
var maybeRenderUpgradeChip = _ref2.maybeRenderUpgradeChip; |
| 13103 |
var hasSubscription = _ref2.hasSubscription; |
| 13104 |
var usagePercentage = _ref2.usagePercentage; |
| 13105 |
var _useReducer2 = _slicedToArray((0, react.useReducer)(reducer, initialData), 2); |
| 13106 |
var state = _useReducer2[0]; |
| 13107 |
var dispatch = _useReducer2[1]; |
| 13108 |
var _useState2 = _slicedToArray((0, react.useState)(false), 2); |
| 13109 |
var showUnsavedChangeAlert = _useState2[0]; |
| 13110 |
var setShowUnsavedChangeAlert = _useState2[1]; |
| 13111 |
var setHasUnsavedChanges = function setHasUnsavedChanges(payload) { |
| 13112 |
return dispatch({ |
| 13113 |
type: SET_UNSAVED_CHANGES, |
| 13114 |
payload |
| 13115 |
}); |
| 13116 |
}; |
| 13117 |
var saveAndClose = function saveAndClose() { |
| 13118 |
return dispatch({ type: SAVE_AND_CLOSE }); |
| 13119 |
}; |
| 13120 |
var onCloseIntent = function onCloseIntent() { |
| 13121 |
if (state.hasUnsavedChanges) { |
| 13122 |
setShowUnsavedChangeAlert(true); |
| 13123 |
return; |
| 13124 |
} |
| 13125 |
onClose(); |
| 13126 |
}; |
| 13127 |
var editImageInitialData = getControlValue() === (additionalOptions === null || additionalOptions === void 0 ? void 0 : additionalOptions.defaultValue) ? {} : getControlValue(); |
| 13128 |
var globalSettings = { |
| 13129 |
initialImageType: (additionalOptions === null || additionalOptions === void 0 ? void 0 : additionalOptions.defaultImageType) || "", |
| 13130 |
hasSubscription, |
| 13131 |
usagePercentage, |
| 13132 |
hideBackButton: additionalOptions === null || additionalOptions === void 0 ? void 0 : additionalOptions.hideBackButton |
| 13133 |
}; |
| 13134 |
var globalActions = { |
| 13135 |
state, |
| 13136 |
getControlValue, |
| 13137 |
setControlValue, |
| 13138 |
saveAndClose, |
| 13139 |
close: onCloseIntent, |
| 13140 |
setHasUnsavedChanges |
| 13141 |
}; |
| 13142 |
(0, react.useEffect)(function() { |
| 13143 |
if (state.isAllSaved) onClose(); |
| 13144 |
}, [state.isAllSaved]); |
| 13145 |
return /*#__PURE__*/ react.default.createElement(react.default.Fragment, null, /*#__PURE__*/ react.default.createElement(PromptDialog, _extends$1({ |
| 13146 |
id: "e-form-media", |
| 13147 |
onClose: function onClose() { |
| 13148 |
return onCloseIntent(); |
| 13149 |
}, |
| 13150 |
maxWidth: "lg" |
| 13151 |
}, DialogProps), /*#__PURE__*/ react.default.createElement(PromptDialog.Header, { |
| 13152 |
onClose: function onClose() { |
| 13153 |
return onCloseIntent(); |
| 13154 |
}, |
| 13155 |
hideAiBetaLogo: additionalOptions === null || additionalOptions === void 0 ? void 0 : additionalOptions.hideAiBetaLogo |
| 13156 |
}, !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, { |
| 13157 |
additionalOptions, |
| 13158 |
onClose |
| 13159 |
})))))), showUnsavedChangeAlert && /*#__PURE__*/ react.default.createElement(UnsavedChangesAlert$1, { |
| 13160 |
onClose, |
| 13161 |
onCancel: function onCancel() { |
| 13162 |
return setShowUnsavedChangeAlert(false); |
| 13163 |
}, |
| 13164 |
open: true |
| 13165 |
})); |
| 13166 |
}; |
| 13167 |
FormMedia.propTypes = { |
| 13168 |
onClose: import_prop_types$8.default.func.isRequired, |
| 13169 |
DialogProps: import_prop_types$8.default.object, |
| 13170 |
getControlValue: import_prop_types$8.default.func.isRequired, |
| 13171 |
setControlValue: import_prop_types$8.default.func.isRequired, |
| 13172 |
additionalOptions: import_prop_types$8.default.object, |
| 13173 |
credits: import_prop_types$8.default.number, |
| 13174 |
maybeRenderUpgradeChip: import_prop_types$8.default.func, |
| 13175 |
hasSubscription: import_prop_types$8.default.bool, |
| 13176 |
usagePercentage: import_prop_types$8.default.number |
| 13177 |
}; |
| 13178 |
|
| 13179 |
//#endregion |
| 13180 |
//#region modules/ai/assets/js/editor/hooks/use-animation-prompt.js |
| 13181 |
init_typeof$1(); |
| 13182 |
init_slicedToArray(); |
| 13183 |
init_defineProperty$1(); |
| 13184 |
init_asyncToGenerator(); |
| 13185 |
init_api(); |
| 13186 |
init_use_prompt(); |
| 13187 |
function ownKeys$8(e, r) { |
| 13188 |
var t = Object.keys(e); |
| 13189 |
if (Object.getOwnPropertySymbols) { |
| 13190 |
var o = Object.getOwnPropertySymbols(e); |
| 13191 |
r && (o = o.filter(function(r) { |
| 13192 |
return Object.getOwnPropertyDescriptor(e, r).enumerable; |
| 13193 |
})), t.push.apply(t, o); |
| 13194 |
} |
| 13195 |
return t; |
| 13196 |
} |
| 13197 |
__name(ownKeys$8, "ownKeys"); |
| 13198 |
function _objectSpread$8(e) { |
| 13199 |
for (var r = 1; r < arguments.length; r++) { |
| 13200 |
var t = null != arguments[r] ? arguments[r] : {}; |
| 13201 |
r % 2 ? ownKeys$8(Object(t), !0).forEach(function(r) { |
| 13202 |
_defineProperty$1(e, r, t[r]); |
| 13203 |
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$8(Object(t)).forEach(function(r) { |
| 13204 |
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); |
| 13205 |
}); |
| 13206 |
} |
| 13207 |
return e; |
| 13208 |
} |
| 13209 |
__name(_objectSpread$8, "_objectSpread"); |
| 13210 |
var getAnimationResult = /*#__PURE__*/ function() { |
| 13211 |
var _ref = _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee(payload, motionEffectType) { |
| 13212 |
return import_regenerator$2.default.wrap(function(_context) { |
| 13213 |
while (1) switch (_context.prev = _context.next) { |
| 13214 |
case 0: return _context.abrupt("return", getAnimation(_objectSpread$8(_objectSpread$8({}, payload), {}, { motionEffectType }))); |
| 13215 |
case 1: |
| 13216 |
case "end": return _context.stop(); |
| 13217 |
} |
| 13218 |
}, _callee); |
| 13219 |
})); |
| 13220 |
return function getAnimationResult(_x, _x2) { |
| 13221 |
return _ref.apply(this, arguments); |
| 13222 |
}; |
| 13223 |
}(); |
| 13224 |
var useAnimationPrompt = function useAnimationPrompt(motionEffectType, widgetType, initialValue) { |
| 13225 |
var _usePrompt = usePrompt(function(payload) { |
| 13226 |
return getAnimationResult(payload, motionEffectType); |
| 13227 |
}, initialValue); |
| 13228 |
var data = _usePrompt.data; |
| 13229 |
var isLoading = _usePrompt.isLoading; |
| 13230 |
var error = _usePrompt.error; |
| 13231 |
var reset = _usePrompt.reset; |
| 13232 |
var send = _usePrompt.send; |
| 13233 |
var sendUsageData = _usePrompt.sendUsageData; |
| 13234 |
var getControlData = function getControlData(controlKey) { |
| 13235 |
var _elementor$widgetsCac; |
| 13236 |
var _elementor$widgetsCac2; |
| 13237 |
return { |
| 13238 |
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, |
| 13239 |
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 |
| 13240 |
}; |
| 13241 |
}; |
| 13242 |
var processMotionEffects = function processMotionEffects(jsonObject) { |
| 13243 |
var result = {}; |
| 13244 |
var firstChild = jsonObject[Object.keys(jsonObject)[0]]; |
| 13245 |
var firstEnableControlKey = Object.keys(firstChild)[0]; |
| 13246 |
result[firstEnableControlKey] = { |
| 13247 |
isParent: true, |
| 13248 |
label: getControlData(firstEnableControlKey).label, |
| 13249 |
value: jsonObject.enabled[firstEnableControlKey], |
| 13250 |
tabs: 0 |
| 13251 |
}; |
| 13252 |
var processOtherProps = function processOtherProps(props) { |
| 13253 |
for (var _i = 0, _Object$entries = Object.entries(props); _i < _Object$entries.length; _i++) { |
| 13254 |
var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2); |
| 13255 |
var key = _Object$entries$_i[0]; |
| 13256 |
var value = _Object$entries$_i[1]; |
| 13257 |
if ("enabled" === key && value) { |
| 13258 |
var enableControlKey = Object.keys(value)[0]; |
| 13259 |
result[enableControlKey] = { |
| 13260 |
isParent: false, |
| 13261 |
label: getControlData(enableControlKey).label, |
| 13262 |
value: value[enableControlKey], |
| 13263 |
tabs: 1 |
| 13264 |
}; |
| 13265 |
} else { |
| 13266 |
if ("none" === value || "normal" === value) continue; |
| 13267 |
result[key] = { value }; |
| 13268 |
} |
| 13269 |
} |
| 13270 |
}; |
| 13271 |
for (var _i2 = 0, _Object$entries2 = Object.entries(jsonObject); _i2 < _Object$entries2.length; _i2++) { |
| 13272 |
var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i2], 2); |
| 13273 |
var propKey = _Object$entries2$_i[0]; |
| 13274 |
var propValue = _Object$entries2$_i[1]; |
| 13275 |
if (propKey !== "enabled" && "object" === _typeof$1(propValue)) processOtherProps(propValue); |
| 13276 |
} |
| 13277 |
return result; |
| 13278 |
}; |
| 13279 |
var processEntranceEffects = function processEntranceEffects(jsonObject) { |
| 13280 |
var result = {}; |
| 13281 |
var firstChildKey = Object.keys(jsonObject)[0]; |
| 13282 |
var firstChild = jsonObject[firstChildKey]; |
| 13283 |
result[firstChildKey] = { |
| 13284 |
isParent: true, |
| 13285 |
label: getControlData(firstChildKey).label, |
| 13286 |
value: firstChild, |
| 13287 |
tabs: 0 |
| 13288 |
}; |
| 13289 |
result[firstChild] = { |
| 13290 |
isParent: false, |
| 13291 |
label: firstChild, |
| 13292 |
tabs: 1 |
| 13293 |
}; |
| 13294 |
var processProps = function processProps(props) { |
| 13295 |
for (var _i3 = 0, _Object$entries3 = Object.entries(props); _i3 < _Object$entries3.length; _i3++) { |
| 13296 |
var _Object$entries3$_i = _slicedToArray(_Object$entries3[_i3], 2); |
| 13297 |
var key = _Object$entries3$_i[0]; |
| 13298 |
var value = _Object$entries3$_i[1]; |
| 13299 |
if ("none" === value || "normal" === value) continue; |
| 13300 |
result[key] = { value }; |
| 13301 |
} |
| 13302 |
}; |
| 13303 |
for (var _i4 = 0, _Object$entries4 = Object.entries(jsonObject); _i4 < _Object$entries4.length; _i4++) { |
| 13304 |
var _Object$entries4$_i = _slicedToArray(_Object$entries4[_i4], 2); |
| 13305 |
var propKey = _Object$entries4$_i[0]; |
| 13306 |
var propValue = _Object$entries4$_i[1]; |
| 13307 |
if (propKey !== firstChildKey && "object" === _typeof$1(propValue)) processProps(propValue); |
| 13308 |
} |
| 13309 |
return result; |
| 13310 |
}; |
| 13311 |
var processHoverEffects = function processHoverEffects(jsonObject) { |
| 13312 |
var result = {}; |
| 13313 |
var isHoverLabelAdded = false; |
| 13314 |
var processProps = function processProps(props) { |
| 13315 |
for (var _i5 = 0, _Object$entries5 = Object.entries(props); _i5 < _Object$entries5.length; _i5++) { |
| 13316 |
var _Object$entries5$_i = _slicedToArray(_Object$entries5[_i5], 2); |
| 13317 |
var key = _Object$entries5$_i[0]; |
| 13318 |
var value = _Object$entries5$_i[1]; |
| 13319 |
if ("enabled" === key && value) { |
| 13320 |
var enableControlKey = Object.keys(value)[0]; |
| 13321 |
var _getControlData = getControlData(enableControlKey); |
| 13322 |
var label = _getControlData.label; |
| 13323 |
var innerTab = _getControlData.innerTab; |
| 13324 |
if (!isHoverLabelAdded) { |
| 13325 |
result[innerTab] = { |
| 13326 |
isParent: true, |
| 13327 |
label: getControlData(innerTab).label, |
| 13328 |
tabs: 0 |
| 13329 |
}; |
| 13330 |
isHoverLabelAdded = true; |
| 13331 |
} |
| 13332 |
result[enableControlKey] = { |
| 13333 |
isParent: false, |
| 13334 |
label, |
| 13335 |
value: value[enableControlKey], |
| 13336 |
tabs: 1 |
| 13337 |
}; |
| 13338 |
} else { |
| 13339 |
if ("none" === value || "normal" === value) continue; |
| 13340 |
result[key] = { value }; |
| 13341 |
} |
| 13342 |
} |
| 13343 |
}; |
| 13344 |
for (var _i6 = 0, _Object$entries6 = Object.entries(jsonObject); _i6 < _Object$entries6.length; _i6++) { |
| 13345 |
var propValue = _slicedToArray(_Object$entries6[_i6], 2)[1]; |
| 13346 |
if ("object" === _typeof$1(propValue)) processProps(propValue); |
| 13347 |
} |
| 13348 |
return result; |
| 13349 |
}; |
| 13350 |
var digestResult = function digestResult(jsonString) { |
| 13351 |
var result = {}; |
| 13352 |
function traverse(currentObj) { |
| 13353 |
if (!currentObj || _typeof$1(currentObj) !== "object") return; |
| 13354 |
for (var key in currentObj) { |
| 13355 |
if (!currentObj.hasOwnProperty(key)) continue; |
| 13356 |
if (["scrolling_effects", "mouse_effects"].includes(key)) { |
| 13357 |
result = _objectSpread$8(_objectSpread$8({}, result), processMotionEffects(currentObj[key])); |
| 13358 |
continue; |
| 13359 |
} |
| 13360 |
if ("entrance_effects" === key) { |
| 13361 |
result = _objectSpread$8(_objectSpread$8({}, result), processEntranceEffects(currentObj[key])); |
| 13362 |
continue; |
| 13363 |
} |
| 13364 |
if ("hover_effects" === key) { |
| 13365 |
result = _objectSpread$8(_objectSpread$8({}, result), processHoverEffects(currentObj[key])); |
| 13366 |
return; |
| 13367 |
} |
| 13368 |
traverse(currentObj[key]); |
| 13369 |
} |
| 13370 |
} |
| 13371 |
traverse(JSON.parse(jsonString)); |
| 13372 |
return result; |
| 13373 |
}; |
| 13374 |
(0, react.useEffect)(function() { |
| 13375 |
if (data.result) data.result = digestResult(data.result); |
| 13376 |
}, [data]); |
| 13377 |
return { |
| 13378 |
data, |
| 13379 |
isLoading, |
| 13380 |
error, |
| 13381 |
reset, |
| 13382 |
send, |
| 13383 |
sendUsageData |
| 13384 |
}; |
| 13385 |
}; |
| 13386 |
|
| 13387 |
//#endregion |
| 13388 |
//#region modules/ai/assets/js/editor/pages/form-animation/index.js |
| 13389 |
init_asyncToGenerator(); |
| 13390 |
init_slicedToArray(); |
| 13391 |
init_actions_data(); |
| 13392 |
init_loader(); |
| 13393 |
init_prompt_search(); |
| 13394 |
init_prompt_suggestions(); |
| 13395 |
init_generate_button(); |
| 13396 |
init_prompt_error_message(); |
| 13397 |
init_requests_ids(); |
| 13398 |
init_voice_promotion_alert(); |
| 13399 |
var CodeDisplayWrapper$1 = (0, _elementor_ui.styled)(_elementor_ui.Box)(function() { |
| 13400 |
return { |
| 13401 |
"& p": { |
| 13402 |
mb: "10px", |
| 13403 |
fontSize: "14px", |
| 13404 |
lineHeight: "1.5" |
| 13405 |
}, |
| 13406 |
"& pre": { position: "relative" }, |
| 13407 |
"& textarea": { |
| 13408 |
fontSize: "13px", |
| 13409 |
lineHeight: "1.7" |
| 13410 |
} |
| 13411 |
}; |
| 13412 |
}); |
| 13413 |
var FormAnimation = function FormAnimation(_ref) { |
| 13414 |
var onClose = _ref.onClose; |
| 13415 |
var getControlValue = _ref.getControlValue; |
| 13416 |
var setControlValue = _ref.setControlValue; |
| 13417 |
var additionalOptions = _ref.additionalOptions; |
| 13418 |
var credits = _ref.credits; |
| 13419 |
var children = _ref.children; |
| 13420 |
var _useAnimationPrompt = useAnimationPrompt(additionalOptions.animationType, additionalOptions.widgetType, credits); |
| 13421 |
var data = _useAnimationPrompt.data; |
| 13422 |
var isLoading = _useAnimationPrompt.isLoading; |
| 13423 |
var error = _useAnimationPrompt.error; |
| 13424 |
var reset = _useAnimationPrompt.reset; |
| 13425 |
var send = _useAnimationPrompt.send; |
| 13426 |
var sendUsageData = _useAnimationPrompt.sendUsageData; |
| 13427 |
var _useState2 = _slicedToArray((0, react.useState)(""), 2); |
| 13428 |
var prompt = _useState2[0]; |
| 13429 |
var setPrompt = _useState2[1]; |
| 13430 |
var setGenerate = useRequestIds().setGenerate; |
| 13431 |
var _useState4 = _slicedToArray((0, react.useState)(""), 2); |
| 13432 |
var animationSummary = _useState4[0]; |
| 13433 |
var setAnimationSummary = _useState4[1]; |
| 13434 |
var _useState6 = _slicedToArray((0, react.useState)(), 2); |
| 13435 |
var prevControlValue = _useState6[0]; |
| 13436 |
var setPrevControlValue = _useState6[1]; |
| 13437 |
var lastRun = (0, react.useRef)(function() {}); |
| 13438 |
var autocompleteItems = "hover" === additionalOptions.animationType ? hoverEffectAutocomplete : motionEffectAutocomplete; |
| 13439 |
var showSuggestions = !prompt; |
| 13440 |
var handleSubmit = /*#__PURE__*/ function() { |
| 13441 |
var _ref2 = _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee(event) { |
| 13442 |
return import_regenerator$2.default.wrap(function(_context) { |
| 13443 |
while (1) switch (_context.prev = _context.next) { |
| 13444 |
case 0: |
| 13445 |
event.preventDefault(); |
| 13446 |
setGenerate(); |
| 13447 |
lastRun.current = function() { |
| 13448 |
return send({ prompt }); |
| 13449 |
}; |
| 13450 |
_context.next = 1; |
| 13451 |
return lastRun.current(); |
| 13452 |
case 1: |
| 13453 |
case "end": return _context.stop(); |
| 13454 |
} |
| 13455 |
}, _callee); |
| 13456 |
})); |
| 13457 |
return function handleSubmit(_x) { |
| 13458 |
return _ref2.apply(this, arguments); |
| 13459 |
}; |
| 13460 |
}(); |
| 13461 |
(0, react.useEffect)(function() { |
| 13462 |
if (data.result) showPreview(data.result); |
| 13463 |
}, [data]); |
| 13464 |
(0, react.useEffect)(function() { |
| 13465 |
return function() { |
| 13466 |
restorePrevSettings(); |
| 13467 |
}; |
| 13468 |
}, []); |
| 13469 |
var showPreview = function showPreview(result) { |
| 13470 |
var summary = Object.keys(result).filter(function(key) { |
| 13471 |
return result[key].label; |
| 13472 |
}).map(function(key) { |
| 13473 |
var item = result[key]; |
| 13474 |
var tabs = " ".repeat(item.tabs); |
| 13475 |
var bulletIcon = item.tabs > 0 ? "• " : ""; |
| 13476 |
var label = item.isParent ? "<br/><b>".concat(item.label, ":</b>") : "".concat(bulletIcon, " ").concat(item.label); |
| 13477 |
return "".concat(tabs).concat(label); |
| 13478 |
}).join("<br/>"); |
| 13479 |
var title = "".concat((0, _wordpress_i18n.__)("Here’s a breakdown of what was done for creating the animation", "elementor")); |
| 13480 |
setAnimationSummary("<b>".concat(title, ":</b><br/>").concat(summary)); |
| 13481 |
setPrevControlValue(getControlValue()); |
| 13482 |
elementor.documents.getCurrent().history.setActive(false); |
| 13483 |
setControlValue(getValidElementor(result)); |
| 13484 |
}; |
| 13485 |
var restorePrevSettings = function restorePrevSettings() { |
| 13486 |
setControlValue(prevControlValue); |
| 13487 |
elementor.documents.getCurrent().history.setActive(true); |
| 13488 |
}; |
| 13489 |
var getValidElementor = function getValidElementor(result) { |
| 13490 |
return Object.entries(result).filter(function(_ref3) { |
| 13491 |
return _slicedToArray(_ref3, 2)[1].hasOwnProperty("value"); |
| 13492 |
}).reduce(function(previousValue, _ref5) { |
| 13493 |
var _ref6 = _slicedToArray(_ref5, 2); |
| 13494 |
var key = _ref6[0]; |
| 13495 |
previousValue[key] = _ref6[1].value; |
| 13496 |
return previousValue; |
| 13497 |
}, {}); |
| 13498 |
}; |
| 13499 |
var applyPrompt = function applyPrompt(result) { |
| 13500 |
sendUsageData(); |
| 13501 |
restorePrevSettings(); |
| 13502 |
setControlValue(getValidElementor(result)); |
| 13503 |
onClose(); |
| 13504 |
}; |
| 13505 |
if (isLoading) return /*#__PURE__*/ react.default.createElement(Loader, null); |
| 13506 |
return /*#__PURE__*/ react.default.createElement(react.default.Fragment, null, error && /*#__PURE__*/ react.default.createElement(PromptErrorMessage, { |
| 13507 |
error, |
| 13508 |
onRetry: lastRun.current, |
| 13509 |
sx: { mb: 2.5 } |
| 13510 |
}), children, !data.result && /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, { |
| 13511 |
component: "form", |
| 13512 |
onSubmit: handleSubmit |
| 13513 |
}, /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, { sx: { pb: 1.5 } }, /*#__PURE__*/ react.default.createElement(PromptSearch, { |
| 13514 |
placeholder: (0, _wordpress_i18n.__)("Describe the animation you want to create...", "elementor"), |
| 13515 |
name: "prompt", |
| 13516 |
value: prompt, |
| 13517 |
color: "secondary", |
| 13518 |
onChange: function onChange(event) { |
| 13519 |
return setPrompt(event.target.value); |
| 13520 |
} |
| 13521 |
})), showSuggestions && /*#__PURE__*/ react.default.createElement(PromptSuggestions, { |
| 13522 |
suggestions: autocompleteItems, |
| 13523 |
onSelect: setPrompt |
| 13524 |
}), /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, { |
| 13525 |
direction: "row", |
| 13526 |
alignItems: "center", |
| 13527 |
sx: { |
| 13528 |
py: 1.5, |
| 13529 |
mt: 4 |
| 13530 |
} |
| 13531 |
}, /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, { |
| 13532 |
direction: "row", |
| 13533 |
justifyContent: "flex-end", |
| 13534 |
flexGrow: 1 |
| 13535 |
}, /*#__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: { |
| 13536 |
backgroundColor: "rgba(0, 0, 0, 0.06); ", |
| 13537 |
padding: "1em", |
| 13538 |
borderRadius: "4px", |
| 13539 |
width: "100%", |
| 13540 |
height: "260px", |
| 13541 |
overflowX: "auto" |
| 13542 |
} }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, { |
| 13543 |
variant: "body1", |
| 13544 |
dangerouslySetInnerHTML: { __html: animationSummary } |
| 13545 |
})), /*#__PURE__*/ react.default.createElement(VoicePromotionAlert, { introductionKey: "ai-context-animation-promotion" }), /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, { |
| 13546 |
direction: "row", |
| 13547 |
alignItems: "center", |
| 13548 |
sx: { mt: 4 } |
| 13549 |
}, /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, { |
| 13550 |
direction: "row", |
| 13551 |
gap: 1, |
| 13552 |
justifyContent: "flex-end", |
| 13553 |
flexGrow: 1 |
| 13554 |
}, /*#__PURE__*/ react.default.createElement(_elementor_ui.Button, { |
| 13555 |
size: "small", |
| 13556 |
color: "secondary", |
| 13557 |
variant: "text", |
| 13558 |
onClick: function onClick() { |
| 13559 |
restorePrevSettings(); |
| 13560 |
reset(); |
| 13561 |
} |
| 13562 |
}, (0, _wordpress_i18n.__)("New prompt", "elementor")), /*#__PURE__*/ react.default.createElement(_elementor_ui.Button, { |
| 13563 |
size: "small", |
| 13564 |
variant: "contained", |
| 13565 |
color: "primary", |
| 13566 |
onClick: function onClick() { |
| 13567 |
return applyPrompt(data.result); |
| 13568 |
} |
| 13569 |
}, (0, _wordpress_i18n.__)("Use animation", "elementor")))))); |
| 13570 |
}; |
| 13571 |
FormAnimation.propTypes = { |
| 13572 |
onClose: import_prop_types$8.default.func.isRequired, |
| 13573 |
getControlValue: import_prop_types$8.default.func.isRequired, |
| 13574 |
setControlValue: import_prop_types$8.default.func.isRequired, |
| 13575 |
additionalOptions: import_prop_types$8.default.shape({ |
| 13576 |
animationType: import_prop_types$8.default.string, |
| 13577 |
widgetType: import_prop_types$8.default.string |
| 13578 |
}), |
| 13579 |
credits: import_prop_types$8.default.number, |
| 13580 |
children: import_prop_types$8.default.node |
| 13581 |
}; |
| 13582 |
|
| 13583 |
//#endregion |
| 13584 |
//#region \0vite/preload-helper.js |
| 13585 |
var scriptRel, assetsURL, seen, __vitePreload; |
| 13586 |
var init_preload_helper = __esmMin((() => { |
| 13587 |
scriptRel = "modulepreload"; |
| 13588 |
assetsURL = function(dep) { |
| 13589 |
return "/" + dep; |
| 13590 |
}; |
| 13591 |
seen = {}; |
| 13592 |
__vitePreload = function preload(baseModule, deps, importerUrl) { |
| 13593 |
let promise = Promise.resolve(); |
| 13594 |
if (false && deps && deps.length > 0) { |
| 13595 |
const links = document.getElementsByTagName("link"); |
| 13596 |
const cspNonceMeta = document.querySelector("meta[property=csp-nonce]"); |
| 13597 |
const cspNonce = (cspNonceMeta === null || cspNonceMeta === void 0 ? void 0 : cspNonceMeta.nonce) || (cspNonceMeta === null || cspNonceMeta === void 0 ? void 0 : cspNonceMeta.getAttribute("nonce")); |
| 13598 |
function allSettled(promises) { |
| 13599 |
return Promise.all(promises.map((p) => Promise.resolve(p).then((value) => ({ |
| 13600 |
status: "fulfilled", |
| 13601 |
value |
| 13602 |
}), (reason) => ({ |
| 13603 |
status: "rejected", |
| 13604 |
reason |
| 13605 |
})))); |
| 13606 |
} |
| 13607 |
function importMetaResolve(specifier) { |
| 13608 |
if ({}.resolve) return {}.resolve(specifier); |
| 13609 |
return new URL( |
| 13610 |
specifier, |
| 13611 |
/** #__KEEP__ */ |
| 13612 |
{}.url |
| 13613 |
).href; |
| 13614 |
} |
| 13615 |
promise = allSettled(deps.map((dep) => { |
| 13616 |
dep = assetsURL(dep, importerUrl); |
| 13617 |
dep = importMetaResolve(dep); |
| 13618 |
if (dep in seen) return; |
| 13619 |
seen[dep] = true; |
| 13620 |
const isCss = dep.endsWith(".css"); |
| 13621 |
for (let i = links.length - 1; i >= 0; i--) { |
| 13622 |
const link = links[i]; |
| 13623 |
if (link.href === dep && (!isCss || link.rel === "stylesheet")) return; |
| 13624 |
} |
| 13625 |
const link = document.createElement("link"); |
| 13626 |
link.rel = isCss ? "stylesheet" : scriptRel; |
| 13627 |
if (!isCss) link.as = "script"; |
| 13628 |
link.crossOrigin = ""; |
| 13629 |
link.href = dep; |
| 13630 |
if (cspNonce) link.setAttribute("nonce", cspNonce); |
| 13631 |
document.head.appendChild(link); |
| 13632 |
if (isCss) return new Promise((res, rej) => { |
| 13633 |
link.addEventListener("load", res); |
| 13634 |
link.addEventListener("error", () => rej(/* @__PURE__ */ new Error(`Unable to preload CSS for ${dep}`))); |
| 13635 |
}); |
| 13636 |
})); |
| 13637 |
} |
| 13638 |
function handlePreloadError(err) { |
| 13639 |
const e = new Event("vite:preloadError", { cancelable: true }); |
| 13640 |
e.payload = err; |
| 13641 |
window.dispatchEvent(e); |
| 13642 |
if (!e.defaultPrevented) throw err; |
| 13643 |
} |
| 13644 |
return promise.then((res) => { |
| 13645 |
for (const item of res || []) { |
| 13646 |
if (item.status !== "rejected") continue; |
| 13647 |
handlePreloadError(item.reason); |
| 13648 |
} |
| 13649 |
return baseModule().catch(handlePreloadError); |
| 13650 |
}); |
| 13651 |
}; |
| 13652 |
})); |
| 13653 |
|
| 13654 |
//#endregion |
| 13655 |
//#region modules/ai/assets/js/editor/pages/form-code/code-block.js |
| 13656 |
var import_prop_types$2, _excluded$6, CodeBlock; |
| 13657 |
var init_code_block = __esmMin((() => { |
| 13658 |
init_extends(); |
| 13659 |
init_objectWithoutProperties$1(); |
| 13660 |
import_prop_types$2 = /* @__PURE__ */ __toESM(require_prop_types()); |
| 13661 |
init_textarea(); |
| 13662 |
_excluded$6 = [ |
| 13663 |
"node", |
| 13664 |
"inline", |
| 13665 |
"children", |
| 13666 |
"defaultValue", |
| 13667 |
"onInsert" |
| 13668 |
]; |
| 13669 |
CodeBlock = function CodeBlock(_ref) { |
| 13670 |
_ref.node; |
| 13671 |
var inline = _ref.inline; |
| 13672 |
var children = _ref.children; |
| 13673 |
var defaultValue = _ref.defaultValue; |
| 13674 |
var onInsert = _ref.onInsert; |
| 13675 |
var props = _objectWithoutProperties$1(_ref, _excluded$6); |
| 13676 |
var codeBlockInput = (0, react.useRef)(null); |
| 13677 |
if (inline) return /*#__PURE__*/ react.default.createElement("code", props); |
| 13678 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, { |
| 13679 |
sx: { position: "relative" }, |
| 13680 |
dir: "ltr" |
| 13681 |
}, /*#__PURE__*/ react.default.createElement(Textarea, _extends$1({ |
| 13682 |
fullWidth: true, |
| 13683 |
ref: codeBlockInput, |
| 13684 |
defaultValue: children[0], |
| 13685 |
sx: { mb: 1 }, |
| 13686 |
helperText: (0, _wordpress_i18n.__)("Code generated by AI may be inaccurate.", "elementor") |
| 13687 |
}, props)), /*#__PURE__*/ react.default.createElement(_elementor_ui.Button, { |
| 13688 |
size: "small", |
| 13689 |
variant: "contained", |
| 13690 |
onClick: function onClick() { |
| 13691 |
return onInsert(defaultValue + "\n" + codeBlockInput.current.value); |
| 13692 |
}, |
| 13693 |
sx: { |
| 13694 |
position: "absolute", |
| 13695 |
right: "11px /* @noflip */", |
| 13696 |
bottom: "44px" |
| 13697 |
} |
| 13698 |
}, (0, _wordpress_i18n.__)("Insert", "elementor"))); |
| 13699 |
}; |
| 13700 |
CodeBlock.propTypes = { |
| 13701 |
node: import_prop_types$2.default.object, |
| 13702 |
inline: import_prop_types$2.default.bool, |
| 13703 |
children: import_prop_types$2.default.arrayOf(import_prop_types$2.default.node).isRequired, |
| 13704 |
defaultValue: import_prop_types$2.default.string, |
| 13705 |
onInsert: import_prop_types$2.default.func.isRequired |
| 13706 |
}; |
| 13707 |
})); |
| 13708 |
|
| 13709 |
//#endregion |
| 13710 |
//#region modules/ai/assets/js/editor/hooks/use-code-prompt.js |
| 13711 |
function ownKeys$7(e, r) { |
| 13712 |
var t = Object.keys(e); |
| 13713 |
if (Object.getOwnPropertySymbols) { |
| 13714 |
var o = Object.getOwnPropertySymbols(e); |
| 13715 |
r && (o = o.filter(function(r) { |
| 13716 |
return Object.getOwnPropertyDescriptor(e, r).enumerable; |
| 13717 |
})), t.push.apply(t, o); |
| 13718 |
} |
| 13719 |
return t; |
| 13720 |
} |
| 13721 |
function _objectSpread$7(e) { |
| 13722 |
for (var r = 1; r < arguments.length; r++) { |
| 13723 |
var t = null != arguments[r] ? arguments[r] : {}; |
| 13724 |
r % 2 ? ownKeys$7(Object(t), !0).forEach(function(r) { |
| 13725 |
_defineProperty$1(e, r, t[r]); |
| 13726 |
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$7(Object(t)).forEach(function(r) { |
| 13727 |
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); |
| 13728 |
}); |
| 13729 |
} |
| 13730 |
return e; |
| 13731 |
} |
| 13732 |
var import_regenerator$1, getCodeResult, useCodePrompt; |
| 13733 |
var init_use_code_prompt = __esmMin((() => { |
| 13734 |
init_defineProperty$1(); |
| 13735 |
init_asyncToGenerator(); |
| 13736 |
import_regenerator$1 = /* @__PURE__ */ __toESM(require_regenerator()); |
| 13737 |
init_api(); |
| 13738 |
init_use_prompt(); |
| 13739 |
__name(ownKeys$7, "ownKeys"); |
| 13740 |
__name(_objectSpread$7, "_objectSpread"); |
| 13741 |
getCodeResult = /*#__PURE__*/ function() { |
| 13742 |
var _ref2 = _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$1.default.mark(function _callee(payload, _ref) { |
| 13743 |
var codeLanguage; |
| 13744 |
var htmlMarkup; |
| 13745 |
var elementId; |
| 13746 |
return import_regenerator$1.default.wrap(function(_context) { |
| 13747 |
while (1) switch (_context.prev = _context.next) { |
| 13748 |
case 0: |
| 13749 |
codeLanguage = _ref.codeLanguage, htmlMarkup = _ref.htmlMarkup, elementId = _ref.elementId; |
| 13750 |
if (!("css" === codeLanguage)) { |
| 13751 |
_context.next = 1; |
| 13752 |
break; |
| 13753 |
} |
| 13754 |
return _context.abrupt("return", getCustomCSS(_objectSpread$7(_objectSpread$7({}, payload), {}, { |
| 13755 |
html_markup: htmlMarkup, |
| 13756 |
element_id: elementId |
| 13757 |
}))); |
| 13758 |
case 1: return _context.abrupt("return", getCustomCode(_objectSpread$7(_objectSpread$7({}, payload), {}, { language: codeLanguage }))); |
| 13759 |
case 2: |
| 13760 |
case "end": return _context.stop(); |
| 13761 |
} |
| 13762 |
}, _callee); |
| 13763 |
})); |
| 13764 |
return function getCodeResult(_x, _x2) { |
| 13765 |
return _ref2.apply(this, arguments); |
| 13766 |
}; |
| 13767 |
}(); |
| 13768 |
useCodePrompt = function useCodePrompt(_ref3) { |
| 13769 |
var codeLanguage = _ref3.codeLanguage; |
| 13770 |
var htmlMarkup = _ref3.htmlMarkup; |
| 13771 |
var elementId = _ref3.elementId; |
| 13772 |
var credits = _ref3.initialCredits; |
| 13773 |
return usePrompt(function(payload) { |
| 13774 |
return getCodeResult(payload, { |
| 13775 |
codeLanguage, |
| 13776 |
htmlMarkup, |
| 13777 |
elementId |
| 13778 |
}); |
| 13779 |
}, { credits }); |
| 13780 |
}; |
| 13781 |
})); |
| 13782 |
|
| 13783 |
//#endregion |
| 13784 |
//#region modules/ai/assets/js/editor/pages/form-code/splitTextResult.js |
| 13785 |
function splitText(inputText) { |
| 13786 |
if (!inputText) return {}; |
| 13787 |
var codeMatch = inputText.match(/```([\s\S]*?)```/); |
| 13788 |
var code = codeMatch ? "```".concat(codeMatch[1], "```").trim() : ""; |
| 13789 |
var detailsMatch = inputText.match(/```[\s\S]*?```([\s\S]*)/); |
| 13790 |
return { |
| 13791 |
code, |
| 13792 |
details: detailsMatch === null || detailsMatch === void 0 ? void 0 : detailsMatch[1].trim() |
| 13793 |
}; |
| 13794 |
} |
| 13795 |
var init_splitTextResult = __esmMin((() => {})); |
| 13796 |
|
| 13797 |
//#endregion |
| 13798 |
//#region node_modules/react-markdown/lib/uri-transformer.js |
| 13799 |
/** |
| 13800 |
* @param {string} uri |
| 13801 |
* @returns {string} |
| 13802 |
*/ |
| 13803 |
function uriTransformer(uri) { |
| 13804 |
const url = (uri || "").trim(); |
| 13805 |
const first = url.charAt(0); |
| 13806 |
if (first === "#" || first === "/") return url; |
| 13807 |
const colon = url.indexOf(":"); |
| 13808 |
if (colon === -1) return url; |
| 13809 |
let index = -1; |
| 13810 |
while (++index < protocols.length) { |
| 13811 |
const protocol = protocols[index]; |
| 13812 |
if (colon === protocol.length && url.slice(0, protocol.length).toLowerCase() === protocol) return url; |
| 13813 |
} |
| 13814 |
index = url.indexOf("?"); |
| 13815 |
if (index !== -1 && colon > index) return url; |
| 13816 |
index = url.indexOf("#"); |
| 13817 |
if (index !== -1 && colon > index) return url; |
| 13818 |
return "javascript:void(0)"; |
| 13819 |
} |
| 13820 |
var protocols; |
| 13821 |
var init_uri_transformer = __esmMin((() => { |
| 13822 |
protocols = [ |
| 13823 |
"http", |
| 13824 |
"https", |
| 13825 |
"mailto", |
| 13826 |
"tel" |
| 13827 |
]; |
| 13828 |
})); |
| 13829 |
|
| 13830 |
//#endregion |
| 13831 |
//#region node_modules/vfile/node_modules/is-buffer/index.js |
| 13832 |
var require_is_buffer$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => { |
| 13833 |
/*! |
| 13834 |
* Determine if an object is a Buffer |
| 13835 |
* |
| 13836 |
* @author Feross Aboukhadijeh <https://feross.org> |
| 13837 |
* @license MIT |
| 13838 |
*/ |
| 13839 |
module.exports = function isBuffer(obj) { |
| 13840 |
return obj != null && obj.constructor != null && typeof obj.constructor.isBuffer === "function" && obj.constructor.isBuffer(obj); |
| 13841 |
}; |
| 13842 |
})); |
| 13843 |
|
| 13844 |
//#endregion |
| 13845 |
//#region node_modules/unist-util-stringify-position/lib/index.js |
| 13846 |
/** |
| 13847 |
* @typedef {import('unist').Node} Node |
| 13848 |
* @typedef {import('unist').Point} Point |
| 13849 |
* @typedef {import('unist').Position} Position |
| 13850 |
*/ |
| 13851 |
/** |
| 13852 |
* @typedef NodeLike |
| 13853 |
* @property {string} type |
| 13854 |
* @property {PositionLike | null | undefined} [position] |
| 13855 |
* |
| 13856 |
* @typedef PositionLike |
| 13857 |
* @property {PointLike | null | undefined} [start] |
| 13858 |
* @property {PointLike | null | undefined} [end] |
| 13859 |
* |
| 13860 |
* @typedef PointLike |
| 13861 |
* @property {number | null | undefined} [line] |
| 13862 |
* @property {number | null | undefined} [column] |
| 13863 |
* @property {number | null | undefined} [offset] |
| 13864 |
*/ |
| 13865 |
/** |
| 13866 |
* Serialize the positional info of a point, position (start and end points), |
| 13867 |
* or node. |
| 13868 |
* |
| 13869 |
* @param {Node | NodeLike | Position | PositionLike | Point | PointLike | null | undefined} [value] |
| 13870 |
* Node, position, or point. |
| 13871 |
* @returns {string} |
| 13872 |
* Pretty printed positional info of a node (`string`). |
| 13873 |
* |
| 13874 |
* In the format of a range `ls:cs-le:ce` (when given `node` or `position`) |
| 13875 |
* or a point `l:c` (when given `point`), where `l` stands for line, `c` for |
| 13876 |
* column, `s` for `start`, and `e` for end. |
| 13877 |
* An empty string (`''`) is returned if the given value is neither `node`, |
| 13878 |
* `position`, nor `point`. |
| 13879 |
*/ |
| 13880 |
function stringifyPosition(value) { |
| 13881 |
if (!value || typeof value !== "object") return ""; |
| 13882 |
if ("position" in value || "type" in value) return position$1(value.position); |
| 13883 |
if ("start" in value || "end" in value) return position$1(value); |
| 13884 |
if ("line" in value || "column" in value) return point$2(value); |
| 13885 |
return ""; |
| 13886 |
} |
| 13887 |
/** |
| 13888 |
* @param {Point | PointLike | null | undefined} point |
| 13889 |
* @returns {string} |
| 13890 |
*/ |
| 13891 |
function point$2(point) { |
| 13892 |
return index(point && point.line) + ":" + index(point && point.column); |
| 13893 |
} |
| 13894 |
/** |
| 13895 |
* @param {Position | PositionLike | null | undefined} pos |
| 13896 |
* @returns {string} |
| 13897 |
*/ |
| 13898 |
function position$1(pos) { |
| 13899 |
return point$2(pos && pos.start) + "-" + point$2(pos && pos.end); |
| 13900 |
} |
| 13901 |
/** |
| 13902 |
* @param {number | null | undefined} value |
| 13903 |
* @returns {number} |
| 13904 |
*/ |
| 13905 |
function index(value) { |
| 13906 |
return value && typeof value === "number" ? value : 1; |
| 13907 |
} |
| 13908 |
var init_lib$15 = __esmMin((() => { |
| 13909 |
__name(point$2, "point"); |
| 13910 |
__name(position$1, "position"); |
| 13911 |
})); |
| 13912 |
|
| 13913 |
//#endregion |
| 13914 |
//#region node_modules/unist-util-stringify-position/index.js |
| 13915 |
var init_unist_util_stringify_position = __esmMin((() => { |
| 13916 |
init_lib$15(); |
| 13917 |
})); |
| 13918 |
|
| 13919 |
//#endregion |
| 13920 |
//#region node_modules/vfile-message/lib/index.js |
| 13921 |
var VFileMessage; |
| 13922 |
var init_lib$14 = __esmMin((() => { |
| 13923 |
init_unist_util_stringify_position(); |
| 13924 |
VFileMessage = class extends Error { |
| 13925 |
/** |
| 13926 |
* Create a message for `reason` at `place` from `origin`. |
| 13927 |
* |
| 13928 |
* When an error is passed in as `reason`, the `stack` is copied. |
| 13929 |
* |
| 13930 |
* @param {string | Error | VFileMessage} reason |
| 13931 |
* Reason for message, uses the stack and message of the error if given. |
| 13932 |
* |
| 13933 |
* > 👉 **Note**: you should use markdown. |
| 13934 |
* @param {Node | NodeLike | Position | Point | null | undefined} [place] |
| 13935 |
* Place in file where the message occurred. |
| 13936 |
* @param {string | null | undefined} [origin] |
| 13937 |
* Place in code where the message originates (example: |
| 13938 |
* `'my-package:my-rule'` or `'my-rule'`). |
| 13939 |
* @returns |
| 13940 |
* Instance of `VFileMessage`. |
| 13941 |
*/ |
| 13942 |
constructor(reason, place, origin) { |
| 13943 |
/** @type {[string | null, string | null]} */ |
| 13944 |
const parts = [null, null]; |
| 13945 |
/** @type {Position} */ |
| 13946 |
let position = { |
| 13947 |
start: { |
| 13948 |
line: null, |
| 13949 |
column: null |
| 13950 |
}, |
| 13951 |
end: { |
| 13952 |
line: null, |
| 13953 |
column: null |
| 13954 |
} |
| 13955 |
}; |
| 13956 |
super(); |
| 13957 |
if (typeof place === "string") { |
| 13958 |
origin = place; |
| 13959 |
place = void 0; |
| 13960 |
} |
| 13961 |
if (typeof origin === "string") { |
| 13962 |
const index = origin.indexOf(":"); |
| 13963 |
if (index === -1) parts[1] = origin; |
| 13964 |
else { |
| 13965 |
parts[0] = origin.slice(0, index); |
| 13966 |
parts[1] = origin.slice(index + 1); |
| 13967 |
} |
| 13968 |
} |
| 13969 |
if (place) { |
| 13970 |
if ("type" in place || "position" in place) { |
| 13971 |
if (place.position) position = place.position; |
| 13972 |
} else if ("start" in place || "end" in place) position = place; |
| 13973 |
else if ("line" in place || "column" in place) position.start = place; |
| 13974 |
} |
| 13975 |
/** |
| 13976 |
* Serialized positional info of error. |
| 13977 |
* |
| 13978 |
* On normal errors, this would be something like `ParseError`, buit in |
| 13979 |
* `VFile` messages we use this space to show where an error happened. |
| 13980 |
*/ |
| 13981 |
this.name = stringifyPosition(place) || "1:1"; |
| 13982 |
/** |
| 13983 |
* Reason for message. |
| 13984 |
* |
| 13985 |
* @type {string} |
| 13986 |
*/ |
| 13987 |
this.message = typeof reason === "object" ? reason.message : reason; |
| 13988 |
/** |
| 13989 |
* Stack of message. |
| 13990 |
* |
| 13991 |
* This is used by normal errors to show where something happened in |
| 13992 |
* programming code, irrelevant for `VFile` messages, |
| 13993 |
* |
| 13994 |
* @type {string} |
| 13995 |
*/ |
| 13996 |
this.stack = ""; |
| 13997 |
if (typeof reason === "object" && reason.stack) this.stack = reason.stack; |
| 13998 |
/** |
| 13999 |
* Reason for message. |
| 14000 |
* |
| 14001 |
* > 👉 **Note**: you should use markdown. |
| 14002 |
* |
| 14003 |
* @type {string} |
| 14004 |
*/ |
| 14005 |
this.reason = this.message; |
| 14006 |
/** |
| 14007 |
* State of problem. |
| 14008 |
* |
| 14009 |
* * `true` — marks associated file as no longer processable (error) |
| 14010 |
* * `false` — necessitates a (potential) change (warning) |
| 14011 |
* * `null | undefined` — for things that might not need changing (info) |
| 14012 |
* |
| 14013 |
* @type {boolean | null | undefined} |
| 14014 |
*/ |
| 14015 |
this.fatal; |
| 14016 |
/** |
| 14017 |
* Starting line of error. |
| 14018 |
* |
| 14019 |
* @type {number | null} |
| 14020 |
*/ |
| 14021 |
this.line = position.start.line; |
| 14022 |
/** |
| 14023 |
* Starting column of error. |
| 14024 |
* |
| 14025 |
* @type {number | null} |
| 14026 |
*/ |
| 14027 |
this.column = position.start.column; |
| 14028 |
/** |
| 14029 |
* Full unist position. |
| 14030 |
* |
| 14031 |
* @type {Position | null} |
| 14032 |
*/ |
| 14033 |
this.position = position; |
| 14034 |
/** |
| 14035 |
* Namespace of message (example: `'my-package'`). |
| 14036 |
* |
| 14037 |
* @type {string | null} |
| 14038 |
*/ |
| 14039 |
this.source = parts[0]; |
| 14040 |
/** |
| 14041 |
* Category of message (example: `'my-rule'`). |
| 14042 |
* |
| 14043 |
* @type {string | null} |
| 14044 |
*/ |
| 14045 |
this.ruleId = parts[1]; |
| 14046 |
/** |
| 14047 |
* Path of a file (used throughout the `VFile` ecosystem). |
| 14048 |
* |
| 14049 |
* @type {string | null} |
| 14050 |
*/ |
| 14051 |
this.file; |
| 14052 |
/** |
| 14053 |
* Specify the source value that’s being reported, which is deemed |
| 14054 |
* incorrect. |
| 14055 |
* |
| 14056 |
* @type {string | null} |
| 14057 |
*/ |
| 14058 |
this.actual; |
| 14059 |
/** |
| 14060 |
* Suggest acceptable values that can be used instead of `actual`. |
| 14061 |
* |
| 14062 |
* @type {Array<string> | null} |
| 14063 |
*/ |
| 14064 |
this.expected; |
| 14065 |
/** |
| 14066 |
* Link to docs for the message. |
| 14067 |
* |
| 14068 |
* > 👉 **Note**: this must be an absolute URL that can be passed as `x` |
| 14069 |
* > to `new URL(x)`. |
| 14070 |
* |
| 14071 |
* @type {string | null} |
| 14072 |
*/ |
| 14073 |
this.url; |
| 14074 |
/** |
| 14075 |
* Long form description of the message (you should use markdown). |
| 14076 |
* |
| 14077 |
* @type {string | null} |
| 14078 |
*/ |
| 14079 |
this.note; |
| 14080 |
} |
| 14081 |
}; |
| 14082 |
VFileMessage.prototype.file = ""; |
| 14083 |
VFileMessage.prototype.name = ""; |
| 14084 |
VFileMessage.prototype.reason = ""; |
| 14085 |
VFileMessage.prototype.message = ""; |
| 14086 |
VFileMessage.prototype.stack = ""; |
| 14087 |
VFileMessage.prototype.fatal = null; |
| 14088 |
VFileMessage.prototype.column = null; |
| 14089 |
VFileMessage.prototype.line = null; |
| 14090 |
VFileMessage.prototype.source = null; |
| 14091 |
VFileMessage.prototype.ruleId = null; |
| 14092 |
VFileMessage.prototype.position = null; |
| 14093 |
})); |
| 14094 |
|
| 14095 |
//#endregion |
| 14096 |
//#region node_modules/vfile-message/index.js |
| 14097 |
var init_vfile_message = __esmMin((() => { |
| 14098 |
init_lib$14(); |
| 14099 |
})); |
| 14100 |
|
| 14101 |
//#endregion |
| 14102 |
//#region node_modules/vfile/lib/minpath.browser.js |
| 14103 |
/** |
| 14104 |
* Get the basename from a path. |
| 14105 |
* |
| 14106 |
* @param {string} path |
| 14107 |
* File path. |
| 14108 |
* @param {string | undefined} [ext] |
| 14109 |
* Extension to strip. |
| 14110 |
* @returns {string} |
| 14111 |
* Stem or basename. |
| 14112 |
*/ |
| 14113 |
function basename(path, ext) { |
| 14114 |
if (ext !== void 0 && typeof ext !== "string") throw new TypeError("\"ext\" argument must be a string"); |
| 14115 |
assertPath$1(path); |
| 14116 |
let start = 0; |
| 14117 |
let end = -1; |
| 14118 |
let index = path.length; |
| 14119 |
/** @type {boolean | undefined} */ |
| 14120 |
let seenNonSlash; |
| 14121 |
if (ext === void 0 || ext.length === 0 || ext.length > path.length) { |
| 14122 |
while (index--) if (path.charCodeAt(index) === 47) { |
| 14123 |
if (seenNonSlash) { |
| 14124 |
start = index + 1; |
| 14125 |
break; |
| 14126 |
} |
| 14127 |
} else if (end < 0) { |
| 14128 |
seenNonSlash = true; |
| 14129 |
end = index + 1; |
| 14130 |
} |
| 14131 |
return end < 0 ? "" : path.slice(start, end); |
| 14132 |
} |
| 14133 |
if (ext === path) return ""; |
| 14134 |
let firstNonSlashEnd = -1; |
| 14135 |
let extIndex = ext.length - 1; |
| 14136 |
while (index--) if (path.charCodeAt(index) === 47) { |
| 14137 |
if (seenNonSlash) { |
| 14138 |
start = index + 1; |
| 14139 |
break; |
| 14140 |
} |
| 14141 |
} else { |
| 14142 |
if (firstNonSlashEnd < 0) { |
| 14143 |
seenNonSlash = true; |
| 14144 |
firstNonSlashEnd = index + 1; |
| 14145 |
} |
| 14146 |
if (extIndex > -1) if (path.charCodeAt(index) === ext.charCodeAt(extIndex--)) { |
| 14147 |
if (extIndex < 0) end = index; |
| 14148 |
} else { |
| 14149 |
extIndex = -1; |
| 14150 |
end = firstNonSlashEnd; |
| 14151 |
} |
| 14152 |
} |
| 14153 |
if (start === end) end = firstNonSlashEnd; |
| 14154 |
else if (end < 0) end = path.length; |
| 14155 |
return path.slice(start, end); |
| 14156 |
} |
| 14157 |
/** |
| 14158 |
* Get the dirname from a path. |
| 14159 |
* |
| 14160 |
* @param {string} path |
| 14161 |
* File path. |
| 14162 |
* @returns {string} |
| 14163 |
* File path. |
| 14164 |
*/ |
| 14165 |
function dirname(path) { |
| 14166 |
assertPath$1(path); |
| 14167 |
if (path.length === 0) return "."; |
| 14168 |
let end = -1; |
| 14169 |
let index = path.length; |
| 14170 |
/** @type {boolean | undefined} */ |
| 14171 |
let unmatchedSlash; |
| 14172 |
while (--index) if (path.charCodeAt(index) === 47) { |
| 14173 |
if (unmatchedSlash) { |
| 14174 |
end = index; |
| 14175 |
break; |
| 14176 |
} |
| 14177 |
} else if (!unmatchedSlash) unmatchedSlash = true; |
| 14178 |
return end < 0 ? path.charCodeAt(0) === 47 ? "/" : "." : end === 1 && path.charCodeAt(0) === 47 ? "//" : path.slice(0, end); |
| 14179 |
} |
| 14180 |
/** |
| 14181 |
* Get an extname from a path. |
| 14182 |
* |
| 14183 |
* @param {string} path |
| 14184 |
* File path. |
| 14185 |
* @returns {string} |
| 14186 |
* Extname. |
| 14187 |
*/ |
| 14188 |
function extname(path) { |
| 14189 |
assertPath$1(path); |
| 14190 |
let index = path.length; |
| 14191 |
let end = -1; |
| 14192 |
let startPart = 0; |
| 14193 |
let startDot = -1; |
| 14194 |
let preDotState = 0; |
| 14195 |
/** @type {boolean | undefined} */ |
| 14196 |
let unmatchedSlash; |
| 14197 |
while (index--) { |
| 14198 |
const code = path.charCodeAt(index); |
| 14199 |
if (code === 47) { |
| 14200 |
if (unmatchedSlash) { |
| 14201 |
startPart = index + 1; |
| 14202 |
break; |
| 14203 |
} |
| 14204 |
continue; |
| 14205 |
} |
| 14206 |
if (end < 0) { |
| 14207 |
unmatchedSlash = true; |
| 14208 |
end = index + 1; |
| 14209 |
} |
| 14210 |
if (code === 46) { |
| 14211 |
if (startDot < 0) startDot = index; |
| 14212 |
else if (preDotState !== 1) preDotState = 1; |
| 14213 |
} else if (startDot > -1) preDotState = -1; |
| 14214 |
} |
| 14215 |
if (startDot < 0 || end < 0 || preDotState === 0 || preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) return ""; |
| 14216 |
return path.slice(startDot, end); |
| 14217 |
} |
| 14218 |
/** |
| 14219 |
* Join segments from a path. |
| 14220 |
* |
| 14221 |
* @param {Array<string>} segments |
| 14222 |
* Path segments. |
| 14223 |
* @returns {string} |
| 14224 |
* File path. |
| 14225 |
*/ |
| 14226 |
function join(...segments) { |
| 14227 |
let index = -1; |
| 14228 |
/** @type {string | undefined} */ |
| 14229 |
let joined; |
| 14230 |
while (++index < segments.length) { |
| 14231 |
assertPath$1(segments[index]); |
| 14232 |
if (segments[index]) joined = joined === void 0 ? segments[index] : joined + "/" + segments[index]; |
| 14233 |
} |
| 14234 |
return joined === void 0 ? "." : normalize$1(joined); |
| 14235 |
} |
| 14236 |
/** |
| 14237 |
* Normalize a basic file path. |
| 14238 |
* |
| 14239 |
* @param {string} path |
| 14240 |
* File path. |
| 14241 |
* @returns {string} |
| 14242 |
* File path. |
| 14243 |
*/ |
| 14244 |
function normalize$1(path) { |
| 14245 |
assertPath$1(path); |
| 14246 |
const absolute = path.charCodeAt(0) === 47; |
| 14247 |
let value = normalizeString(path, !absolute); |
| 14248 |
if (value.length === 0 && !absolute) value = "."; |
| 14249 |
if (value.length > 0 && path.charCodeAt(path.length - 1) === 47) value += "/"; |
| 14250 |
return absolute ? "/" + value : value; |
| 14251 |
} |
| 14252 |
/** |
| 14253 |
* Resolve `.` and `..` elements in a path with directory names. |
| 14254 |
* |
| 14255 |
* @param {string} path |
| 14256 |
* File path. |
| 14257 |
* @param {boolean} allowAboveRoot |
| 14258 |
* Whether `..` can move above root. |
| 14259 |
* @returns {string} |
| 14260 |
* File path. |
| 14261 |
*/ |
| 14262 |
function normalizeString(path, allowAboveRoot) { |
| 14263 |
let result = ""; |
| 14264 |
let lastSegmentLength = 0; |
| 14265 |
let lastSlash = -1; |
| 14266 |
let dots = 0; |
| 14267 |
let index = -1; |
| 14268 |
/** @type {number | undefined} */ |
| 14269 |
let code; |
| 14270 |
/** @type {number} */ |
| 14271 |
let lastSlashIndex; |
| 14272 |
while (++index <= path.length) { |
| 14273 |
if (index < path.length) code = path.charCodeAt(index); |
| 14274 |
else if (code === 47) break; |
| 14275 |
else code = 47; |
| 14276 |
if (code === 47) { |
| 14277 |
if (lastSlash === index - 1 || dots === 1) {} else if (lastSlash !== index - 1 && dots === 2) { |
| 14278 |
if (result.length < 2 || lastSegmentLength !== 2 || result.charCodeAt(result.length - 1) !== 46 || result.charCodeAt(result.length - 2) !== 46) { |
| 14279 |
if (result.length > 2) { |
| 14280 |
lastSlashIndex = result.lastIndexOf("/"); |
| 14281 |
if (lastSlashIndex !== result.length - 1) { |
| 14282 |
if (lastSlashIndex < 0) { |
| 14283 |
result = ""; |
| 14284 |
lastSegmentLength = 0; |
| 14285 |
} else { |
| 14286 |
result = result.slice(0, lastSlashIndex); |
| 14287 |
lastSegmentLength = result.length - 1 - result.lastIndexOf("/"); |
| 14288 |
} |
| 14289 |
lastSlash = index; |
| 14290 |
dots = 0; |
| 14291 |
continue; |
| 14292 |
} |
| 14293 |
} else if (result.length > 0) { |
| 14294 |
result = ""; |
| 14295 |
lastSegmentLength = 0; |
| 14296 |
lastSlash = index; |
| 14297 |
dots = 0; |
| 14298 |
continue; |
| 14299 |
} |
| 14300 |
} |
| 14301 |
if (allowAboveRoot) { |
| 14302 |
result = result.length > 0 ? result + "/.." : ".."; |
| 14303 |
lastSegmentLength = 2; |
| 14304 |
} |
| 14305 |
} else { |
| 14306 |
if (result.length > 0) result += "/" + path.slice(lastSlash + 1, index); |
| 14307 |
else result = path.slice(lastSlash + 1, index); |
| 14308 |
lastSegmentLength = index - lastSlash - 1; |
| 14309 |
} |
| 14310 |
lastSlash = index; |
| 14311 |
dots = 0; |
| 14312 |
} else if (code === 46 && dots > -1) dots++; |
| 14313 |
else dots = -1; |
| 14314 |
} |
| 14315 |
return result; |
| 14316 |
} |
| 14317 |
/** |
| 14318 |
* Make sure `path` is a string. |
| 14319 |
* |
| 14320 |
* @param {string} path |
| 14321 |
* File path. |
| 14322 |
* @returns {asserts path is string} |
| 14323 |
* Nothing. |
| 14324 |
*/ |
| 14325 |
function assertPath$1(path) { |
| 14326 |
if (typeof path !== "string") throw new TypeError("Path must be a string. Received " + JSON.stringify(path)); |
| 14327 |
} |
| 14328 |
var path; |
| 14329 |
var init_minpath_browser = __esmMin((() => { |
| 14330 |
path = { |
| 14331 |
basename, |
| 14332 |
dirname, |
| 14333 |
extname, |
| 14334 |
join, |
| 14335 |
sep: "/" |
| 14336 |
}; |
| 14337 |
__name(normalize$1, "normalize"); |
| 14338 |
__name(assertPath$1, "assertPath"); |
| 14339 |
})); |
| 14340 |
|
| 14341 |
//#endregion |
| 14342 |
//#region node_modules/vfile/lib/minproc.browser.js |
| 14343 |
function cwd() { |
| 14344 |
return "/"; |
| 14345 |
} |
| 14346 |
var proc; |
| 14347 |
var init_minproc_browser = __esmMin((() => { |
| 14348 |
proc = { cwd }; |
| 14349 |
})); |
| 14350 |
|
| 14351 |
//#endregion |
| 14352 |
//#region node_modules/vfile/lib/minurl.shared.js |
| 14353 |
/** |
| 14354 |
* @typedef URL |
| 14355 |
* @property {string} hash |
| 14356 |
* @property {string} host |
| 14357 |
* @property {string} hostname |
| 14358 |
* @property {string} href |
| 14359 |
* @property {string} origin |
| 14360 |
* @property {string} password |
| 14361 |
* @property {string} pathname |
| 14362 |
* @property {string} port |
| 14363 |
* @property {string} protocol |
| 14364 |
* @property {string} search |
| 14365 |
* @property {any} searchParams |
| 14366 |
* @property {string} username |
| 14367 |
* @property {() => string} toString |
| 14368 |
* @property {() => string} toJSON |
| 14369 |
*/ |
| 14370 |
/** |
| 14371 |
* Check if `fileUrlOrPath` looks like a URL. |
| 14372 |
* |
| 14373 |
* @param {unknown} fileUrlOrPath |
| 14374 |
* File path or URL. |
| 14375 |
* @returns {fileUrlOrPath is URL} |
| 14376 |
* Whether it’s a URL. |
| 14377 |
*/ |
| 14378 |
function isUrl(fileUrlOrPath) { |
| 14379 |
return fileUrlOrPath !== null && typeof fileUrlOrPath === "object" && fileUrlOrPath.href && fileUrlOrPath.origin; |
| 14380 |
} |
| 14381 |
var init_minurl_shared = __esmMin((() => {})); |
| 14382 |
|
| 14383 |
//#endregion |
| 14384 |
//#region node_modules/vfile/lib/minurl.browser.js |
| 14385 |
/** |
| 14386 |
* @param {string | URL} path |
| 14387 |
* File URL. |
| 14388 |
* @returns {string} |
| 14389 |
* File URL. |
| 14390 |
*/ |
| 14391 |
function urlToPath(path) { |
| 14392 |
if (typeof path === "string") path = new URL(path); |
| 14393 |
else if (!isUrl(path)) { |
| 14394 |
/** @type {NodeJS.ErrnoException} */ |
| 14395 |
const error = /* @__PURE__ */ new TypeError("The \"path\" argument must be of type string or an instance of URL. Received `" + path + "`"); |
| 14396 |
error.code = "ERR_INVALID_ARG_TYPE"; |
| 14397 |
throw error; |
| 14398 |
} |
| 14399 |
if (path.protocol !== "file:") { |
| 14400 |
/** @type {NodeJS.ErrnoException} */ |
| 14401 |
const error = /* @__PURE__ */ new TypeError("The URL must be of scheme file"); |
| 14402 |
error.code = "ERR_INVALID_URL_SCHEME"; |
| 14403 |
throw error; |
| 14404 |
} |
| 14405 |
return getPathFromURLPosix(path); |
| 14406 |
} |
| 14407 |
/** |
| 14408 |
* Get a path from a POSIX URL. |
| 14409 |
* |
| 14410 |
* @param {URL} url |
| 14411 |
* URL. |
| 14412 |
* @returns {string} |
| 14413 |
* File path. |
| 14414 |
*/ |
| 14415 |
function getPathFromURLPosix(url) { |
| 14416 |
if (url.hostname !== "") { |
| 14417 |
/** @type {NodeJS.ErrnoException} */ |
| 14418 |
const error = /* @__PURE__ */ new TypeError("File URL host must be \"localhost\" or empty on darwin"); |
| 14419 |
error.code = "ERR_INVALID_FILE_URL_HOST"; |
| 14420 |
throw error; |
| 14421 |
} |
| 14422 |
const pathname = url.pathname; |
| 14423 |
let index = -1; |
| 14424 |
while (++index < pathname.length) if (pathname.charCodeAt(index) === 37 && pathname.charCodeAt(index + 1) === 50) { |
| 14425 |
const third = pathname.charCodeAt(index + 2); |
| 14426 |
if (third === 70 || third === 102) { |
| 14427 |
/** @type {NodeJS.ErrnoException} */ |
| 14428 |
const error = /* @__PURE__ */ new TypeError("File URL path must not include encoded / characters"); |
| 14429 |
error.code = "ERR_INVALID_FILE_URL_PATH"; |
| 14430 |
throw error; |
| 14431 |
} |
| 14432 |
} |
| 14433 |
return decodeURIComponent(pathname); |
| 14434 |
} |
| 14435 |
var init_minurl_browser = __esmMin((() => { |
| 14436 |
init_minurl_shared(); |
| 14437 |
})); |
| 14438 |
|
| 14439 |
//#endregion |
| 14440 |
//#region node_modules/vfile/lib/index.js |
| 14441 |
/** |
| 14442 |
* Assert that `part` is not a path (as in, does not contain `path.sep`). |
| 14443 |
* |
| 14444 |
* @param {string | null | undefined} part |
| 14445 |
* File path part. |
| 14446 |
* @param {string} name |
| 14447 |
* Part name. |
| 14448 |
* @returns {void} |
| 14449 |
* Nothing. |
| 14450 |
*/ |
| 14451 |
function assertPart(part, name) { |
| 14452 |
if (part && part.includes(path.sep)) throw new Error("`" + name + "` cannot be a path: did not expect `" + path.sep + "`"); |
| 14453 |
} |
| 14454 |
/** |
| 14455 |
* Assert that `part` is not empty. |
| 14456 |
* |
| 14457 |
* @param {string | undefined} part |
| 14458 |
* Thing. |
| 14459 |
* @param {string} name |
| 14460 |
* Part name. |
| 14461 |
* @returns {asserts part is string} |
| 14462 |
* Nothing. |
| 14463 |
*/ |
| 14464 |
function assertNonEmpty(part, name) { |
| 14465 |
if (!part) throw new Error("`" + name + "` cannot be empty"); |
| 14466 |
} |
| 14467 |
/** |
| 14468 |
* Assert `path` exists. |
| 14469 |
* |
| 14470 |
* @param {string | undefined} path |
| 14471 |
* Path. |
| 14472 |
* @param {string} name |
| 14473 |
* Dependency name. |
| 14474 |
* @returns {asserts path is string} |
| 14475 |
* Nothing. |
| 14476 |
*/ |
| 14477 |
function assertPath(path, name) { |
| 14478 |
if (!path) throw new Error("Setting `" + name + "` requires `path` to be set too"); |
| 14479 |
} |
| 14480 |
/** |
| 14481 |
* Assert `value` is a buffer. |
| 14482 |
* |
| 14483 |
* @param {unknown} value |
| 14484 |
* thing. |
| 14485 |
* @returns {value is Buffer} |
| 14486 |
* Whether `value` is a Node.js buffer. |
| 14487 |
*/ |
| 14488 |
function buffer(value) { |
| 14489 |
return (0, import_is_buffer$1.default)(value); |
| 14490 |
} |
| 14491 |
var import_is_buffer$1, order, VFile; |
| 14492 |
var init_lib$13 = __esmMin((() => { |
| 14493 |
import_is_buffer$1 = /* @__PURE__ */ __toESM(require_is_buffer$1(), 1); |
| 14494 |
init_vfile_message(); |
| 14495 |
init_minpath_browser(); |
| 14496 |
init_minproc_browser(); |
| 14497 |
init_minurl_browser(); |
| 14498 |
order = [ |
| 14499 |
"history", |
| 14500 |
"path", |
| 14501 |
"basename", |
| 14502 |
"stem", |
| 14503 |
"extname", |
| 14504 |
"dirname" |
| 14505 |
]; |
| 14506 |
VFile = class { |
| 14507 |
/** |
| 14508 |
* Create a new virtual file. |
| 14509 |
* |
| 14510 |
* `options` is treated as: |
| 14511 |
* |
| 14512 |
* * `string` or `Buffer` — `{value: options}` |
| 14513 |
* * `URL` — `{path: options}` |
| 14514 |
* * `VFile` — shallow copies its data over to the new file |
| 14515 |
* * `object` — all fields are shallow copied over to the new file |
| 14516 |
* |
| 14517 |
* Path related fields are set in the following order (least specific to |
| 14518 |
* most specific): `history`, `path`, `basename`, `stem`, `extname`, |
| 14519 |
* `dirname`. |
| 14520 |
* |
| 14521 |
* You cannot set `dirname` or `extname` without setting either `history`, |
| 14522 |
* `path`, `basename`, or `stem` too. |
| 14523 |
* |
| 14524 |
* @param {Compatible | null | undefined} [value] |
| 14525 |
* File value. |
| 14526 |
* @returns |
| 14527 |
* New instance. |
| 14528 |
*/ |
| 14529 |
constructor(value) { |
| 14530 |
/** @type {Options | VFile} */ |
| 14531 |
let options; |
| 14532 |
if (!value) options = {}; |
| 14533 |
else if (typeof value === "string" || buffer(value)) options = { value }; |
| 14534 |
else if (isUrl(value)) options = { path: value }; |
| 14535 |
else options = value; |
| 14536 |
/** |
| 14537 |
* Place to store custom information (default: `{}`). |
| 14538 |
* |
| 14539 |
* It’s OK to store custom data directly on the file but moving it to |
| 14540 |
* `data` is recommended. |
| 14541 |
* |
| 14542 |
* @type {Data} |
| 14543 |
*/ |
| 14544 |
this.data = {}; |
| 14545 |
/** |
| 14546 |
* List of messages associated with the file. |
| 14547 |
* |
| 14548 |
* @type {Array<VFileMessage>} |
| 14549 |
*/ |
| 14550 |
this.messages = []; |
| 14551 |
/** |
| 14552 |
* List of filepaths the file moved between. |
| 14553 |
* |
| 14554 |
* The first is the original path and the last is the current path. |
| 14555 |
* |
| 14556 |
* @type {Array<string>} |
| 14557 |
*/ |
| 14558 |
this.history = []; |
| 14559 |
/** |
| 14560 |
* Base of `path` (default: `process.cwd()` or `'/'` in browsers). |
| 14561 |
* |
| 14562 |
* @type {string} |
| 14563 |
*/ |
| 14564 |
this.cwd = proc.cwd(); |
| 14565 |
/** |
| 14566 |
* Raw value. |
| 14567 |
* |
| 14568 |
* @type {Value} |
| 14569 |
*/ |
| 14570 |
this.value; |
| 14571 |
/** |
| 14572 |
* Whether a file was saved to disk. |
| 14573 |
* |
| 14574 |
* This is used by vfile reporters. |
| 14575 |
* |
| 14576 |
* @type {boolean} |
| 14577 |
*/ |
| 14578 |
this.stored; |
| 14579 |
/** |
| 14580 |
* Custom, non-string, compiled, representation. |
| 14581 |
* |
| 14582 |
* This is used by unified to store non-string results. |
| 14583 |
* One example is when turning markdown into React nodes. |
| 14584 |
* |
| 14585 |
* @type {unknown} |
| 14586 |
*/ |
| 14587 |
this.result; |
| 14588 |
/** |
| 14589 |
* Source map. |
| 14590 |
* |
| 14591 |
* This type is equivalent to the `RawSourceMap` type from the `source-map` |
| 14592 |
* module. |
| 14593 |
* |
| 14594 |
* @type {Map | null | undefined} |
| 14595 |
*/ |
| 14596 |
this.map; |
| 14597 |
let index = -1; |
| 14598 |
while (++index < order.length) { |
| 14599 |
const prop = order[index]; |
| 14600 |
if (prop in options && options[prop] !== void 0 && options[prop] !== null) this[prop] = prop === "history" ? [...options[prop]] : options[prop]; |
| 14601 |
} |
| 14602 |
/** @type {string} */ |
| 14603 |
let prop; |
| 14604 |
for (prop in options) if (!order.includes(prop)) this[prop] = options[prop]; |
| 14605 |
} |
| 14606 |
/** |
| 14607 |
* Get the full path (example: `'~/index.min.js'`). |
| 14608 |
* |
| 14609 |
* @returns {string} |
| 14610 |
*/ |
| 14611 |
get path() { |
| 14612 |
return this.history[this.history.length - 1]; |
| 14613 |
} |
| 14614 |
/** |
| 14615 |
* Set the full path (example: `'~/index.min.js'`). |
| 14616 |
* |
| 14617 |
* Cannot be nullified. |
| 14618 |
* You can set a file URL (a `URL` object with a `file:` protocol) which will |
| 14619 |
* be turned into a path with `url.fileURLToPath`. |
| 14620 |
* |
| 14621 |
* @param {string | URL} path |
| 14622 |
*/ |
| 14623 |
set path(path) { |
| 14624 |
if (isUrl(path)) path = urlToPath(path); |
| 14625 |
assertNonEmpty(path, "path"); |
| 14626 |
if (this.path !== path) this.history.push(path); |
| 14627 |
} |
| 14628 |
/** |
| 14629 |
* Get the parent path (example: `'~'`). |
| 14630 |
*/ |
| 14631 |
get dirname() { |
| 14632 |
return typeof this.path === "string" ? path.dirname(this.path) : void 0; |
| 14633 |
} |
| 14634 |
/** |
| 14635 |
* Set the parent path (example: `'~'`). |
| 14636 |
* |
| 14637 |
* Cannot be set if there’s no `path` yet. |
| 14638 |
*/ |
| 14639 |
set dirname(dirname) { |
| 14640 |
assertPath(this.basename, "dirname"); |
| 14641 |
this.path = path.join(dirname || "", this.basename); |
| 14642 |
} |
| 14643 |
/** |
| 14644 |
* Get the basename (including extname) (example: `'index.min.js'`). |
| 14645 |
*/ |
| 14646 |
get basename() { |
| 14647 |
return typeof this.path === "string" ? path.basename(this.path) : void 0; |
| 14648 |
} |
| 14649 |
/** |
| 14650 |
* Set basename (including extname) (`'index.min.js'`). |
| 14651 |
* |
| 14652 |
* Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\'` |
| 14653 |
* on windows). |
| 14654 |
* Cannot be nullified (use `file.path = file.dirname` instead). |
| 14655 |
*/ |
| 14656 |
set basename(basename) { |
| 14657 |
assertNonEmpty(basename, "basename"); |
| 14658 |
assertPart(basename, "basename"); |
| 14659 |
this.path = path.join(this.dirname || "", basename); |
| 14660 |
} |
| 14661 |
/** |
| 14662 |
* Get the extname (including dot) (example: `'.js'`). |
| 14663 |
*/ |
| 14664 |
get extname() { |
| 14665 |
return typeof this.path === "string" ? path.extname(this.path) : void 0; |
| 14666 |
} |
| 14667 |
/** |
| 14668 |
* Set the extname (including dot) (example: `'.js'`). |
| 14669 |
* |
| 14670 |
* Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\'` |
| 14671 |
* on windows). |
| 14672 |
* Cannot be set if there’s no `path` yet. |
| 14673 |
*/ |
| 14674 |
set extname(extname) { |
| 14675 |
assertPart(extname, "extname"); |
| 14676 |
assertPath(this.dirname, "extname"); |
| 14677 |
if (extname) { |
| 14678 |
if (extname.charCodeAt(0) !== 46) throw new Error("`extname` must start with `.`"); |
| 14679 |
if (extname.includes(".", 1)) throw new Error("`extname` cannot contain multiple dots"); |
| 14680 |
} |
| 14681 |
this.path = path.join(this.dirname, this.stem + (extname || "")); |
| 14682 |
} |
| 14683 |
/** |
| 14684 |
* Get the stem (basename w/o extname) (example: `'index.min'`). |
| 14685 |
*/ |
| 14686 |
get stem() { |
| 14687 |
return typeof this.path === "string" ? path.basename(this.path, this.extname) : void 0; |
| 14688 |
} |
| 14689 |
/** |
| 14690 |
* Set the stem (basename w/o extname) (example: `'index.min'`). |
| 14691 |
* |
| 14692 |
* Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\'` |
| 14693 |
* on windows). |
| 14694 |
* Cannot be nullified (use `file.path = file.dirname` instead). |
| 14695 |
*/ |
| 14696 |
set stem(stem) { |
| 14697 |
assertNonEmpty(stem, "stem"); |
| 14698 |
assertPart(stem, "stem"); |
| 14699 |
this.path = path.join(this.dirname || "", stem + (this.extname || "")); |
| 14700 |
} |
| 14701 |
/** |
| 14702 |
* Serialize the file. |
| 14703 |
* |
| 14704 |
* @param {BufferEncoding | null | undefined} [encoding='utf8'] |
| 14705 |
* Character encoding to understand `value` as when it’s a `Buffer` |
| 14706 |
* (default: `'utf8'`). |
| 14707 |
* @returns {string} |
| 14708 |
* Serialized file. |
| 14709 |
*/ |
| 14710 |
toString(encoding) { |
| 14711 |
return (this.value || "").toString(encoding || void 0); |
| 14712 |
} |
| 14713 |
/** |
| 14714 |
* Create a warning message associated with the file. |
| 14715 |
* |
| 14716 |
* Its `fatal` is set to `false` and `file` is set to the current file path. |
| 14717 |
* Its added to `file.messages`. |
| 14718 |
* |
| 14719 |
* @param {string | Error | VFileMessage} reason |
| 14720 |
* Reason for message, uses the stack and message of the error if given. |
| 14721 |
* @param {Node | NodeLike | Position | Point | null | undefined} [place] |
| 14722 |
* Place in file where the message occurred. |
| 14723 |
* @param {string | null | undefined} [origin] |
| 14724 |
* Place in code where the message originates (example: |
| 14725 |
* `'my-package:my-rule'` or `'my-rule'`). |
| 14726 |
* @returns {VFileMessage} |
| 14727 |
* Message. |
| 14728 |
*/ |
| 14729 |
message(reason, place, origin) { |
| 14730 |
const message = new VFileMessage(reason, place, origin); |
| 14731 |
if (this.path) { |
| 14732 |
message.name = this.path + ":" + message.name; |
| 14733 |
message.file = this.path; |
| 14734 |
} |
| 14735 |
message.fatal = false; |
| 14736 |
this.messages.push(message); |
| 14737 |
return message; |
| 14738 |
} |
| 14739 |
/** |
| 14740 |
* Create an info message associated with the file. |
| 14741 |
* |
| 14742 |
* Its `fatal` is set to `null` and `file` is set to the current file path. |
| 14743 |
* Its added to `file.messages`. |
| 14744 |
* |
| 14745 |
* @param {string | Error | VFileMessage} reason |
| 14746 |
* Reason for message, uses the stack and message of the error if given. |
| 14747 |
* @param {Node | NodeLike | Position | Point | null | undefined} [place] |
| 14748 |
* Place in file where the message occurred. |
| 14749 |
* @param {string | null | undefined} [origin] |
| 14750 |
* Place in code where the message originates (example: |
| 14751 |
* `'my-package:my-rule'` or `'my-rule'`). |
| 14752 |
* @returns {VFileMessage} |
| 14753 |
* Message. |
| 14754 |
*/ |
| 14755 |
info(reason, place, origin) { |
| 14756 |
const message = this.message(reason, place, origin); |
| 14757 |
message.fatal = null; |
| 14758 |
return message; |
| 14759 |
} |
| 14760 |
/** |
| 14761 |
* Create a fatal error associated with the file. |
| 14762 |
* |
| 14763 |
* Its `fatal` is set to `true` and `file` is set to the current file path. |
| 14764 |
* Its added to `file.messages`. |
| 14765 |
* |
| 14766 |
* > 👉 **Note**: a fatal error means that a file is no longer processable. |
| 14767 |
* |
| 14768 |
* @param {string | Error | VFileMessage} reason |
| 14769 |
* Reason for message, uses the stack and message of the error if given. |
| 14770 |
* @param {Node | NodeLike | Position | Point | null | undefined} [place] |
| 14771 |
* Place in file where the message occurred. |
| 14772 |
* @param {string | null | undefined} [origin] |
| 14773 |
* Place in code where the message originates (example: |
| 14774 |
* `'my-package:my-rule'` or `'my-rule'`). |
| 14775 |
* @returns {never} |
| 14776 |
* Message. |
| 14777 |
* @throws {VFileMessage} |
| 14778 |
* Message. |
| 14779 |
*/ |
| 14780 |
fail(reason, place, origin) { |
| 14781 |
const message = this.message(reason, place, origin); |
| 14782 |
message.fatal = true; |
| 14783 |
throw message; |
| 14784 |
} |
| 14785 |
}; |
| 14786 |
})); |
| 14787 |
|
| 14788 |
//#endregion |
| 14789 |
//#region node_modules/vfile/index.js |
| 14790 |
var init_vfile = __esmMin((() => { |
| 14791 |
init_lib$13(); |
| 14792 |
})); |
| 14793 |
|
| 14794 |
//#endregion |
| 14795 |
//#region node_modules/bail/index.js |
| 14796 |
/** |
| 14797 |
* Throw a given error. |
| 14798 |
* |
| 14799 |
* @param {Error|null|undefined} [error] |
| 14800 |
* Maybe error. |
| 14801 |
* @returns {asserts error is null|undefined} |
| 14802 |
*/ |
| 14803 |
function bail(error) { |
| 14804 |
if (error) throw error; |
| 14805 |
} |
| 14806 |
var init_bail = __esmMin((() => {})); |
| 14807 |
|
| 14808 |
//#endregion |
| 14809 |
//#region node_modules/unified/node_modules/is-buffer/index.js |
| 14810 |
var require_is_buffer = /* @__PURE__ */ __commonJSMin(((exports, module) => { |
| 14811 |
/*! |
| 14812 |
* Determine if an object is a Buffer |
| 14813 |
* |
| 14814 |
* @author Feross Aboukhadijeh <https://feross.org> |
| 14815 |
* @license MIT |
| 14816 |
*/ |
| 14817 |
module.exports = function isBuffer(obj) { |
| 14818 |
return obj != null && obj.constructor != null && typeof obj.constructor.isBuffer === "function" && obj.constructor.isBuffer(obj); |
| 14819 |
}; |
| 14820 |
})); |
| 14821 |
|
| 14822 |
//#endregion |
| 14823 |
//#region node_modules/extend/index.js |
| 14824 |
var require_extend = /* @__PURE__ */ __commonJSMin(((exports, module) => { |
| 14825 |
var hasOwn = Object.prototype.hasOwnProperty; |
| 14826 |
var toStr = Object.prototype.toString; |
| 14827 |
var defineProperty = Object.defineProperty; |
| 14828 |
var gOPD = Object.getOwnPropertyDescriptor; |
| 14829 |
var isArray = function isArray(arr) { |
| 14830 |
if (typeof Array.isArray === "function") return Array.isArray(arr); |
| 14831 |
return toStr.call(arr) === "[object Array]"; |
| 14832 |
}; |
| 14833 |
var isPlainObject = function isPlainObject(obj) { |
| 14834 |
if (!obj || toStr.call(obj) !== "[object Object]") return false; |
| 14835 |
var hasOwnConstructor = hasOwn.call(obj, "constructor"); |
| 14836 |
var hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, "isPrototypeOf"); |
| 14837 |
if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) return false; |
| 14838 |
var key; |
| 14839 |
for (key in obj); |
| 14840 |
return typeof key === "undefined" || hasOwn.call(obj, key); |
| 14841 |
}; |
| 14842 |
var setProperty = function setProperty(target, options) { |
| 14843 |
if (defineProperty && options.name === "__proto__") defineProperty(target, options.name, { |
| 14844 |
enumerable: true, |
| 14845 |
configurable: true, |
| 14846 |
value: options.newValue, |
| 14847 |
writable: true |
| 14848 |
}); |
| 14849 |
else target[options.name] = options.newValue; |
| 14850 |
}; |
| 14851 |
var getProperty = function getProperty(obj, name) { |
| 14852 |
if (name === "__proto__") { |
| 14853 |
if (!hasOwn.call(obj, name)) return; |
| 14854 |
else if (gOPD) return gOPD(obj, name).value; |
| 14855 |
} |
| 14856 |
return obj[name]; |
| 14857 |
}; |
| 14858 |
module.exports = function extend() { |
| 14859 |
var options; |
| 14860 |
var name; |
| 14861 |
var src; |
| 14862 |
var copy; |
| 14863 |
var copyIsArray; |
| 14864 |
var clone; |
| 14865 |
var target = arguments[0]; |
| 14866 |
var i = 1; |
| 14867 |
var length = arguments.length; |
| 14868 |
var deep = false; |
| 14869 |
if (typeof target === "boolean") { |
| 14870 |
deep = target; |
| 14871 |
target = arguments[1] || {}; |
| 14872 |
i = 2; |
| 14873 |
} |
| 14874 |
if (target == null || typeof target !== "object" && typeof target !== "function") target = {}; |
| 14875 |
for (; i < length; ++i) { |
| 14876 |
options = arguments[i]; |
| 14877 |
if (options != null) for (name in options) { |
| 14878 |
src = getProperty(target, name); |
| 14879 |
copy = getProperty(options, name); |
| 14880 |
if (target !== copy) { |
| 14881 |
if (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) { |
| 14882 |
if (copyIsArray) { |
| 14883 |
copyIsArray = false; |
| 14884 |
clone = src && isArray(src) ? src : []; |
| 14885 |
} else clone = src && isPlainObject(src) ? src : {}; |
| 14886 |
setProperty(target, { |
| 14887 |
name, |
| 14888 |
newValue: extend(deep, clone, copy) |
| 14889 |
}); |
| 14890 |
} else if (typeof copy !== "undefined") setProperty(target, { |
| 14891 |
name, |
| 14892 |
newValue: copy |
| 14893 |
}); |
| 14894 |
} |
| 14895 |
} |
| 14896 |
} |
| 14897 |
return target; |
| 14898 |
}; |
| 14899 |
})); |
| 14900 |
|
| 14901 |
//#endregion |
| 14902 |
//#region node_modules/is-plain-obj/index.js |
| 14903 |
function isPlainObject(value) { |
| 14904 |
if (typeof value !== "object" || value === null) return false; |
| 14905 |
const prototype = Object.getPrototypeOf(value); |
| 14906 |
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value); |
| 14907 |
} |
| 14908 |
var init_is_plain_obj = __esmMin((() => {})); |
| 14909 |
|
| 14910 |
//#endregion |
| 14911 |
//#region node_modules/trough/lib/index.js |
| 14912 |
/** |
| 14913 |
* @typedef {(error?: Error | null | undefined, ...output: Array<any>) => void} Callback |
| 14914 |
* Callback. |
| 14915 |
* |
| 14916 |
* @typedef {(...input: Array<any>) => any} Middleware |
| 14917 |
* Ware. |
| 14918 |
* |
| 14919 |
* @typedef Pipeline |
| 14920 |
* Pipeline. |
| 14921 |
* @property {Run} run |
| 14922 |
* Run the pipeline. |
| 14923 |
* @property {Use} use |
| 14924 |
* Add middleware. |
| 14925 |
* |
| 14926 |
* @typedef {(...input: Array<any>) => void} Run |
| 14927 |
* Call all middleware. |
| 14928 |
* |
| 14929 |
* Calls `done` on completion with either an error or the output of the |
| 14930 |
* last middleware. |
| 14931 |
* |
| 14932 |
* > 👉 **Note**: as the length of input defines whether async functions get a |
| 14933 |
* > `next` function, |
| 14934 |
* > it’s recommended to keep `input` at one value normally. |
| 14935 |
|
| 14936 |
* |
| 14937 |
* @typedef {(fn: Middleware) => Pipeline} Use |
| 14938 |
* Add middleware. |
| 14939 |
*/ |
| 14940 |
/** |
| 14941 |
* Create new middleware. |
| 14942 |
* |
| 14943 |
* @returns {Pipeline} |
| 14944 |
* Pipeline. |
| 14945 |
*/ |
| 14946 |
function trough() { |
| 14947 |
/** @type {Array<Middleware>} */ |
| 14948 |
const fns = []; |
| 14949 |
/** @type {Pipeline} */ |
| 14950 |
const pipeline = { |
| 14951 |
run, |
| 14952 |
use |
| 14953 |
}; |
| 14954 |
return pipeline; |
| 14955 |
/** @type {Run} */ |
| 14956 |
function run(...values) { |
| 14957 |
let middlewareIndex = -1; |
| 14958 |
/** @type {Callback} */ |
| 14959 |
const callback = values.pop(); |
| 14960 |
if (typeof callback !== "function") throw new TypeError("Expected function as last argument, not " + callback); |
| 14961 |
next(null, ...values); |
| 14962 |
/** |
| 14963 |
* Run the next `fn`, or we’re done. |
| 14964 |
* |
| 14965 |
* @param {Error | null | undefined} error |
| 14966 |
* @param {Array<any>} output |
| 14967 |
*/ |
| 14968 |
function next(error, ...output) { |
| 14969 |
const fn = fns[++middlewareIndex]; |
| 14970 |
let index = -1; |
| 14971 |
if (error) { |
| 14972 |
callback(error); |
| 14973 |
return; |
| 14974 |
} |
| 14975 |
while (++index < values.length) if (output[index] === null || output[index] === void 0) output[index] = values[index]; |
| 14976 |
values = output; |
| 14977 |
if (fn) wrap$1(fn, next)(...output); |
| 14978 |
else callback(null, ...output); |
| 14979 |
} |
| 14980 |
} |
| 14981 |
/** @type {Use} */ |
| 14982 |
function use(middelware) { |
| 14983 |
if (typeof middelware !== "function") throw new TypeError("Expected `middelware` to be a function, not " + middelware); |
| 14984 |
fns.push(middelware); |
| 14985 |
return pipeline; |
| 14986 |
} |
| 14987 |
} |
| 14988 |
/** |
| 14989 |
* Wrap `middleware` into a uniform interface. |
| 14990 |
* |
| 14991 |
* You can pass all input to the resulting function. |
| 14992 |
* `callback` is then called with the output of `middleware`. |
| 14993 |
* |
| 14994 |
* If `middleware` accepts more arguments than the later given in input, |
| 14995 |
* an extra `done` function is passed to it after that input, |
| 14996 |
* which must be called by `middleware`. |
| 14997 |
* |
| 14998 |
* The first value in `input` is the main input value. |
| 14999 |
* All other input values are the rest input values. |
| 15000 |
* The values given to `callback` are the input values, |
| 15001 |
* merged with every non-nullish output value. |
| 15002 |
* |
| 15003 |
* * if `middleware` throws an error, |
| 15004 |
* returns a promise that is rejected, |
| 15005 |
* or calls the given `done` function with an error, |
| 15006 |
* `callback` is called with that error |
| 15007 |
* * if `middleware` returns a value or returns a promise that is resolved, |
| 15008 |
* that value is the main output value |
| 15009 |
* * if `middleware` calls `done`, |
| 15010 |
* all non-nullish values except for the first one (the error) overwrite the |
| 15011 |
* output values |
| 15012 |
* |
| 15013 |
* @param {Middleware} middleware |
| 15014 |
* Function to wrap. |
| 15015 |
* @param {Callback} callback |
| 15016 |
* Callback called with the output of `middleware`. |
| 15017 |
* @returns {Run} |
| 15018 |
* Wrapped middleware. |
| 15019 |
*/ |
| 15020 |
function wrap$1(middleware, callback) { |
| 15021 |
/** @type {boolean} */ |
| 15022 |
let called; |
| 15023 |
return wrapped; |
| 15024 |
/** |
| 15025 |
* Call `middleware`. |
| 15026 |
* @this {any} |
| 15027 |
* @param {Array<any>} parameters |
| 15028 |
* @returns {void} |
| 15029 |
*/ |
| 15030 |
function wrapped(...parameters) { |
| 15031 |
const fnExpectsCallback = middleware.length > parameters.length; |
| 15032 |
/** @type {any} */ |
| 15033 |
let result; |
| 15034 |
if (fnExpectsCallback) parameters.push(done); |
| 15035 |
try { |
| 15036 |
result = middleware.apply(this, parameters); |
| 15037 |
} catch (error) { |
| 15038 |
const exception = error; |
| 15039 |
if (fnExpectsCallback && called) throw exception; |
| 15040 |
return done(exception); |
| 15041 |
} |
| 15042 |
if (!fnExpectsCallback) if (result && result.then && typeof result.then === "function") result.then(then, done); |
| 15043 |
else if (result instanceof Error) done(result); |
| 15044 |
else then(result); |
| 15045 |
} |
| 15046 |
/** |
| 15047 |
* Call `callback`, only once. |
| 15048 |
* |
| 15049 |
* @type {Callback} |
| 15050 |
*/ |
| 15051 |
function done(error, ...output) { |
| 15052 |
if (!called) { |
| 15053 |
called = true; |
| 15054 |
callback(error, ...output); |
| 15055 |
} |
| 15056 |
} |
| 15057 |
/** |
| 15058 |
* Call `done` with one value. |
| 15059 |
* |
| 15060 |
* @param {any} [value] |
| 15061 |
*/ |
| 15062 |
function then(value) { |
| 15063 |
done(null, value); |
| 15064 |
} |
| 15065 |
} |
| 15066 |
var init_lib$12 = __esmMin((() => { |
| 15067 |
__name(wrap$1, "wrap"); |
| 15068 |
})); |
| 15069 |
|
| 15070 |
//#endregion |
| 15071 |
//#region node_modules/trough/index.js |
| 15072 |
var init_trough = __esmMin((() => { |
| 15073 |
init_lib$12(); |
| 15074 |
})); |
| 15075 |
|
| 15076 |
//#endregion |
| 15077 |
//#region node_modules/unified/lib/index.js |
| 15078 |
/** |
| 15079 |
* @returns {Processor} |
| 15080 |
*/ |
| 15081 |
function base() { |
| 15082 |
const transformers = trough(); |
| 15083 |
/** @type {Processor['attachers']} */ |
| 15084 |
const attachers = []; |
| 15085 |
/** @type {Record<string, unknown>} */ |
| 15086 |
let namespace = {}; |
| 15087 |
/** @type {boolean|undefined} */ |
| 15088 |
let frozen; |
| 15089 |
let freezeIndex = -1; |
| 15090 |
processor.data = data; |
| 15091 |
processor.Parser = void 0; |
| 15092 |
processor.Compiler = void 0; |
| 15093 |
processor.freeze = freeze; |
| 15094 |
processor.attachers = attachers; |
| 15095 |
processor.use = use; |
| 15096 |
processor.parse = parse; |
| 15097 |
processor.stringify = stringify; |
| 15098 |
processor.run = run; |
| 15099 |
processor.runSync = runSync; |
| 15100 |
processor.process = process; |
| 15101 |
processor.processSync = processSync; |
| 15102 |
return processor; |
| 15103 |
/** @type {Processor} */ |
| 15104 |
function processor() { |
| 15105 |
const destination = base(); |
| 15106 |
let index = -1; |
| 15107 |
while (++index < attachers.length) destination.use(...attachers[index]); |
| 15108 |
destination.data((0, import_extend.default)(true, {}, namespace)); |
| 15109 |
return destination; |
| 15110 |
} |
| 15111 |
/** |
| 15112 |
* @param {string|Record<string, unknown>} [key] |
| 15113 |
* @param {unknown} [value] |
| 15114 |
* @returns {unknown} |
| 15115 |
*/ |
| 15116 |
function data(key, value) { |
| 15117 |
if (typeof key === "string") { |
| 15118 |
if (arguments.length === 2) { |
| 15119 |
assertUnfrozen("data", frozen); |
| 15120 |
namespace[key] = value; |
| 15121 |
return processor; |
| 15122 |
} |
| 15123 |
return own$6.call(namespace, key) && namespace[key] || null; |
| 15124 |
} |
| 15125 |
if (key) { |
| 15126 |
assertUnfrozen("data", frozen); |
| 15127 |
namespace = key; |
| 15128 |
return processor; |
| 15129 |
} |
| 15130 |
return namespace; |
| 15131 |
} |
| 15132 |
/** @type {Processor['freeze']} */ |
| 15133 |
function freeze() { |
| 15134 |
if (frozen) return processor; |
| 15135 |
while (++freezeIndex < attachers.length) { |
| 15136 |
const [attacher, ...options] = attachers[freezeIndex]; |
| 15137 |
if (options[0] === false) continue; |
| 15138 |
if (options[0] === true) options[0] = void 0; |
| 15139 |
/** @type {Transformer|void} */ |
| 15140 |
const transformer = attacher.call(processor, ...options); |
| 15141 |
if (typeof transformer === "function") transformers.use(transformer); |
| 15142 |
} |
| 15143 |
frozen = true; |
| 15144 |
freezeIndex = Number.POSITIVE_INFINITY; |
| 15145 |
return processor; |
| 15146 |
} |
| 15147 |
/** |
| 15148 |
* @param {Pluggable|null|undefined} [value] |
| 15149 |
* @param {...unknown} options |
| 15150 |
* @returns {Processor} |
| 15151 |
*/ |
| 15152 |
function use(value, ...options) { |
| 15153 |
/** @type {Record<string, unknown>|undefined} */ |
| 15154 |
let settings; |
| 15155 |
assertUnfrozen("use", frozen); |
| 15156 |
if (value === null || value === void 0) {} else if (typeof value === "function") addPlugin(value, ...options); |
| 15157 |
else if (typeof value === "object") if (Array.isArray(value)) addList(value); |
| 15158 |
else addPreset(value); |
| 15159 |
else throw new TypeError("Expected usable value, not `" + value + "`"); |
| 15160 |
if (settings) namespace.settings = Object.assign(namespace.settings || {}, settings); |
| 15161 |
return processor; |
| 15162 |
/** |
| 15163 |
* @param {import('..').Pluggable<unknown[]>} value |
| 15164 |
* @returns {void} |
| 15165 |
*/ |
| 15166 |
function add(value) { |
| 15167 |
if (typeof value === "function") addPlugin(value); |
| 15168 |
else if (typeof value === "object") if (Array.isArray(value)) { |
| 15169 |
const [plugin, ...options] = value; |
| 15170 |
addPlugin(plugin, ...options); |
| 15171 |
} else addPreset(value); |
| 15172 |
else throw new TypeError("Expected usable value, not `" + value + "`"); |
| 15173 |
} |
| 15174 |
/** |
| 15175 |
* @param {Preset} result |
| 15176 |
* @returns {void} |
| 15177 |
*/ |
| 15178 |
function addPreset(result) { |
| 15179 |
addList(result.plugins); |
| 15180 |
if (result.settings) settings = Object.assign(settings || {}, result.settings); |
| 15181 |
} |
| 15182 |
/** |
| 15183 |
* @param {PluggableList|null|undefined} [plugins] |
| 15184 |
* @returns {void} |
| 15185 |
*/ |
| 15186 |
function addList(plugins) { |
| 15187 |
let index = -1; |
| 15188 |
if (plugins === null || plugins === void 0) {} else if (Array.isArray(plugins)) while (++index < plugins.length) { |
| 15189 |
const thing = plugins[index]; |
| 15190 |
add(thing); |
| 15191 |
} |
| 15192 |
else throw new TypeError("Expected a list of plugins, not `" + plugins + "`"); |
| 15193 |
} |
| 15194 |
/** |
| 15195 |
* @param {Plugin} plugin |
| 15196 |
* @param {...unknown} [value] |
| 15197 |
* @returns {void} |
| 15198 |
*/ |
| 15199 |
function addPlugin(plugin, value) { |
| 15200 |
let index = -1; |
| 15201 |
/** @type {Processor['attachers'][number]|undefined} */ |
| 15202 |
let entry; |
| 15203 |
while (++index < attachers.length) if (attachers[index][0] === plugin) { |
| 15204 |
entry = attachers[index]; |
| 15205 |
break; |
| 15206 |
} |
| 15207 |
if (entry) { |
| 15208 |
if (isPlainObject(entry[1]) && isPlainObject(value)) value = (0, import_extend.default)(true, entry[1], value); |
| 15209 |
entry[1] = value; |
| 15210 |
} else attachers.push([...arguments]); |
| 15211 |
} |
| 15212 |
} |
| 15213 |
/** @type {Processor['parse']} */ |
| 15214 |
function parse(doc) { |
| 15215 |
processor.freeze(); |
| 15216 |
const file = vfile(doc); |
| 15217 |
const Parser = processor.Parser; |
| 15218 |
assertParser("parse", Parser); |
| 15219 |
if (newable(Parser, "parse")) return new Parser(String(file), file).parse(); |
| 15220 |
return Parser(String(file), file); |
| 15221 |
} |
| 15222 |
/** @type {Processor['stringify']} */ |
| 15223 |
function stringify(node, doc) { |
| 15224 |
processor.freeze(); |
| 15225 |
const file = vfile(doc); |
| 15226 |
const Compiler = processor.Compiler; |
| 15227 |
assertCompiler("stringify", Compiler); |
| 15228 |
assertNode(node); |
| 15229 |
if (newable(Compiler, "compile")) return new Compiler(node, file).compile(); |
| 15230 |
return Compiler(node, file); |
| 15231 |
} |
| 15232 |
/** |
| 15233 |
* @param {Node} node |
| 15234 |
* @param {VFileCompatible|RunCallback} [doc] |
| 15235 |
* @param {RunCallback} [callback] |
| 15236 |
* @returns {Promise<Node>|void} |
| 15237 |
*/ |
| 15238 |
function run(node, doc, callback) { |
| 15239 |
assertNode(node); |
| 15240 |
processor.freeze(); |
| 15241 |
if (!callback && typeof doc === "function") { |
| 15242 |
callback = doc; |
| 15243 |
doc = void 0; |
| 15244 |
} |
| 15245 |
if (!callback) return new Promise(executor); |
| 15246 |
executor(null, callback); |
| 15247 |
/** |
| 15248 |
* @param {null|((node: Node) => void)} resolve |
| 15249 |
* @param {(error: Error) => void} reject |
| 15250 |
* @returns {void} |
| 15251 |
*/ |
| 15252 |
function executor(resolve, reject) { |
| 15253 |
transformers.run(node, vfile(doc), done); |
| 15254 |
/** |
| 15255 |
* @param {Error|null} error |
| 15256 |
* @param {Node} tree |
| 15257 |
* @param {VFile} file |
| 15258 |
* @returns {void} |
| 15259 |
*/ |
| 15260 |
function done(error, tree, file) { |
| 15261 |
tree = tree || node; |
| 15262 |
if (error) reject(error); |
| 15263 |
else if (resolve) resolve(tree); |
| 15264 |
else callback(null, tree, file); |
| 15265 |
} |
| 15266 |
} |
| 15267 |
} |
| 15268 |
/** @type {Processor['runSync']} */ |
| 15269 |
function runSync(node, file) { |
| 15270 |
/** @type {Node|undefined} */ |
| 15271 |
let result; |
| 15272 |
/** @type {boolean|undefined} */ |
| 15273 |
let complete; |
| 15274 |
processor.run(node, file, done); |
| 15275 |
assertDone("runSync", "run", complete); |
| 15276 |
return result; |
| 15277 |
/** |
| 15278 |
* @param {Error|null} [error] |
| 15279 |
* @param {Node} [tree] |
| 15280 |
* @returns {void} |
| 15281 |
*/ |
| 15282 |
function done(error, tree) { |
| 15283 |
bail(error); |
| 15284 |
result = tree; |
| 15285 |
complete = true; |
| 15286 |
} |
| 15287 |
} |
| 15288 |
/** |
| 15289 |
* @param {VFileCompatible} doc |
| 15290 |
* @param {ProcessCallback} [callback] |
| 15291 |
* @returns {Promise<VFile>|undefined} |
| 15292 |
*/ |
| 15293 |
function process(doc, callback) { |
| 15294 |
processor.freeze(); |
| 15295 |
assertParser("process", processor.Parser); |
| 15296 |
assertCompiler("process", processor.Compiler); |
| 15297 |
if (!callback) return new Promise(executor); |
| 15298 |
executor(null, callback); |
| 15299 |
/** |
| 15300 |
* @param {null|((file: VFile) => void)} resolve |
| 15301 |
* @param {(error?: Error|null|undefined) => void} reject |
| 15302 |
* @returns {void} |
| 15303 |
*/ |
| 15304 |
function executor(resolve, reject) { |
| 15305 |
const file = vfile(doc); |
| 15306 |
processor.run(processor.parse(file), file, (error, tree, file) => { |
| 15307 |
if (error || !tree || !file) done(error); |
| 15308 |
else { |
| 15309 |
/** @type {unknown} */ |
| 15310 |
const result = processor.stringify(tree, file); |
| 15311 |
if (result === void 0 || result === null) {} else if (looksLikeAVFileValue(result)) file.value = result; |
| 15312 |
else file.result = result; |
| 15313 |
done(error, file); |
| 15314 |
} |
| 15315 |
}); |
| 15316 |
/** |
| 15317 |
* @param {Error|null|undefined} [error] |
| 15318 |
* @param {VFile|undefined} [file] |
| 15319 |
* @returns {void} |
| 15320 |
*/ |
| 15321 |
function done(error, file) { |
| 15322 |
if (error || !file) reject(error); |
| 15323 |
else if (resolve) resolve(file); |
| 15324 |
else callback(null, file); |
| 15325 |
} |
| 15326 |
} |
| 15327 |
} |
| 15328 |
/** @type {Processor['processSync']} */ |
| 15329 |
function processSync(doc) { |
| 15330 |
/** @type {boolean|undefined} */ |
| 15331 |
let complete; |
| 15332 |
processor.freeze(); |
| 15333 |
assertParser("processSync", processor.Parser); |
| 15334 |
assertCompiler("processSync", processor.Compiler); |
| 15335 |
const file = vfile(doc); |
| 15336 |
processor.process(file, done); |
| 15337 |
assertDone("processSync", "process", complete); |
| 15338 |
return file; |
| 15339 |
/** |
| 15340 |
* @param {Error|null|undefined} [error] |
| 15341 |
* @returns {void} |
| 15342 |
*/ |
| 15343 |
function done(error) { |
| 15344 |
complete = true; |
| 15345 |
bail(error); |
| 15346 |
} |
| 15347 |
} |
| 15348 |
} |
| 15349 |
/** |
| 15350 |
* Check if `value` is a constructor. |
| 15351 |
* |
| 15352 |
* @param {unknown} value |
| 15353 |
* @param {string} name |
| 15354 |
* @returns {boolean} |
| 15355 |
*/ |
| 15356 |
function newable(value, name) { |
| 15357 |
return typeof value === "function" && value.prototype && (keys(value.prototype) || name in value.prototype); |
| 15358 |
} |
| 15359 |
/** |
| 15360 |
* Check if `value` is an object with keys. |
| 15361 |
* |
| 15362 |
* @param {Record<string, unknown>} value |
| 15363 |
* @returns {boolean} |
| 15364 |
*/ |
| 15365 |
function keys(value) { |
| 15366 |
/** @type {string} */ |
| 15367 |
let key; |
| 15368 |
for (key in value) if (own$6.call(value, key)) return true; |
| 15369 |
return false; |
| 15370 |
} |
| 15371 |
/** |
| 15372 |
* Assert a parser is available. |
| 15373 |
* |
| 15374 |
* @param {string} name |
| 15375 |
* @param {unknown} value |
| 15376 |
* @returns {asserts value is Parser} |
| 15377 |
*/ |
| 15378 |
function assertParser(name, value) { |
| 15379 |
if (typeof value !== "function") throw new TypeError("Cannot `" + name + "` without `Parser`"); |
| 15380 |
} |
| 15381 |
/** |
| 15382 |
* Assert a compiler is available. |
| 15383 |
* |
| 15384 |
* @param {string} name |
| 15385 |
* @param {unknown} value |
| 15386 |
* @returns {asserts value is Compiler} |
| 15387 |
*/ |
| 15388 |
function assertCompiler(name, value) { |
| 15389 |
if (typeof value !== "function") throw new TypeError("Cannot `" + name + "` without `Compiler`"); |
| 15390 |
} |
| 15391 |
/** |
| 15392 |
* Assert the processor is not frozen. |
| 15393 |
* |
| 15394 |
* @param {string} name |
| 15395 |
* @param {unknown} frozen |
| 15396 |
* @returns {asserts frozen is false} |
| 15397 |
*/ |
| 15398 |
function assertUnfrozen(name, frozen) { |
| 15399 |
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`."); |
| 15400 |
} |
| 15401 |
/** |
| 15402 |
* Assert `node` is a unist node. |
| 15403 |
* |
| 15404 |
* @param {unknown} node |
| 15405 |
* @returns {asserts node is Node} |
| 15406 |
*/ |
| 15407 |
function assertNode(node) { |
| 15408 |
if (!isPlainObject(node) || typeof node.type !== "string") throw new TypeError("Expected node, got `" + node + "`"); |
| 15409 |
} |
| 15410 |
/** |
| 15411 |
* Assert that `complete` is `true`. |
| 15412 |
* |
| 15413 |
* @param {string} name |
| 15414 |
* @param {string} asyncName |
| 15415 |
* @param {unknown} complete |
| 15416 |
* @returns {asserts complete is true} |
| 15417 |
*/ |
| 15418 |
function assertDone(name, asyncName, complete) { |
| 15419 |
if (!complete) throw new Error("`" + name + "` finished async. Use `" + asyncName + "` instead"); |
| 15420 |
} |
| 15421 |
/** |
| 15422 |
* @param {VFileCompatible} [value] |
| 15423 |
* @returns {VFile} |
| 15424 |
*/ |
| 15425 |
function vfile(value) { |
| 15426 |
return looksLikeAVFile(value) ? value : new VFile(value); |
| 15427 |
} |
| 15428 |
/** |
| 15429 |
* @param {VFileCompatible} [value] |
| 15430 |
* @returns {value is VFile} |
| 15431 |
*/ |
| 15432 |
function looksLikeAVFile(value) { |
| 15433 |
return Boolean(value && typeof value === "object" && "message" in value && "messages" in value); |
| 15434 |
} |
| 15435 |
/** |
| 15436 |
* @param {unknown} [value] |
| 15437 |
* @returns {value is VFileValue} |
| 15438 |
*/ |
| 15439 |
function looksLikeAVFileValue(value) { |
| 15440 |
return typeof value === "string" || (0, import_is_buffer.default)(value); |
| 15441 |
} |
| 15442 |
var import_is_buffer, import_extend, unified, own$6; |
| 15443 |
var init_lib$11 = __esmMin((() => { |
| 15444 |
init_bail(); |
| 15445 |
import_is_buffer = /* @__PURE__ */ __toESM(require_is_buffer(), 1); |
| 15446 |
import_extend = /* @__PURE__ */ __toESM(require_extend(), 1); |
| 15447 |
init_is_plain_obj(); |
| 15448 |
init_trough(); |
| 15449 |
init_vfile(); |
| 15450 |
unified = base().freeze(); |
| 15451 |
own$6 = {}.hasOwnProperty; |
| 15452 |
})); |
| 15453 |
|
| 15454 |
//#endregion |
| 15455 |
//#region node_modules/unified/index.js |
| 15456 |
var init_unified = __esmMin((() => { |
| 15457 |
init_lib$11(); |
| 15458 |
})); |
| 15459 |
|
| 15460 |
//#endregion |
| 15461 |
//#region node_modules/mdast-util-to-string/lib/index.js |
| 15462 |
/** |
| 15463 |
* Get the text content of a node or list of nodes. |
| 15464 |
* |
| 15465 |
* Prefers the node’s plain-text fields, otherwise serializes its children, |
| 15466 |
* and if the given value is an array, serialize the nodes in it. |
| 15467 |
* |
| 15468 |
* @param {unknown} value |
| 15469 |
* Thing to serialize, typically `Node`. |
| 15470 |
* @param {Options | null | undefined} [options] |
| 15471 |
* Configuration (optional). |
| 15472 |
* @returns {string} |
| 15473 |
* Serialized `value`. |
| 15474 |
*/ |
| 15475 |
function toString(value, options) { |
| 15476 |
const settings = options || emptyOptions; |
| 15477 |
return one$1(value, typeof settings.includeImageAlt === "boolean" ? settings.includeImageAlt : true, typeof settings.includeHtml === "boolean" ? settings.includeHtml : true); |
| 15478 |
} |
| 15479 |
/** |
| 15480 |
* One node or several nodes. |
| 15481 |
* |
| 15482 |
* @param {unknown} value |
| 15483 |
* Thing to serialize. |
| 15484 |
* @param {boolean} includeImageAlt |
| 15485 |
* Include image `alt`s. |
| 15486 |
* @param {boolean} includeHtml |
| 15487 |
* Include HTML. |
| 15488 |
* @returns {string} |
| 15489 |
* Serialized node. |
| 15490 |
*/ |
| 15491 |
function one$1(value, includeImageAlt, includeHtml) { |
| 15492 |
if (node(value)) { |
| 15493 |
if ("value" in value) return value.type === "html" && !includeHtml ? "" : value.value; |
| 15494 |
if (includeImageAlt && "alt" in value && value.alt) return value.alt; |
| 15495 |
if ("children" in value) return all$1(value.children, includeImageAlt, includeHtml); |
| 15496 |
} |
| 15497 |
if (Array.isArray(value)) return all$1(value, includeImageAlt, includeHtml); |
| 15498 |
return ""; |
| 15499 |
} |
| 15500 |
/** |
| 15501 |
* Serialize a list of nodes. |
| 15502 |
* |
| 15503 |
* @param {Array<unknown>} values |
| 15504 |
* Thing to serialize. |
| 15505 |
* @param {boolean} includeImageAlt |
| 15506 |
* Include image `alt`s. |
| 15507 |
* @param {boolean} includeHtml |
| 15508 |
* Include HTML. |
| 15509 |
* @returns {string} |
| 15510 |
* Serialized nodes. |
| 15511 |
*/ |
| 15512 |
function all$1(values, includeImageAlt, includeHtml) { |
| 15513 |
/** @type {Array<string>} */ |
| 15514 |
const result = []; |
| 15515 |
let index = -1; |
| 15516 |
while (++index < values.length) result[index] = one$1(values[index], includeImageAlt, includeHtml); |
| 15517 |
return result.join(""); |
| 15518 |
} |
| 15519 |
/** |
| 15520 |
* Check if `value` looks like a node. |
| 15521 |
* |
| 15522 |
* @param {unknown} value |
| 15523 |
* Thing. |
| 15524 |
* @returns {value is Node} |
| 15525 |
* Whether `value` is a node. |
| 15526 |
*/ |
| 15527 |
function node(value) { |
| 15528 |
return Boolean(value && typeof value === "object"); |
| 15529 |
} |
| 15530 |
var emptyOptions; |
| 15531 |
var init_lib$10 = __esmMin((() => { |
| 15532 |
emptyOptions = {}; |
| 15533 |
__name(one$1, "one"); |
| 15534 |
__name(all$1, "all"); |
| 15535 |
})); |
| 15536 |
|
| 15537 |
//#endregion |
| 15538 |
//#region node_modules/mdast-util-to-string/index.js |
| 15539 |
var init_mdast_util_to_string = __esmMin((() => { |
| 15540 |
init_lib$10(); |
| 15541 |
})); |
| 15542 |
|
| 15543 |
//#endregion |
| 15544 |
//#region node_modules/micromark-util-chunked/index.js |
| 15545 |
/** |
| 15546 |
* Like `Array#splice`, but smarter for giant arrays. |
| 15547 |
* |
| 15548 |
* `Array#splice` takes all items to be inserted as individual argument which |
| 15549 |
* causes a stack overflow in V8 when trying to insert 100k items for instance. |
| 15550 |
* |
| 15551 |
* Otherwise, this does not return the removed items, and takes `items` as an |
| 15552 |
* array instead of rest parameters. |
| 15553 |
* |
| 15554 |
* @template {unknown} T |
| 15555 |
* Item type. |
| 15556 |
* @param {Array<T>} list |
| 15557 |
* List to operate on. |
| 15558 |
* @param {number} start |
| 15559 |
* Index to remove/insert at (can be negative). |
| 15560 |
* @param {number} remove |
| 15561 |
* Number of items to remove. |
| 15562 |
* @param {Array<T>} items |
| 15563 |
* Items to inject into `list`. |
| 15564 |
* @returns {void} |
| 15565 |
* Nothing. |
| 15566 |
*/ |
| 15567 |
function splice(list, start, remove, items) { |
| 15568 |
const end = list.length; |
| 15569 |
let chunkStart = 0; |
| 15570 |
/** @type {Array<unknown>} */ |
| 15571 |
let parameters; |
| 15572 |
if (start < 0) start = -start > end ? 0 : end + start; |
| 15573 |
else start = start > end ? end : start; |
| 15574 |
remove = remove > 0 ? remove : 0; |
| 15575 |
if (items.length < 1e4) { |
| 15576 |
parameters = Array.from(items); |
| 15577 |
parameters.unshift(start, remove); |
| 15578 |
list.splice(...parameters); |
| 15579 |
} else { |
| 15580 |
if (remove) list.splice(start, remove); |
| 15581 |
while (chunkStart < items.length) { |
| 15582 |
parameters = items.slice(chunkStart, chunkStart + 1e4); |
| 15583 |
parameters.unshift(start, 0); |
| 15584 |
list.splice(...parameters); |
| 15585 |
chunkStart += 1e4; |
| 15586 |
start += 1e4; |
| 15587 |
} |
| 15588 |
} |
| 15589 |
} |
| 15590 |
/** |
| 15591 |
* Append `items` (an array) at the end of `list` (another array). |
| 15592 |
* When `list` was empty, returns `items` instead. |
| 15593 |
* |
| 15594 |
* This prevents a potentially expensive operation when `list` is empty, |
| 15595 |
* and adds items in batches to prevent V8 from hanging. |
| 15596 |
* |
| 15597 |
* @template {unknown} T |
| 15598 |
* Item type. |
| 15599 |
* @param {Array<T>} list |
| 15600 |
* List to operate on. |
| 15601 |
* @param {Array<T>} items |
| 15602 |
* Items to add to `list`. |
| 15603 |
* @returns {Array<T>} |
| 15604 |
* Either `list` or `items`. |
| 15605 |
*/ |
| 15606 |
function push(list, items) { |
| 15607 |
if (list.length > 0) { |
| 15608 |
splice(list, list.length, 0, items); |
| 15609 |
return list; |
| 15610 |
} |
| 15611 |
return items; |
| 15612 |
} |
| 15613 |
var init_micromark_util_chunked = __esmMin((() => {})); |
| 15614 |
|
| 15615 |
//#endregion |
| 15616 |
//#region node_modules/micromark-util-combine-extensions/index.js |
| 15617 |
/** |
| 15618 |
* Combine multiple syntax extensions into one. |
| 15619 |
* |
| 15620 |
* @param {Array<Extension>} extensions |
| 15621 |
* List of syntax extensions. |
| 15622 |
* @returns {NormalizedExtension} |
| 15623 |
* A single combined extension. |
| 15624 |
*/ |
| 15625 |
function combineExtensions(extensions) { |
| 15626 |
/** @type {NormalizedExtension} */ |
| 15627 |
const all = {}; |
| 15628 |
let index = -1; |
| 15629 |
while (++index < extensions.length) syntaxExtension(all, extensions[index]); |
| 15630 |
return all; |
| 15631 |
} |
| 15632 |
/** |
| 15633 |
* Merge `extension` into `all`. |
| 15634 |
* |
| 15635 |
* @param {NormalizedExtension} all |
| 15636 |
* Extension to merge into. |
| 15637 |
* @param {Extension} extension |
| 15638 |
* Extension to merge. |
| 15639 |
* @returns {void} |
| 15640 |
*/ |
| 15641 |
function syntaxExtension(all, extension) { |
| 15642 |
/** @type {keyof Extension} */ |
| 15643 |
let hook; |
| 15644 |
for (hook in extension) { |
| 15645 |
/** @type {Record<string, unknown>} */ |
| 15646 |
const left = (hasOwnProperty.call(all, hook) ? all[hook] : void 0) || (all[hook] = {}); |
| 15647 |
/** @type {Record<string, unknown> | undefined} */ |
| 15648 |
const right = extension[hook]; |
| 15649 |
/** @type {string} */ |
| 15650 |
let code; |
| 15651 |
if (right) for (code in right) { |
| 15652 |
if (!hasOwnProperty.call(left, code)) left[code] = []; |
| 15653 |
const value = right[code]; |
| 15654 |
constructs(left[code], Array.isArray(value) ? value : value ? [value] : []); |
| 15655 |
} |
| 15656 |
} |
| 15657 |
} |
| 15658 |
/** |
| 15659 |
* Merge `list` into `existing` (both lists of constructs). |
| 15660 |
* Mutates `existing`. |
| 15661 |
* |
| 15662 |
* @param {Array<unknown>} existing |
| 15663 |
* @param {Array<unknown>} list |
| 15664 |
* @returns {void} |
| 15665 |
*/ |
| 15666 |
function constructs(existing, list) { |
| 15667 |
let index = -1; |
| 15668 |
/** @type {Array<unknown>} */ |
| 15669 |
const before = []; |
| 15670 |
while (++index < list.length) (list[index].add === "after" ? existing : before).push(list[index]); |
| 15671 |
splice(existing, 0, 0, before); |
| 15672 |
} |
| 15673 |
var hasOwnProperty; |
| 15674 |
var init_micromark_util_combine_extensions = __esmMin((() => { |
| 15675 |
init_micromark_util_chunked(); |
| 15676 |
hasOwnProperty = {}.hasOwnProperty; |
| 15677 |
})); |
| 15678 |
|
| 15679 |
//#endregion |
| 15680 |
//#region node_modules/micromark-util-character/lib/unicode-punctuation-regex.js |
| 15681 |
var unicodePunctuationRegex; |
| 15682 |
var init_unicode_punctuation_regex = __esmMin((() => { |
| 15683 |
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]/; |
| 15684 |
})); |
| 15685 |
|
| 15686 |
//#endregion |
| 15687 |
//#region node_modules/micromark-util-character/index.js |
| 15688 |
/** |
| 15689 |
* Check whether a character code is an ASCII control character. |
| 15690 |
* |
| 15691 |
* An **ASCII control** is a character in the inclusive range U+0000 NULL (NUL) |
| 15692 |
* to U+001F (US), or U+007F (DEL). |
| 15693 |
* |
| 15694 |
* @param {Code} code |
| 15695 |
* Code. |
| 15696 |
* @returns {boolean} |
| 15697 |
* Whether it matches. |
| 15698 |
*/ |
| 15699 |
function asciiControl(code) { |
| 15700 |
return code !== null && (code < 32 || code === 127); |
| 15701 |
} |
| 15702 |
/** |
| 15703 |
* Check whether a character code is a markdown line ending. |
| 15704 |
* |
| 15705 |
* A **markdown line ending** is the virtual characters M-0003 CARRIAGE RETURN |
| 15706 |
* LINE FEED (CRLF), M-0004 LINE FEED (LF) and M-0005 CARRIAGE RETURN (CR). |
| 15707 |
* |
| 15708 |
* In micromark, the actual character U+000A LINE FEED (LF) and U+000D CARRIAGE |
| 15709 |
* RETURN (CR) are replaced by these virtual characters depending on whether |
| 15710 |
* they occurred together. |
| 15711 |
* |
| 15712 |
* @param {Code} code |
| 15713 |
* Code. |
| 15714 |
* @returns {boolean} |
| 15715 |
* Whether it matches. |
| 15716 |
*/ |
| 15717 |
function markdownLineEnding(code) { |
| 15718 |
return code !== null && code < -2; |
| 15719 |
} |
| 15720 |
/** |
| 15721 |
* Check whether a character code is a markdown line ending (see |
| 15722 |
* `markdownLineEnding`) or markdown space (see `markdownSpace`). |
| 15723 |
* |
| 15724 |
* @param {Code} code |
| 15725 |
* Code. |
| 15726 |
* @returns {boolean} |
| 15727 |
* Whether it matches. |
| 15728 |
*/ |
| 15729 |
function markdownLineEndingOrSpace(code) { |
| 15730 |
return code !== null && (code < 0 || code === 32); |
| 15731 |
} |
| 15732 |
/** |
| 15733 |
* Check whether a character code is a markdown space. |
| 15734 |
* |
| 15735 |
* A **markdown space** is the concrete character U+0020 SPACE (SP) and the |
| 15736 |
* virtual characters M-0001 VIRTUAL SPACE (VS) and M-0002 HORIZONTAL TAB (HT). |
| 15737 |
* |
| 15738 |
* In micromark, the actual character U+0009 CHARACTER TABULATION (HT) is |
| 15739 |
* replaced by one M-0002 HORIZONTAL TAB (HT) and between 0 and 3 M-0001 VIRTUAL |
| 15740 |
* SPACE (VS) characters, depending on the column at which the tab occurred. |
| 15741 |
* |
| 15742 |
* @param {Code} code |
| 15743 |
* Code. |
| 15744 |
* @returns {boolean} |
| 15745 |
* Whether it matches. |
| 15746 |
*/ |
| 15747 |
function markdownSpace(code) { |
| 15748 |
return code === -2 || code === -1 || code === 32; |
| 15749 |
} |
| 15750 |
/** |
| 15751 |
* Create a code check from a regex. |
| 15752 |
* |
| 15753 |
* @param {RegExp} regex |
| 15754 |
* @returns {(code: Code) => boolean} |
| 15755 |
*/ |
| 15756 |
function regexCheck(regex) { |
| 15757 |
return check; |
| 15758 |
/** |
| 15759 |
* Check whether a code matches the bound regex. |
| 15760 |
* |
| 15761 |
* @param {Code} code |
| 15762 |
* Character code. |
| 15763 |
* @returns {boolean} |
| 15764 |
* Whether the character code matches the bound regex. |
| 15765 |
*/ |
| 15766 |
function check(code) { |
| 15767 |
return code !== null && regex.test(String.fromCharCode(code)); |
| 15768 |
} |
| 15769 |
} |
| 15770 |
var asciiAlpha, asciiAlphanumeric, asciiAtext, asciiDigit, asciiHexDigit, asciiPunctuation, unicodePunctuation, unicodeWhitespace; |
| 15771 |
var init_micromark_util_character = __esmMin((() => { |
| 15772 |
init_unicode_punctuation_regex(); |
| 15773 |
asciiAlpha = regexCheck(/[A-Za-z]/); |
| 15774 |
asciiAlphanumeric = regexCheck(/[\dA-Za-z]/); |
| 15775 |
asciiAtext = regexCheck(/[#-'*+\--9=?A-Z^-~]/); |
| 15776 |
asciiDigit = regexCheck(/\d/); |
| 15777 |
asciiHexDigit = regexCheck(/[\dA-Fa-f]/); |
| 15778 |
asciiPunctuation = regexCheck(/[!-/:-@[-`{-~]/); |
| 15779 |
unicodePunctuation = regexCheck(unicodePunctuationRegex); |
| 15780 |
unicodeWhitespace = regexCheck(/\s/); |
| 15781 |
})); |
| 15782 |
|
| 15783 |
//#endregion |
| 15784 |
//#region node_modules/micromark-factory-space/index.js |
| 15785 |
/** |
| 15786 |
* Parse spaces and tabs. |
| 15787 |
* |
| 15788 |
* There is no `nok` parameter: |
| 15789 |
* |
| 15790 |
* * spaces in markdown are often optional, in which case this factory can be |
| 15791 |
* used and `ok` will be switched to whether spaces were found or not |
| 15792 |
* * one line ending or space can be detected with `markdownSpace(code)` right |
| 15793 |
* before using `factorySpace` |
| 15794 |
* |
| 15795 |
* ###### Examples |
| 15796 |
* |
| 15797 |
* Where `␉` represents a tab (plus how much it expands) and `␠` represents a |
| 15798 |
* single space. |
| 15799 |
* |
| 15800 |
* ```markdown |
| 15801 |
* ␉ |
| 15802 |
* ␠␠␠␠ |
| 15803 |
* ␉␠ |
| 15804 |
* ``` |
| 15805 |
* |
| 15806 |
* @param {Effects} effects |
| 15807 |
* Context. |
| 15808 |
* @param {State} ok |
| 15809 |
* State switched to when successful. |
| 15810 |
* @param {TokenType} type |
| 15811 |
* Type (`' \t'`). |
| 15812 |
* @param {number | undefined} [max=Infinity] |
| 15813 |
* Max (exclusive). |
| 15814 |
* @returns |
| 15815 |
* Start state. |
| 15816 |
*/ |
| 15817 |
function factorySpace(effects, ok, type, max) { |
| 15818 |
const limit = max ? max - 1 : Number.POSITIVE_INFINITY; |
| 15819 |
let size = 0; |
| 15820 |
return start; |
| 15821 |
/** @type {State} */ |
| 15822 |
function start(code) { |
| 15823 |
if (markdownSpace(code)) { |
| 15824 |
effects.enter(type); |
| 15825 |
return prefix(code); |
| 15826 |
} |
| 15827 |
return ok(code); |
| 15828 |
} |
| 15829 |
/** @type {State} */ |
| 15830 |
function prefix(code) { |
| 15831 |
if (markdownSpace(code) && size++ < limit) { |
| 15832 |
effects.consume(code); |
| 15833 |
return prefix; |
| 15834 |
} |
| 15835 |
effects.exit(type); |
| 15836 |
return ok(code); |
| 15837 |
} |
| 15838 |
} |
| 15839 |
var init_micromark_factory_space = __esmMin((() => { |
| 15840 |
init_micromark_util_character(); |
| 15841 |
})); |
| 15842 |
|
| 15843 |
//#endregion |
| 15844 |
//#region node_modules/micromark/lib/initialize/content.js |
| 15845 |
/** |
| 15846 |
* @this {TokenizeContext} |
| 15847 |
* @type {Initializer} |
| 15848 |
*/ |
| 15849 |
function initializeContent(effects) { |
| 15850 |
const contentStart = effects.attempt(this.parser.constructs.contentInitial, afterContentStartConstruct, paragraphInitial); |
| 15851 |
/** @type {Token} */ |
| 15852 |
let previous; |
| 15853 |
return contentStart; |
| 15854 |
/** @type {State} */ |
| 15855 |
function afterContentStartConstruct(code) { |
| 15856 |
if (code === null) { |
| 15857 |
effects.consume(code); |
| 15858 |
return; |
| 15859 |
} |
| 15860 |
effects.enter("lineEnding"); |
| 15861 |
effects.consume(code); |
| 15862 |
effects.exit("lineEnding"); |
| 15863 |
return factorySpace(effects, contentStart, "linePrefix"); |
| 15864 |
} |
| 15865 |
/** @type {State} */ |
| 15866 |
function paragraphInitial(code) { |
| 15867 |
effects.enter("paragraph"); |
| 15868 |
return lineStart(code); |
| 15869 |
} |
| 15870 |
/** @type {State} */ |
| 15871 |
function lineStart(code) { |
| 15872 |
const token = effects.enter("chunkText", { |
| 15873 |
contentType: "text", |
| 15874 |
previous |
| 15875 |
}); |
| 15876 |
if (previous) previous.next = token; |
| 15877 |
previous = token; |
| 15878 |
return data(code); |
| 15879 |
} |
| 15880 |
/** @type {State} */ |
| 15881 |
function data(code) { |
| 15882 |
if (code === null) { |
| 15883 |
effects.exit("chunkText"); |
| 15884 |
effects.exit("paragraph"); |
| 15885 |
effects.consume(code); |
| 15886 |
return; |
| 15887 |
} |
| 15888 |
if (markdownLineEnding(code)) { |
| 15889 |
effects.consume(code); |
| 15890 |
effects.exit("chunkText"); |
| 15891 |
return lineStart; |
| 15892 |
} |
| 15893 |
effects.consume(code); |
| 15894 |
return data; |
| 15895 |
} |
| 15896 |
} |
| 15897 |
var content$1; |
| 15898 |
var init_content$1 = __esmMin((() => { |
| 15899 |
init_micromark_factory_space(); |
| 15900 |
init_micromark_util_character(); |
| 15901 |
content$1 = { tokenize: initializeContent }; |
| 15902 |
})); |
| 15903 |
|
| 15904 |
//#endregion |
| 15905 |
//#region node_modules/micromark/lib/initialize/document.js |
| 15906 |
/** |
| 15907 |
* @this {TokenizeContext} |
| 15908 |
* @type {Initializer} |
| 15909 |
*/ |
| 15910 |
function initializeDocument(effects) { |
| 15911 |
const self = this; |
| 15912 |
/** @type {Array<StackItem>} */ |
| 15913 |
const stack = []; |
| 15914 |
let continued = 0; |
| 15915 |
/** @type {TokenizeContext | undefined} */ |
| 15916 |
let childFlow; |
| 15917 |
/** @type {Token | undefined} */ |
| 15918 |
let childToken; |
| 15919 |
/** @type {number} */ |
| 15920 |
let lineStartOffset; |
| 15921 |
return start; |
| 15922 |
/** @type {State} */ |
| 15923 |
function start(code) { |
| 15924 |
if (continued < stack.length) { |
| 15925 |
const item = stack[continued]; |
| 15926 |
self.containerState = item[1]; |
| 15927 |
return effects.attempt(item[0].continuation, documentContinue, checkNewContainers)(code); |
| 15928 |
} |
| 15929 |
return checkNewContainers(code); |
| 15930 |
} |
| 15931 |
/** @type {State} */ |
| 15932 |
function documentContinue(code) { |
| 15933 |
continued++; |
| 15934 |
if (self.containerState._closeFlow) { |
| 15935 |
self.containerState._closeFlow = void 0; |
| 15936 |
if (childFlow) closeFlow(); |
| 15937 |
const indexBeforeExits = self.events.length; |
| 15938 |
let indexBeforeFlow = indexBeforeExits; |
| 15939 |
/** @type {Point | undefined} */ |
| 15940 |
let point; |
| 15941 |
while (indexBeforeFlow--) if (self.events[indexBeforeFlow][0] === "exit" && self.events[indexBeforeFlow][1].type === "chunkFlow") { |
| 15942 |
point = self.events[indexBeforeFlow][1].end; |
| 15943 |
break; |
| 15944 |
} |
| 15945 |
exitContainers(continued); |
| 15946 |
let index = indexBeforeExits; |
| 15947 |
while (index < self.events.length) { |
| 15948 |
self.events[index][1].end = Object.assign({}, point); |
| 15949 |
index++; |
| 15950 |
} |
| 15951 |
splice(self.events, indexBeforeFlow + 1, 0, self.events.slice(indexBeforeExits)); |
| 15952 |
self.events.length = index; |
| 15953 |
return checkNewContainers(code); |
| 15954 |
} |
| 15955 |
return start(code); |
| 15956 |
} |
| 15957 |
/** @type {State} */ |
| 15958 |
function checkNewContainers(code) { |
| 15959 |
if (continued === stack.length) { |
| 15960 |
if (!childFlow) return documentContinued(code); |
| 15961 |
if (childFlow.currentConstruct && childFlow.currentConstruct.concrete) return flowStart(code); |
| 15962 |
self.interrupt = Boolean(childFlow.currentConstruct && !childFlow._gfmTableDynamicInterruptHack); |
| 15963 |
} |
| 15964 |
self.containerState = {}; |
| 15965 |
return effects.check(containerConstruct, thereIsANewContainer, thereIsNoNewContainer)(code); |
| 15966 |
} |
| 15967 |
/** @type {State} */ |
| 15968 |
function thereIsANewContainer(code) { |
| 15969 |
if (childFlow) closeFlow(); |
| 15970 |
exitContainers(continued); |
| 15971 |
return documentContinued(code); |
| 15972 |
} |
| 15973 |
/** @type {State} */ |
| 15974 |
function thereIsNoNewContainer(code) { |
| 15975 |
self.parser.lazy[self.now().line] = continued !== stack.length; |
| 15976 |
lineStartOffset = self.now().offset; |
| 15977 |
return flowStart(code); |
| 15978 |
} |
| 15979 |
/** @type {State} */ |
| 15980 |
function documentContinued(code) { |
| 15981 |
self.containerState = {}; |
| 15982 |
return effects.attempt(containerConstruct, containerContinue, flowStart)(code); |
| 15983 |
} |
| 15984 |
/** @type {State} */ |
| 15985 |
function containerContinue(code) { |
| 15986 |
continued++; |
| 15987 |
stack.push([self.currentConstruct, self.containerState]); |
| 15988 |
return documentContinued(code); |
| 15989 |
} |
| 15990 |
/** @type {State} */ |
| 15991 |
function flowStart(code) { |
| 15992 |
if (code === null) { |
| 15993 |
if (childFlow) closeFlow(); |
| 15994 |
exitContainers(0); |
| 15995 |
effects.consume(code); |
| 15996 |
return; |
| 15997 |
} |
| 15998 |
childFlow = childFlow || self.parser.flow(self.now()); |
| 15999 |
effects.enter("chunkFlow", { |
| 16000 |
contentType: "flow", |
| 16001 |
previous: childToken, |
| 16002 |
_tokenizer: childFlow |
| 16003 |
}); |
| 16004 |
return flowContinue(code); |
| 16005 |
} |
| 16006 |
/** @type {State} */ |
| 16007 |
function flowContinue(code) { |
| 16008 |
if (code === null) { |
| 16009 |
writeToChild(effects.exit("chunkFlow"), true); |
| 16010 |
exitContainers(0); |
| 16011 |
effects.consume(code); |
| 16012 |
return; |
| 16013 |
} |
| 16014 |
if (markdownLineEnding(code)) { |
| 16015 |
effects.consume(code); |
| 16016 |
writeToChild(effects.exit("chunkFlow")); |
| 16017 |
continued = 0; |
| 16018 |
self.interrupt = void 0; |
| 16019 |
return start; |
| 16020 |
} |
| 16021 |
effects.consume(code); |
| 16022 |
return flowContinue; |
| 16023 |
} |
| 16024 |
/** |
| 16025 |
* @param {Token} token |
| 16026 |
* @param {boolean | undefined} [eof] |
| 16027 |
* @returns {void} |
| 16028 |
*/ |
| 16029 |
function writeToChild(token, eof) { |
| 16030 |
const stream = self.sliceStream(token); |
| 16031 |
if (eof) stream.push(null); |
| 16032 |
token.previous = childToken; |
| 16033 |
if (childToken) childToken.next = token; |
| 16034 |
childToken = token; |
| 16035 |
childFlow.defineSkip(token.start); |
| 16036 |
childFlow.write(stream); |
| 16037 |
if (self.parser.lazy[token.start.line]) { |
| 16038 |
let index = childFlow.events.length; |
| 16039 |
while (index--) if (childFlow.events[index][1].start.offset < lineStartOffset && (!childFlow.events[index][1].end || childFlow.events[index][1].end.offset > lineStartOffset)) return; |
| 16040 |
const indexBeforeExits = self.events.length; |
| 16041 |
let indexBeforeFlow = indexBeforeExits; |
| 16042 |
/** @type {boolean | undefined} */ |
| 16043 |
let seen; |
| 16044 |
/** @type {Point | undefined} */ |
| 16045 |
let point; |
| 16046 |
while (indexBeforeFlow--) if (self.events[indexBeforeFlow][0] === "exit" && self.events[indexBeforeFlow][1].type === "chunkFlow") { |
| 16047 |
if (seen) { |
| 16048 |
point = self.events[indexBeforeFlow][1].end; |
| 16049 |
break; |
| 16050 |
} |
| 16051 |
seen = true; |
| 16052 |
} |
| 16053 |
exitContainers(continued); |
| 16054 |
index = indexBeforeExits; |
| 16055 |
while (index < self.events.length) { |
| 16056 |
self.events[index][1].end = Object.assign({}, point); |
| 16057 |
index++; |
| 16058 |
} |
| 16059 |
splice(self.events, indexBeforeFlow + 1, 0, self.events.slice(indexBeforeExits)); |
| 16060 |
self.events.length = index; |
| 16061 |
} |
| 16062 |
} |
| 16063 |
/** |
| 16064 |
* @param {number} size |
| 16065 |
* @returns {void} |
| 16066 |
*/ |
| 16067 |
function exitContainers(size) { |
| 16068 |
let index = stack.length; |
| 16069 |
while (index-- > size) { |
| 16070 |
const entry = stack[index]; |
| 16071 |
self.containerState = entry[1]; |
| 16072 |
entry[0].exit.call(self, effects); |
| 16073 |
} |
| 16074 |
stack.length = size; |
| 16075 |
} |
| 16076 |
function closeFlow() { |
| 16077 |
childFlow.write([null]); |
| 16078 |
childToken = void 0; |
| 16079 |
childFlow = void 0; |
| 16080 |
self.containerState._closeFlow = void 0; |
| 16081 |
} |
| 16082 |
} |
| 16083 |
/** |
| 16084 |
* @this {TokenizeContext} |
| 16085 |
* @type {Tokenizer} |
| 16086 |
*/ |
| 16087 |
function tokenizeContainer(effects, ok, nok) { |
| 16088 |
return factorySpace(effects, effects.attempt(this.parser.constructs.document, ok, nok), "linePrefix", this.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4); |
| 16089 |
} |
| 16090 |
var document$2, containerConstruct; |
| 16091 |
var init_document = __esmMin((() => { |
| 16092 |
init_micromark_factory_space(); |
| 16093 |
init_micromark_util_character(); |
| 16094 |
init_micromark_util_chunked(); |
| 16095 |
document$2 = { tokenize: initializeDocument }; |
| 16096 |
containerConstruct = { tokenize: tokenizeContainer }; |
| 16097 |
})); |
| 16098 |
|
| 16099 |
//#endregion |
| 16100 |
//#region node_modules/micromark-util-classify-character/index.js |
| 16101 |
/** |
| 16102 |
* Classify whether a code represents whitespace, punctuation, or something |
| 16103 |
* else. |
| 16104 |
* |
| 16105 |
* Used for attention (emphasis, strong), whose sequences can open or close |
| 16106 |
* based on the class of surrounding characters. |
| 16107 |
* |
| 16108 |
* > 👉 **Note**: eof (`null`) is seen as whitespace. |
| 16109 |
* |
| 16110 |
* @param {Code} code |
| 16111 |
* Code. |
| 16112 |
* @returns {typeof constants.characterGroupWhitespace | typeof constants.characterGroupPunctuation | undefined} |
| 16113 |
* Group. |
| 16114 |
*/ |
| 16115 |
function classifyCharacter(code) { |
| 16116 |
if (code === null || markdownLineEndingOrSpace(code) || unicodeWhitespace(code)) return 1; |
| 16117 |
if (unicodePunctuation(code)) return 2; |
| 16118 |
} |
| 16119 |
var init_micromark_util_classify_character = __esmMin((() => { |
| 16120 |
init_micromark_util_character(); |
| 16121 |
})); |
| 16122 |
|
| 16123 |
//#endregion |
| 16124 |
//#region node_modules/micromark-util-resolve-all/index.js |
| 16125 |
/** |
| 16126 |
* @typedef {import('micromark-util-types').Event} Event |
| 16127 |
* @typedef {import('micromark-util-types').Resolver} Resolver |
| 16128 |
* @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext |
| 16129 |
*/ |
| 16130 |
/** |
| 16131 |
* Call all `resolveAll`s. |
| 16132 |
* |
| 16133 |
* @param {Array<{resolveAll?: Resolver | undefined}>} constructs |
| 16134 |
* List of constructs, optionally with `resolveAll`s. |
| 16135 |
* @param {Array<Event>} events |
| 16136 |
* List of events. |
| 16137 |
* @param {TokenizeContext} context |
| 16138 |
* Context used by `tokenize`. |
| 16139 |
* @returns {Array<Event>} |
| 16140 |
* Changed events. |
| 16141 |
*/ |
| 16142 |
function resolveAll(constructs, events, context) { |
| 16143 |
/** @type {Array<Resolver>} */ |
| 16144 |
const called = []; |
| 16145 |
let index = -1; |
| 16146 |
while (++index < constructs.length) { |
| 16147 |
const resolve = constructs[index].resolveAll; |
| 16148 |
if (resolve && !called.includes(resolve)) { |
| 16149 |
events = resolve(events, context); |
| 16150 |
called.push(resolve); |
| 16151 |
} |
| 16152 |
} |
| 16153 |
return events; |
| 16154 |
} |
| 16155 |
var init_micromark_util_resolve_all = __esmMin((() => {})); |
| 16156 |
|
| 16157 |
//#endregion |
| 16158 |
//#region node_modules/micromark-core-commonmark/lib/attention.js |
| 16159 |
/** |
| 16160 |
* Take all events and resolve attention to emphasis or strong. |
| 16161 |
* |
| 16162 |
* @type {Resolver} |
| 16163 |
*/ |
| 16164 |
function resolveAllAttention(events, context) { |
| 16165 |
let index = -1; |
| 16166 |
/** @type {number} */ |
| 16167 |
let open; |
| 16168 |
/** @type {Token} */ |
| 16169 |
let group; |
| 16170 |
/** @type {Token} */ |
| 16171 |
let text; |
| 16172 |
/** @type {Token} */ |
| 16173 |
let openingSequence; |
| 16174 |
/** @type {Token} */ |
| 16175 |
let closingSequence; |
| 16176 |
/** @type {number} */ |
| 16177 |
let use; |
| 16178 |
/** @type {Array<Event>} */ |
| 16179 |
let nextEvents; |
| 16180 |
/** @type {number} */ |
| 16181 |
let offset; |
| 16182 |
while (++index < events.length) if (events[index][0] === "enter" && events[index][1].type === "attentionSequence" && events[index][1]._close) { |
| 16183 |
open = index; |
| 16184 |
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)) { |
| 16185 |
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; |
| 16186 |
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; |
| 16187 |
const start = Object.assign({}, events[open][1].end); |
| 16188 |
const end = Object.assign({}, events[index][1].start); |
| 16189 |
movePoint(start, -use); |
| 16190 |
movePoint(end, use); |
| 16191 |
openingSequence = { |
| 16192 |
type: use > 1 ? "strongSequence" : "emphasisSequence", |
| 16193 |
start, |
| 16194 |
end: Object.assign({}, events[open][1].end) |
| 16195 |
}; |
| 16196 |
closingSequence = { |
| 16197 |
type: use > 1 ? "strongSequence" : "emphasisSequence", |
| 16198 |
start: Object.assign({}, events[index][1].start), |
| 16199 |
end |
| 16200 |
}; |
| 16201 |
text = { |
| 16202 |
type: use > 1 ? "strongText" : "emphasisText", |
| 16203 |
start: Object.assign({}, events[open][1].end), |
| 16204 |
end: Object.assign({}, events[index][1].start) |
| 16205 |
}; |
| 16206 |
group = { |
| 16207 |
type: use > 1 ? "strong" : "emphasis", |
| 16208 |
start: Object.assign({}, openingSequence.start), |
| 16209 |
end: Object.assign({}, closingSequence.end) |
| 16210 |
}; |
| 16211 |
events[open][1].end = Object.assign({}, openingSequence.start); |
| 16212 |
events[index][1].start = Object.assign({}, closingSequence.end); |
| 16213 |
nextEvents = []; |
| 16214 |
if (events[open][1].end.offset - events[open][1].start.offset) nextEvents = push(nextEvents, [[ |
| 16215 |
"enter", |
| 16216 |
events[open][1], |
| 16217 |
context |
| 16218 |
], [ |
| 16219 |
"exit", |
| 16220 |
events[open][1], |
| 16221 |
context |
| 16222 |
]]); |
| 16223 |
nextEvents = push(nextEvents, [ |
| 16224 |
[ |
| 16225 |
"enter", |
| 16226 |
group, |
| 16227 |
context |
| 16228 |
], |
| 16229 |
[ |
| 16230 |
"enter", |
| 16231 |
openingSequence, |
| 16232 |
context |
| 16233 |
], |
| 16234 |
[ |
| 16235 |
"exit", |
| 16236 |
openingSequence, |
| 16237 |
context |
| 16238 |
], |
| 16239 |
[ |
| 16240 |
"enter", |
| 16241 |
text, |
| 16242 |
context |
| 16243 |
] |
| 16244 |
]); |
| 16245 |
nextEvents = push(nextEvents, resolveAll(context.parser.constructs.insideSpan.null, events.slice(open + 1, index), context)); |
| 16246 |
nextEvents = push(nextEvents, [ |
| 16247 |
[ |
| 16248 |
"exit", |
| 16249 |
text, |
| 16250 |
context |
| 16251 |
], |
| 16252 |
[ |
| 16253 |
"enter", |
| 16254 |
closingSequence, |
| 16255 |
context |
| 16256 |
], |
| 16257 |
[ |
| 16258 |
"exit", |
| 16259 |
closingSequence, |
| 16260 |
context |
| 16261 |
], |
| 16262 |
[ |
| 16263 |
"exit", |
| 16264 |
group, |
| 16265 |
context |
| 16266 |
] |
| 16267 |
]); |
| 16268 |
if (events[index][1].end.offset - events[index][1].start.offset) { |
| 16269 |
offset = 2; |
| 16270 |
nextEvents = push(nextEvents, [[ |
| 16271 |
"enter", |
| 16272 |
events[index][1], |
| 16273 |
context |
| 16274 |
], [ |
| 16275 |
"exit", |
| 16276 |
events[index][1], |
| 16277 |
context |
| 16278 |
]]); |
| 16279 |
} else offset = 0; |
| 16280 |
splice(events, open - 1, index - open + 3, nextEvents); |
| 16281 |
index = open + nextEvents.length - offset - 2; |
| 16282 |
break; |
| 16283 |
} |
| 16284 |
} |
| 16285 |
index = -1; |
| 16286 |
while (++index < events.length) if (events[index][1].type === "attentionSequence") events[index][1].type = "data"; |
| 16287 |
return events; |
| 16288 |
} |
| 16289 |
/** |
| 16290 |
* @this {TokenizeContext} |
| 16291 |
* @type {Tokenizer} |
| 16292 |
*/ |
| 16293 |
function tokenizeAttention(effects, ok) { |
| 16294 |
const attentionMarkers = this.parser.constructs.attentionMarkers.null; |
| 16295 |
const previous = this.previous; |
| 16296 |
const before = classifyCharacter(previous); |
| 16297 |
/** @type {NonNullable<Code>} */ |
| 16298 |
let marker; |
| 16299 |
return start; |
| 16300 |
/** |
| 16301 |
* Before a sequence. |
| 16302 |
* |
| 16303 |
* ```markdown |
| 16304 |
* > | ** |
| 16305 |
* ^ |
| 16306 |
* ``` |
| 16307 |
* |
| 16308 |
* @type {State} |
| 16309 |
*/ |
| 16310 |
function start(code) { |
| 16311 |
marker = code; |
| 16312 |
effects.enter("attentionSequence"); |
| 16313 |
return inside(code); |
| 16314 |
} |
| 16315 |
/** |
| 16316 |
* In a sequence. |
| 16317 |
* |
| 16318 |
* ```markdown |
| 16319 |
* > | ** |
| 16320 |
* ^^ |
| 16321 |
* ``` |
| 16322 |
* |
| 16323 |
* @type {State} |
| 16324 |
*/ |
| 16325 |
function inside(code) { |
| 16326 |
if (code === marker) { |
| 16327 |
effects.consume(code); |
| 16328 |
return inside; |
| 16329 |
} |
| 16330 |
const token = effects.exit("attentionSequence"); |
| 16331 |
const after = classifyCharacter(code); |
| 16332 |
const open = !after || after === 2 && before || attentionMarkers.includes(code); |
| 16333 |
const close = !before || before === 2 && after || attentionMarkers.includes(previous); |
| 16334 |
token._open = Boolean(marker === 42 ? open : open && (before || !close)); |
| 16335 |
token._close = Boolean(marker === 42 ? close : close && (after || !open)); |
| 16336 |
return ok(code); |
| 16337 |
} |
| 16338 |
} |
| 16339 |
/** |
| 16340 |
* Move a point a bit. |
| 16341 |
* |
| 16342 |
* Note: `move` only works inside lines! It’s not possible to move past other |
| 16343 |
* chunks (replacement characters, tabs, or line endings). |
| 16344 |
* |
| 16345 |
* @param {Point} point |
| 16346 |
* @param {number} offset |
| 16347 |
* @returns {void} |
| 16348 |
*/ |
| 16349 |
function movePoint(point, offset) { |
| 16350 |
point.column += offset; |
| 16351 |
point.offset += offset; |
| 16352 |
point._bufferIndex += offset; |
| 16353 |
} |
| 16354 |
var attention; |
| 16355 |
var init_attention = __esmMin((() => { |
| 16356 |
init_micromark_util_chunked(); |
| 16357 |
init_micromark_util_classify_character(); |
| 16358 |
init_micromark_util_resolve_all(); |
| 16359 |
attention = { |
| 16360 |
name: "attention", |
| 16361 |
tokenize: tokenizeAttention, |
| 16362 |
resolveAll: resolveAllAttention |
| 16363 |
}; |
| 16364 |
})); |
| 16365 |
|
| 16366 |
//#endregion |
| 16367 |
//#region node_modules/micromark-core-commonmark/lib/autolink.js |
| 16368 |
/** |
| 16369 |
* @this {TokenizeContext} |
| 16370 |
* @type {Tokenizer} |
| 16371 |
*/ |
| 16372 |
function tokenizeAutolink(effects, ok, nok) { |
| 16373 |
let size = 0; |
| 16374 |
return start; |
| 16375 |
/** |
| 16376 |
* Start of an autolink. |
| 16377 |
* |
| 16378 |
* ```markdown |
| 16379 |
* > | a<https://example.com>b |
| 16380 |
* ^ |
| 16381 |
* > | a<user@example.com>b |
| 16382 |
* ^ |
| 16383 |
* ``` |
| 16384 |
* |
| 16385 |
* @type {State} |
| 16386 |
*/ |
| 16387 |
function start(code) { |
| 16388 |
effects.enter("autolink"); |
| 16389 |
effects.enter("autolinkMarker"); |
| 16390 |
effects.consume(code); |
| 16391 |
effects.exit("autolinkMarker"); |
| 16392 |
effects.enter("autolinkProtocol"); |
| 16393 |
return open; |
| 16394 |
} |
| 16395 |
/** |
| 16396 |
* After `<`, at protocol or atext. |
| 16397 |
* |
| 16398 |
* ```markdown |
| 16399 |
* > | a<https://example.com>b |
| 16400 |
* ^ |
| 16401 |
* > | a<user@example.com>b |
| 16402 |
* ^ |
| 16403 |
* ``` |
| 16404 |
* |
| 16405 |
* @type {State} |
| 16406 |
*/ |
| 16407 |
function open(code) { |
| 16408 |
if (asciiAlpha(code)) { |
| 16409 |
effects.consume(code); |
| 16410 |
return schemeOrEmailAtext; |
| 16411 |
} |
| 16412 |
return emailAtext(code); |
| 16413 |
} |
| 16414 |
/** |
| 16415 |
* At second byte of protocol or atext. |
| 16416 |
* |
| 16417 |
* ```markdown |
| 16418 |
* > | a<https://example.com>b |
| 16419 |
* ^ |
| 16420 |
* > | a<user@example.com>b |
| 16421 |
* ^ |
| 16422 |
* ``` |
| 16423 |
* |
| 16424 |
* @type {State} |
| 16425 |
*/ |
| 16426 |
function schemeOrEmailAtext(code) { |
| 16427 |
if (code === 43 || code === 45 || code === 46 || asciiAlphanumeric(code)) { |
| 16428 |
size = 1; |
| 16429 |
return schemeInsideOrEmailAtext(code); |
| 16430 |
} |
| 16431 |
return emailAtext(code); |
| 16432 |
} |
| 16433 |
/** |
| 16434 |
* In ambiguous protocol or atext. |
| 16435 |
* |
| 16436 |
* ```markdown |
| 16437 |
* > | a<https://example.com>b |
| 16438 |
* ^ |
| 16439 |
* > | a<user@example.com>b |
| 16440 |
* ^ |
| 16441 |
* ``` |
| 16442 |
* |
| 16443 |
* @type {State} |
| 16444 |
*/ |
| 16445 |
function schemeInsideOrEmailAtext(code) { |
| 16446 |
if (code === 58) { |
| 16447 |
effects.consume(code); |
| 16448 |
size = 0; |
| 16449 |
return urlInside; |
| 16450 |
} |
| 16451 |
if ((code === 43 || code === 45 || code === 46 || asciiAlphanumeric(code)) && size++ < 32) { |
| 16452 |
effects.consume(code); |
| 16453 |
return schemeInsideOrEmailAtext; |
| 16454 |
} |
| 16455 |
size = 0; |
| 16456 |
return emailAtext(code); |
| 16457 |
} |
| 16458 |
/** |
| 16459 |
* After protocol, in URL. |
| 16460 |
* |
| 16461 |
* ```markdown |
| 16462 |
* > | a<https://example.com>b |
| 16463 |
* ^ |
| 16464 |
* ``` |
| 16465 |
* |
| 16466 |
* @type {State} |
| 16467 |
*/ |
| 16468 |
function urlInside(code) { |
| 16469 |
if (code === 62) { |
| 16470 |
effects.exit("autolinkProtocol"); |
| 16471 |
effects.enter("autolinkMarker"); |
| 16472 |
effects.consume(code); |
| 16473 |
effects.exit("autolinkMarker"); |
| 16474 |
effects.exit("autolink"); |
| 16475 |
return ok; |
| 16476 |
} |
| 16477 |
if (code === null || code === 32 || code === 60 || asciiControl(code)) return nok(code); |
| 16478 |
effects.consume(code); |
| 16479 |
return urlInside; |
| 16480 |
} |
| 16481 |
/** |
| 16482 |
* In email atext. |
| 16483 |
* |
| 16484 |
* ```markdown |
| 16485 |
* > | a<user.name@example.com>b |
| 16486 |
* ^ |
| 16487 |
* ``` |
| 16488 |
* |
| 16489 |
* @type {State} |
| 16490 |
*/ |
| 16491 |
function emailAtext(code) { |
| 16492 |
if (code === 64) { |
| 16493 |
effects.consume(code); |
| 16494 |
return emailAtSignOrDot; |
| 16495 |
} |
| 16496 |
if (asciiAtext(code)) { |
| 16497 |
effects.consume(code); |
| 16498 |
return emailAtext; |
| 16499 |
} |
| 16500 |
return nok(code); |
| 16501 |
} |
| 16502 |
/** |
| 16503 |
* In label, after at-sign or dot. |
| 16504 |
* |
| 16505 |
* ```markdown |
| 16506 |
* > | a<user.name@example.com>b |
| 16507 |
* ^ ^ |
| 16508 |
* ``` |
| 16509 |
* |
| 16510 |
* @type {State} |
| 16511 |
*/ |
| 16512 |
function emailAtSignOrDot(code) { |
| 16513 |
return asciiAlphanumeric(code) ? emailLabel(code) : nok(code); |
| 16514 |
} |
| 16515 |
/** |
| 16516 |
* In label, where `.` and `>` are allowed. |
| 16517 |
* |
| 16518 |
* ```markdown |
| 16519 |
* > | a<user.name@example.com>b |
| 16520 |
* ^ |
| 16521 |
* ``` |
| 16522 |
* |
| 16523 |
* @type {State} |
| 16524 |
*/ |
| 16525 |
function emailLabel(code) { |
| 16526 |
if (code === 46) { |
| 16527 |
effects.consume(code); |
| 16528 |
size = 0; |
| 16529 |
return emailAtSignOrDot; |
| 16530 |
} |
| 16531 |
if (code === 62) { |
| 16532 |
effects.exit("autolinkProtocol").type = "autolinkEmail"; |
| 16533 |
effects.enter("autolinkMarker"); |
| 16534 |
effects.consume(code); |
| 16535 |
effects.exit("autolinkMarker"); |
| 16536 |
effects.exit("autolink"); |
| 16537 |
return ok; |
| 16538 |
} |
| 16539 |
return emailValue(code); |
| 16540 |
} |
| 16541 |
/** |
| 16542 |
* In label, where `.` and `>` are *not* allowed. |
| 16543 |
* |
| 16544 |
* Though, this is also used in `emailLabel` to parse other values. |
| 16545 |
* |
| 16546 |
* ```markdown |
| 16547 |
* > | a<user.name@ex-ample.com>b |
| 16548 |
* ^ |
| 16549 |
* ``` |
| 16550 |
* |
| 16551 |
* @type {State} |
| 16552 |
*/ |
| 16553 |
function emailValue(code) { |
| 16554 |
if ((code === 45 || asciiAlphanumeric(code)) && size++ < 63) { |
| 16555 |
const next = code === 45 ? emailValue : emailLabel; |
| 16556 |
effects.consume(code); |
| 16557 |
return next; |
| 16558 |
} |
| 16559 |
return nok(code); |
| 16560 |
} |
| 16561 |
} |
| 16562 |
var autolink; |
| 16563 |
var init_autolink = __esmMin((() => { |
| 16564 |
init_micromark_util_character(); |
| 16565 |
autolink = { |
| 16566 |
name: "autolink", |
| 16567 |
tokenize: tokenizeAutolink |
| 16568 |
}; |
| 16569 |
})); |
| 16570 |
|
| 16571 |
//#endregion |
| 16572 |
//#region node_modules/micromark-core-commonmark/lib/blank-line.js |
| 16573 |
/** |
| 16574 |
* @this {TokenizeContext} |
| 16575 |
* @type {Tokenizer} |
| 16576 |
*/ |
| 16577 |
function tokenizeBlankLine(effects, ok, nok) { |
| 16578 |
return start; |
| 16579 |
/** |
| 16580 |
* Start of blank line. |
| 16581 |
* |
| 16582 |
* > 👉 **Note**: `␠` represents a space character. |
| 16583 |
* |
| 16584 |
* ```markdown |
| 16585 |
* > | ␠␠␊ |
| 16586 |
* ^ |
| 16587 |
* > | ␊ |
| 16588 |
* ^ |
| 16589 |
* ``` |
| 16590 |
* |
| 16591 |
* @type {State} |
| 16592 |
*/ |
| 16593 |
function start(code) { |
| 16594 |
return markdownSpace(code) ? factorySpace(effects, after, "linePrefix")(code) : after(code); |
| 16595 |
} |
| 16596 |
/** |
| 16597 |
* At eof/eol, after optional whitespace. |
| 16598 |
* |
| 16599 |
* > 👉 **Note**: `␠` represents a space character. |
| 16600 |
* |
| 16601 |
* ```markdown |
| 16602 |
* > | ␠␠␊ |
| 16603 |
* ^ |
| 16604 |
* > | ␊ |
| 16605 |
* ^ |
| 16606 |
* ``` |
| 16607 |
* |
| 16608 |
* @type {State} |
| 16609 |
*/ |
| 16610 |
function after(code) { |
| 16611 |
return code === null || markdownLineEnding(code) ? ok(code) : nok(code); |
| 16612 |
} |
| 16613 |
} |
| 16614 |
var blankLine; |
| 16615 |
var init_blank_line = __esmMin((() => { |
| 16616 |
init_micromark_factory_space(); |
| 16617 |
init_micromark_util_character(); |
| 16618 |
blankLine = { |
| 16619 |
tokenize: tokenizeBlankLine, |
| 16620 |
partial: true |
| 16621 |
}; |
| 16622 |
})); |
| 16623 |
|
| 16624 |
//#endregion |
| 16625 |
//#region node_modules/micromark-core-commonmark/lib/block-quote.js |
| 16626 |
/** |
| 16627 |
* @this {TokenizeContext} |
| 16628 |
* @type {Tokenizer} |
| 16629 |
*/ |
| 16630 |
function tokenizeBlockQuoteStart(effects, ok, nok) { |
| 16631 |
const self = this; |
| 16632 |
return start; |
| 16633 |
/** |
| 16634 |
* Start of block quote. |
| 16635 |
* |
| 16636 |
* ```markdown |
| 16637 |
* > | > a |
| 16638 |
* ^ |
| 16639 |
* ``` |
| 16640 |
* |
| 16641 |
* @type {State} |
| 16642 |
*/ |
| 16643 |
function start(code) { |
| 16644 |
if (code === 62) { |
| 16645 |
const state = self.containerState; |
| 16646 |
if (!state.open) { |
| 16647 |
effects.enter("blockQuote", { _container: true }); |
| 16648 |
state.open = true; |
| 16649 |
} |
| 16650 |
effects.enter("blockQuotePrefix"); |
| 16651 |
effects.enter("blockQuoteMarker"); |
| 16652 |
effects.consume(code); |
| 16653 |
effects.exit("blockQuoteMarker"); |
| 16654 |
return after; |
| 16655 |
} |
| 16656 |
return nok(code); |
| 16657 |
} |
| 16658 |
/** |
| 16659 |
* After `>`, before optional whitespace. |
| 16660 |
* |
| 16661 |
* ```markdown |
| 16662 |
* > | > a |
| 16663 |
* ^ |
| 16664 |
* ``` |
| 16665 |
* |
| 16666 |
* @type {State} |
| 16667 |
*/ |
| 16668 |
function after(code) { |
| 16669 |
if (markdownSpace(code)) { |
| 16670 |
effects.enter("blockQuotePrefixWhitespace"); |
| 16671 |
effects.consume(code); |
| 16672 |
effects.exit("blockQuotePrefixWhitespace"); |
| 16673 |
effects.exit("blockQuotePrefix"); |
| 16674 |
return ok; |
| 16675 |
} |
| 16676 |
effects.exit("blockQuotePrefix"); |
| 16677 |
return ok(code); |
| 16678 |
} |
| 16679 |
} |
| 16680 |
/** |
| 16681 |
* Start of block quote continuation. |
| 16682 |
* |
| 16683 |
* ```markdown |
| 16684 |
* | > a |
| 16685 |
* > | > b |
| 16686 |
* ^ |
| 16687 |
* ``` |
| 16688 |
* |
| 16689 |
* @this {TokenizeContext} |
| 16690 |
* @type {Tokenizer} |
| 16691 |
*/ |
| 16692 |
function tokenizeBlockQuoteContinuation(effects, ok, nok) { |
| 16693 |
const self = this; |
| 16694 |
return contStart; |
| 16695 |
/** |
| 16696 |
* Start of block quote continuation. |
| 16697 |
* |
| 16698 |
* Also used to parse the first block quote opening. |
| 16699 |
* |
| 16700 |
* ```markdown |
| 16701 |
* | > a |
| 16702 |
* > | > b |
| 16703 |
* ^ |
| 16704 |
* ``` |
| 16705 |
* |
| 16706 |
* @type {State} |
| 16707 |
*/ |
| 16708 |
function contStart(code) { |
| 16709 |
if (markdownSpace(code)) return factorySpace(effects, contBefore, "linePrefix", self.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4)(code); |
| 16710 |
return contBefore(code); |
| 16711 |
} |
| 16712 |
/** |
| 16713 |
* At `>`, after optional whitespace. |
| 16714 |
* |
| 16715 |
* Also used to parse the first block quote opening. |
| 16716 |
* |
| 16717 |
* ```markdown |
| 16718 |
* | > a |
| 16719 |
* > | > b |
| 16720 |
* ^ |
| 16721 |
* ``` |
| 16722 |
* |
| 16723 |
* @type {State} |
| 16724 |
*/ |
| 16725 |
function contBefore(code) { |
| 16726 |
return effects.attempt(blockQuote, ok, nok)(code); |
| 16727 |
} |
| 16728 |
} |
| 16729 |
/** @type {Exiter} */ |
| 16730 |
function exit(effects) { |
| 16731 |
effects.exit("blockQuote"); |
| 16732 |
} |
| 16733 |
var blockQuote; |
| 16734 |
var init_block_quote = __esmMin((() => { |
| 16735 |
init_micromark_factory_space(); |
| 16736 |
init_micromark_util_character(); |
| 16737 |
blockQuote = { |
| 16738 |
name: "blockQuote", |
| 16739 |
tokenize: tokenizeBlockQuoteStart, |
| 16740 |
continuation: { tokenize: tokenizeBlockQuoteContinuation }, |
| 16741 |
exit |
| 16742 |
}; |
| 16743 |
})); |
| 16744 |
|
| 16745 |
//#endregion |
| 16746 |
//#region node_modules/micromark-core-commonmark/lib/character-escape.js |
| 16747 |
/** |
| 16748 |
* @this {TokenizeContext} |
| 16749 |
* @type {Tokenizer} |
| 16750 |
*/ |
| 16751 |
function tokenizeCharacterEscape(effects, ok, nok) { |
| 16752 |
return start; |
| 16753 |
/** |
| 16754 |
* Start of character escape. |
| 16755 |
* |
| 16756 |
* ```markdown |
| 16757 |
* > | a\*b |
| 16758 |
* ^ |
| 16759 |
* ``` |
| 16760 |
* |
| 16761 |
* @type {State} |
| 16762 |
*/ |
| 16763 |
function start(code) { |
| 16764 |
effects.enter("characterEscape"); |
| 16765 |
effects.enter("escapeMarker"); |
| 16766 |
effects.consume(code); |
| 16767 |
effects.exit("escapeMarker"); |
| 16768 |
return inside; |
| 16769 |
} |
| 16770 |
/** |
| 16771 |
* After `\`, at punctuation. |
| 16772 |
* |
| 16773 |
* ```markdown |
| 16774 |
* > | a\*b |
| 16775 |
* ^ |
| 16776 |
* ``` |
| 16777 |
* |
| 16778 |
* @type {State} |
| 16779 |
*/ |
| 16780 |
function inside(code) { |
| 16781 |
if (asciiPunctuation(code)) { |
| 16782 |
effects.enter("characterEscapeValue"); |
| 16783 |
effects.consume(code); |
| 16784 |
effects.exit("characterEscapeValue"); |
| 16785 |
effects.exit("characterEscape"); |
| 16786 |
return ok; |
| 16787 |
} |
| 16788 |
return nok(code); |
| 16789 |
} |
| 16790 |
} |
| 16791 |
var characterEscape; |
| 16792 |
var init_character_escape = __esmMin((() => { |
| 16793 |
init_micromark_util_character(); |
| 16794 |
characterEscape = { |
| 16795 |
name: "characterEscape", |
| 16796 |
tokenize: tokenizeCharacterEscape |
| 16797 |
}; |
| 16798 |
})); |
| 16799 |
|
| 16800 |
//#endregion |
| 16801 |
//#region node_modules/decode-named-character-reference/index.dom.js |
| 16802 |
/** |
| 16803 |
* @param {string} value |
| 16804 |
* @returns {string | false} |
| 16805 |
*/ |
| 16806 |
function decodeNamedCharacterReference(value) { |
| 16807 |
const characterReference = "&" + value + ";"; |
| 16808 |
element.innerHTML = characterReference; |
| 16809 |
const character = element.textContent; |
| 16810 |
if (character.charCodeAt(character.length - 1) === 59 && value !== "semi") return false; |
| 16811 |
return character === characterReference ? false : character; |
| 16812 |
} |
| 16813 |
var element; |
| 16814 |
var init_index_dom = __esmMin((() => { |
| 16815 |
element = document.createElement("i"); |
| 16816 |
})); |
| 16817 |
|
| 16818 |
//#endregion |
| 16819 |
//#region node_modules/micromark-core-commonmark/lib/character-reference.js |
| 16820 |
/** |
| 16821 |
* @this {TokenizeContext} |
| 16822 |
* @type {Tokenizer} |
| 16823 |
*/ |
| 16824 |
function tokenizeCharacterReference(effects, ok, nok) { |
| 16825 |
const self = this; |
| 16826 |
let size = 0; |
| 16827 |
/** @type {number} */ |
| 16828 |
let max; |
| 16829 |
/** @type {(code: Code) => boolean} */ |
| 16830 |
let test; |
| 16831 |
return start; |
| 16832 |
/** |
| 16833 |
* Start of character reference. |
| 16834 |
* |
| 16835 |
* ```markdown |
| 16836 |
* > | a&b |
| 16837 |
* ^ |
| 16838 |
* > | a{b |
| 16839 |
* ^ |
| 16840 |
* > | a	b |
| 16841 |
* ^ |
| 16842 |
* ``` |
| 16843 |
* |
| 16844 |
* @type {State} |
| 16845 |
*/ |
| 16846 |
function start(code) { |
| 16847 |
effects.enter("characterReference"); |
| 16848 |
effects.enter("characterReferenceMarker"); |
| 16849 |
effects.consume(code); |
| 16850 |
effects.exit("characterReferenceMarker"); |
| 16851 |
return open; |
| 16852 |
} |
| 16853 |
/** |
| 16854 |
* After `&`, at `#` for numeric references or alphanumeric for named |
| 16855 |
* references. |
| 16856 |
* |
| 16857 |
* ```markdown |
| 16858 |
* > | a&b |
| 16859 |
* ^ |
| 16860 |
* > | a{b |
| 16861 |
* ^ |
| 16862 |
* > | a	b |
| 16863 |
* ^ |
| 16864 |
* ``` |
| 16865 |
* |
| 16866 |
* @type {State} |
| 16867 |
*/ |
| 16868 |
function open(code) { |
| 16869 |
if (code === 35) { |
| 16870 |
effects.enter("characterReferenceMarkerNumeric"); |
| 16871 |
effects.consume(code); |
| 16872 |
effects.exit("characterReferenceMarkerNumeric"); |
| 16873 |
return numeric; |
| 16874 |
} |
| 16875 |
effects.enter("characterReferenceValue"); |
| 16876 |
max = 31; |
| 16877 |
test = asciiAlphanumeric; |
| 16878 |
return value(code); |
| 16879 |
} |
| 16880 |
/** |
| 16881 |
* After `#`, at `x` for hexadecimals or digit for decimals. |
| 16882 |
* |
| 16883 |
* ```markdown |
| 16884 |
* > | a{b |
| 16885 |
* ^ |
| 16886 |
* > | a	b |
| 16887 |
* ^ |
| 16888 |
* ``` |
| 16889 |
* |
| 16890 |
* @type {State} |
| 16891 |
*/ |
| 16892 |
function numeric(code) { |
| 16893 |
if (code === 88 || code === 120) { |
| 16894 |
effects.enter("characterReferenceMarkerHexadecimal"); |
| 16895 |
effects.consume(code); |
| 16896 |
effects.exit("characterReferenceMarkerHexadecimal"); |
| 16897 |
effects.enter("characterReferenceValue"); |
| 16898 |
max = 6; |
| 16899 |
test = asciiHexDigit; |
| 16900 |
return value; |
| 16901 |
} |
| 16902 |
effects.enter("characterReferenceValue"); |
| 16903 |
max = 7; |
| 16904 |
test = asciiDigit; |
| 16905 |
return value(code); |
| 16906 |
} |
| 16907 |
/** |
| 16908 |
* After markers (`&#x`, `&#`, or `&`), in value, before `;`. |
| 16909 |
* |
| 16910 |
* The character reference kind defines what and how many characters are |
| 16911 |
* allowed. |
| 16912 |
* |
| 16913 |
* ```markdown |
| 16914 |
* > | a&b |
| 16915 |
* ^^^ |
| 16916 |
* > | a{b |
| 16917 |
* ^^^ |
| 16918 |
* > | a	b |
| 16919 |
* ^ |
| 16920 |
* ``` |
| 16921 |
* |
| 16922 |
* @type {State} |
| 16923 |
*/ |
| 16924 |
function value(code) { |
| 16925 |
if (code === 59 && size) { |
| 16926 |
const token = effects.exit("characterReferenceValue"); |
| 16927 |
if (test === asciiAlphanumeric && !decodeNamedCharacterReference(self.sliceSerialize(token))) return nok(code); |
| 16928 |
effects.enter("characterReferenceMarker"); |
| 16929 |
effects.consume(code); |
| 16930 |
effects.exit("characterReferenceMarker"); |
| 16931 |
effects.exit("characterReference"); |
| 16932 |
return ok; |
| 16933 |
} |
| 16934 |
if (test(code) && size++ < max) { |
| 16935 |
effects.consume(code); |
| 16936 |
return value; |
| 16937 |
} |
| 16938 |
return nok(code); |
| 16939 |
} |
| 16940 |
} |
| 16941 |
var characterReference; |
| 16942 |
var init_character_reference = __esmMin((() => { |
| 16943 |
init_index_dom(); |
| 16944 |
init_micromark_util_character(); |
| 16945 |
characterReference = { |
| 16946 |
name: "characterReference", |
| 16947 |
tokenize: tokenizeCharacterReference |
| 16948 |
}; |
| 16949 |
})); |
| 16950 |
|
| 16951 |
//#endregion |
| 16952 |
//#region node_modules/micromark-core-commonmark/lib/code-fenced.js |
| 16953 |
/** |
| 16954 |
* @this {TokenizeContext} |
| 16955 |
* @type {Tokenizer} |
| 16956 |
*/ |
| 16957 |
function tokenizeCodeFenced(effects, ok, nok) { |
| 16958 |
const self = this; |
| 16959 |
/** @type {Construct} */ |
| 16960 |
const closeStart = { |
| 16961 |
tokenize: tokenizeCloseStart, |
| 16962 |
partial: true |
| 16963 |
}; |
| 16964 |
let initialPrefix = 0; |
| 16965 |
let sizeOpen = 0; |
| 16966 |
/** @type {NonNullable<Code>} */ |
| 16967 |
let marker; |
| 16968 |
return start; |
| 16969 |
/** |
| 16970 |
* Start of code. |
| 16971 |
* |
| 16972 |
* ```markdown |
| 16973 |
* > | ~~~js |
| 16974 |
* ^ |
| 16975 |
* | alert(1) |
| 16976 |
* | ~~~ |
| 16977 |
* ``` |
| 16978 |
* |
| 16979 |
* @type {State} |
| 16980 |
*/ |
| 16981 |
function start(code) { |
| 16982 |
return beforeSequenceOpen(code); |
| 16983 |
} |
| 16984 |
/** |
| 16985 |
* In opening fence, after prefix, at sequence. |
| 16986 |
* |
| 16987 |
* ```markdown |
| 16988 |
* > | ~~~js |
| 16989 |
* ^ |
| 16990 |
* | alert(1) |
| 16991 |
* | ~~~ |
| 16992 |
* ``` |
| 16993 |
* |
| 16994 |
* @type {State} |
| 16995 |
*/ |
| 16996 |
function beforeSequenceOpen(code) { |
| 16997 |
const tail = self.events[self.events.length - 1]; |
| 16998 |
initialPrefix = tail && tail[1].type === "linePrefix" ? tail[2].sliceSerialize(tail[1], true).length : 0; |
| 16999 |
marker = code; |
| 17000 |
effects.enter("codeFenced"); |
| 17001 |
effects.enter("codeFencedFence"); |
| 17002 |
effects.enter("codeFencedFenceSequence"); |
| 17003 |
return sequenceOpen(code); |
| 17004 |
} |
| 17005 |
/** |
| 17006 |
* In opening fence sequence. |
| 17007 |
* |
| 17008 |
* ```markdown |
| 17009 |
* > | ~~~js |
| 17010 |
* ^ |
| 17011 |
* | alert(1) |
| 17012 |
* | ~~~ |
| 17013 |
* ``` |
| 17014 |
* |
| 17015 |
* @type {State} |
| 17016 |
*/ |
| 17017 |
function sequenceOpen(code) { |
| 17018 |
if (code === marker) { |
| 17019 |
sizeOpen++; |
| 17020 |
effects.consume(code); |
| 17021 |
return sequenceOpen; |
| 17022 |
} |
| 17023 |
if (sizeOpen < 3) return nok(code); |
| 17024 |
effects.exit("codeFencedFenceSequence"); |
| 17025 |
return markdownSpace(code) ? factorySpace(effects, infoBefore, "whitespace")(code) : infoBefore(code); |
| 17026 |
} |
| 17027 |
/** |
| 17028 |
* In opening fence, after the sequence (and optional whitespace), before info. |
| 17029 |
* |
| 17030 |
* ```markdown |
| 17031 |
* > | ~~~js |
| 17032 |
* ^ |
| 17033 |
* | alert(1) |
| 17034 |
* | ~~~ |
| 17035 |
* ``` |
| 17036 |
* |
| 17037 |
* @type {State} |
| 17038 |
*/ |
| 17039 |
function infoBefore(code) { |
| 17040 |
if (code === null || markdownLineEnding(code)) { |
| 17041 |
effects.exit("codeFencedFence"); |
| 17042 |
return self.interrupt ? ok(code) : effects.check(nonLazyContinuation, atNonLazyBreak, after)(code); |
| 17043 |
} |
| 17044 |
effects.enter("codeFencedFenceInfo"); |
| 17045 |
effects.enter("chunkString", { contentType: "string" }); |
| 17046 |
return info(code); |
| 17047 |
} |
| 17048 |
/** |
| 17049 |
* In info. |
| 17050 |
* |
| 17051 |
* ```markdown |
| 17052 |
* > | ~~~js |
| 17053 |
* ^ |
| 17054 |
* | alert(1) |
| 17055 |
* | ~~~ |
| 17056 |
* ``` |
| 17057 |
* |
| 17058 |
* @type {State} |
| 17059 |
*/ |
| 17060 |
function info(code) { |
| 17061 |
if (code === null || markdownLineEnding(code)) { |
| 17062 |
effects.exit("chunkString"); |
| 17063 |
effects.exit("codeFencedFenceInfo"); |
| 17064 |
return infoBefore(code); |
| 17065 |
} |
| 17066 |
if (markdownSpace(code)) { |
| 17067 |
effects.exit("chunkString"); |
| 17068 |
effects.exit("codeFencedFenceInfo"); |
| 17069 |
return factorySpace(effects, metaBefore, "whitespace")(code); |
| 17070 |
} |
| 17071 |
if (code === 96 && code === marker) return nok(code); |
| 17072 |
effects.consume(code); |
| 17073 |
return info; |
| 17074 |
} |
| 17075 |
/** |
| 17076 |
* In opening fence, after info and whitespace, before meta. |
| 17077 |
* |
| 17078 |
* ```markdown |
| 17079 |
* > | ~~~js eval |
| 17080 |
* ^ |
| 17081 |
* | alert(1) |
| 17082 |
* | ~~~ |
| 17083 |
* ``` |
| 17084 |
* |
| 17085 |
* @type {State} |
| 17086 |
*/ |
| 17087 |
function metaBefore(code) { |
| 17088 |
if (code === null || markdownLineEnding(code)) return infoBefore(code); |
| 17089 |
effects.enter("codeFencedFenceMeta"); |
| 17090 |
effects.enter("chunkString", { contentType: "string" }); |
| 17091 |
return meta(code); |
| 17092 |
} |
| 17093 |
/** |
| 17094 |
* In meta. |
| 17095 |
* |
| 17096 |
* ```markdown |
| 17097 |
* > | ~~~js eval |
| 17098 |
* ^ |
| 17099 |
* | alert(1) |
| 17100 |
* | ~~~ |
| 17101 |
* ``` |
| 17102 |
* |
| 17103 |
* @type {State} |
| 17104 |
*/ |
| 17105 |
function meta(code) { |
| 17106 |
if (code === null || markdownLineEnding(code)) { |
| 17107 |
effects.exit("chunkString"); |
| 17108 |
effects.exit("codeFencedFenceMeta"); |
| 17109 |
return infoBefore(code); |
| 17110 |
} |
| 17111 |
if (code === 96 && code === marker) return nok(code); |
| 17112 |
effects.consume(code); |
| 17113 |
return meta; |
| 17114 |
} |
| 17115 |
/** |
| 17116 |
* At eol/eof in code, before a non-lazy closing fence or content. |
| 17117 |
* |
| 17118 |
* ```markdown |
| 17119 |
* > | ~~~js |
| 17120 |
* ^ |
| 17121 |
* > | alert(1) |
| 17122 |
* ^ |
| 17123 |
* | ~~~ |
| 17124 |
* ``` |
| 17125 |
* |
| 17126 |
* @type {State} |
| 17127 |
*/ |
| 17128 |
function atNonLazyBreak(code) { |
| 17129 |
return effects.attempt(closeStart, after, contentBefore)(code); |
| 17130 |
} |
| 17131 |
/** |
| 17132 |
* Before code content, not a closing fence, at eol. |
| 17133 |
* |
| 17134 |
* ```markdown |
| 17135 |
* | ~~~js |
| 17136 |
* > | alert(1) |
| 17137 |
* ^ |
| 17138 |
* | ~~~ |
| 17139 |
* ``` |
| 17140 |
* |
| 17141 |
* @type {State} |
| 17142 |
*/ |
| 17143 |
function contentBefore(code) { |
| 17144 |
effects.enter("lineEnding"); |
| 17145 |
effects.consume(code); |
| 17146 |
effects.exit("lineEnding"); |
| 17147 |
return contentStart; |
| 17148 |
} |
| 17149 |
/** |
| 17150 |
* Before code content, not a closing fence. |
| 17151 |
* |
| 17152 |
* ```markdown |
| 17153 |
* | ~~~js |
| 17154 |
* > | alert(1) |
| 17155 |
* ^ |
| 17156 |
* | ~~~ |
| 17157 |
* ``` |
| 17158 |
* |
| 17159 |
* @type {State} |
| 17160 |
*/ |
| 17161 |
function contentStart(code) { |
| 17162 |
return initialPrefix > 0 && markdownSpace(code) ? factorySpace(effects, beforeContentChunk, "linePrefix", initialPrefix + 1)(code) : beforeContentChunk(code); |
| 17163 |
} |
| 17164 |
/** |
| 17165 |
* Before code content, after optional prefix. |
| 17166 |
* |
| 17167 |
* ```markdown |
| 17168 |
* | ~~~js |
| 17169 |
* > | alert(1) |
| 17170 |
* ^ |
| 17171 |
* | ~~~ |
| 17172 |
* ``` |
| 17173 |
* |
| 17174 |
* @type {State} |
| 17175 |
*/ |
| 17176 |
function beforeContentChunk(code) { |
| 17177 |
if (code === null || markdownLineEnding(code)) return effects.check(nonLazyContinuation, atNonLazyBreak, after)(code); |
| 17178 |
effects.enter("codeFlowValue"); |
| 17179 |
return contentChunk(code); |
| 17180 |
} |
| 17181 |
/** |
| 17182 |
* In code content. |
| 17183 |
* |
| 17184 |
* ```markdown |
| 17185 |
* | ~~~js |
| 17186 |
* > | alert(1) |
| 17187 |
* ^^^^^^^^ |
| 17188 |
* | ~~~ |
| 17189 |
* ``` |
| 17190 |
* |
| 17191 |
* @type {State} |
| 17192 |
*/ |
| 17193 |
function contentChunk(code) { |
| 17194 |
if (code === null || markdownLineEnding(code)) { |
| 17195 |
effects.exit("codeFlowValue"); |
| 17196 |
return beforeContentChunk(code); |
| 17197 |
} |
| 17198 |
effects.consume(code); |
| 17199 |
return contentChunk; |
| 17200 |
} |
| 17201 |
/** |
| 17202 |
* After code. |
| 17203 |
* |
| 17204 |
* ```markdown |
| 17205 |
* | ~~~js |
| 17206 |
* | alert(1) |
| 17207 |
* > | ~~~ |
| 17208 |
* ^ |
| 17209 |
* ``` |
| 17210 |
* |
| 17211 |
* @type {State} |
| 17212 |
*/ |
| 17213 |
function after(code) { |
| 17214 |
effects.exit("codeFenced"); |
| 17215 |
return ok(code); |
| 17216 |
} |
| 17217 |
/** |
| 17218 |
* @this {TokenizeContext} |
| 17219 |
* @type {Tokenizer} |
| 17220 |
*/ |
| 17221 |
function tokenizeCloseStart(effects, ok, nok) { |
| 17222 |
let size = 0; |
| 17223 |
return startBefore; |
| 17224 |
/** |
| 17225 |
* |
| 17226 |
* |
| 17227 |
* @type {State} |
| 17228 |
*/ |
| 17229 |
function startBefore(code) { |
| 17230 |
effects.enter("lineEnding"); |
| 17231 |
effects.consume(code); |
| 17232 |
effects.exit("lineEnding"); |
| 17233 |
return start; |
| 17234 |
} |
| 17235 |
/** |
| 17236 |
* Before closing fence, at optional whitespace. |
| 17237 |
* |
| 17238 |
* ```markdown |
| 17239 |
* | ~~~js |
| 17240 |
* | alert(1) |
| 17241 |
* > | ~~~ |
| 17242 |
* ^ |
| 17243 |
* ``` |
| 17244 |
* |
| 17245 |
* @type {State} |
| 17246 |
*/ |
| 17247 |
function start(code) { |
| 17248 |
effects.enter("codeFencedFence"); |
| 17249 |
return markdownSpace(code) ? factorySpace(effects, beforeSequenceClose, "linePrefix", self.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4)(code) : beforeSequenceClose(code); |
| 17250 |
} |
| 17251 |
/** |
| 17252 |
* In closing fence, after optional whitespace, at sequence. |
| 17253 |
* |
| 17254 |
* ```markdown |
| 17255 |
* | ~~~js |
| 17256 |
* | alert(1) |
| 17257 |
* > | ~~~ |
| 17258 |
* ^ |
| 17259 |
* ``` |
| 17260 |
* |
| 17261 |
* @type {State} |
| 17262 |
*/ |
| 17263 |
function beforeSequenceClose(code) { |
| 17264 |
if (code === marker) { |
| 17265 |
effects.enter("codeFencedFenceSequence"); |
| 17266 |
return sequenceClose(code); |
| 17267 |
} |
| 17268 |
return nok(code); |
| 17269 |
} |
| 17270 |
/** |
| 17271 |
* In closing fence sequence. |
| 17272 |
* |
| 17273 |
* ```markdown |
| 17274 |
* | ~~~js |
| 17275 |
* | alert(1) |
| 17276 |
* > | ~~~ |
| 17277 |
* ^ |
| 17278 |
* ``` |
| 17279 |
* |
| 17280 |
* @type {State} |
| 17281 |
*/ |
| 17282 |
function sequenceClose(code) { |
| 17283 |
if (code === marker) { |
| 17284 |
size++; |
| 17285 |
effects.consume(code); |
| 17286 |
return sequenceClose; |
| 17287 |
} |
| 17288 |
if (size >= sizeOpen) { |
| 17289 |
effects.exit("codeFencedFenceSequence"); |
| 17290 |
return markdownSpace(code) ? factorySpace(effects, sequenceCloseAfter, "whitespace")(code) : sequenceCloseAfter(code); |
| 17291 |
} |
| 17292 |
return nok(code); |
| 17293 |
} |
| 17294 |
/** |
| 17295 |
* After closing fence sequence, after optional whitespace. |
| 17296 |
* |
| 17297 |
* ```markdown |
| 17298 |
* | ~~~js |
| 17299 |
* | alert(1) |
| 17300 |
* > | ~~~ |
| 17301 |
* ^ |
| 17302 |
* ``` |
| 17303 |
* |
| 17304 |
* @type {State} |
| 17305 |
*/ |
| 17306 |
function sequenceCloseAfter(code) { |
| 17307 |
if (code === null || markdownLineEnding(code)) { |
| 17308 |
effects.exit("codeFencedFence"); |
| 17309 |
return ok(code); |
| 17310 |
} |
| 17311 |
return nok(code); |
| 17312 |
} |
| 17313 |
} |
| 17314 |
} |
| 17315 |
/** |
| 17316 |
* @this {TokenizeContext} |
| 17317 |
* @type {Tokenizer} |
| 17318 |
*/ |
| 17319 |
function tokenizeNonLazyContinuation(effects, ok, nok) { |
| 17320 |
const self = this; |
| 17321 |
return start; |
| 17322 |
/** |
| 17323 |
* |
| 17324 |
* |
| 17325 |
* @type {State} |
| 17326 |
*/ |
| 17327 |
function start(code) { |
| 17328 |
if (code === null) return nok(code); |
| 17329 |
effects.enter("lineEnding"); |
| 17330 |
effects.consume(code); |
| 17331 |
effects.exit("lineEnding"); |
| 17332 |
return lineStart; |
| 17333 |
} |
| 17334 |
/** |
| 17335 |
* |
| 17336 |
* |
| 17337 |
* @type {State} |
| 17338 |
*/ |
| 17339 |
function lineStart(code) { |
| 17340 |
return self.parser.lazy[self.now().line] ? nok(code) : ok(code); |
| 17341 |
} |
| 17342 |
} |
| 17343 |
var nonLazyContinuation, codeFenced; |
| 17344 |
var init_code_fenced = __esmMin((() => { |
| 17345 |
init_micromark_factory_space(); |
| 17346 |
init_micromark_util_character(); |
| 17347 |
nonLazyContinuation = { |
| 17348 |
tokenize: tokenizeNonLazyContinuation, |
| 17349 |
partial: true |
| 17350 |
}; |
| 17351 |
codeFenced = { |
| 17352 |
name: "codeFenced", |
| 17353 |
tokenize: tokenizeCodeFenced, |
| 17354 |
concrete: true |
| 17355 |
}; |
| 17356 |
})); |
| 17357 |
|
| 17358 |
//#endregion |
| 17359 |
//#region node_modules/micromark-core-commonmark/lib/code-indented.js |
| 17360 |
/** |
| 17361 |
* @this {TokenizeContext} |
| 17362 |
* @type {Tokenizer} |
| 17363 |
*/ |
| 17364 |
function tokenizeCodeIndented(effects, ok, nok) { |
| 17365 |
const self = this; |
| 17366 |
return start; |
| 17367 |
/** |
| 17368 |
* Start of code (indented). |
| 17369 |
* |
| 17370 |
* > **Parsing note**: it is not needed to check if this first line is a |
| 17371 |
* > filled line (that it has a non-whitespace character), because blank lines |
| 17372 |
* > are parsed already, so we never run into that. |
| 17373 |
* |
| 17374 |
* ```markdown |
| 17375 |
* > | aaa |
| 17376 |
* ^ |
| 17377 |
* ``` |
| 17378 |
* |
| 17379 |
* @type {State} |
| 17380 |
*/ |
| 17381 |
function start(code) { |
| 17382 |
effects.enter("codeIndented"); |
| 17383 |
return factorySpace(effects, afterPrefix, "linePrefix", 5)(code); |
| 17384 |
} |
| 17385 |
/** |
| 17386 |
* At start, after 1 or 4 spaces. |
| 17387 |
* |
| 17388 |
* ```markdown |
| 17389 |
* > | aaa |
| 17390 |
* ^ |
| 17391 |
* ``` |
| 17392 |
* |
| 17393 |
* @type {State} |
| 17394 |
*/ |
| 17395 |
function afterPrefix(code) { |
| 17396 |
const tail = self.events[self.events.length - 1]; |
| 17397 |
return tail && tail[1].type === "linePrefix" && tail[2].sliceSerialize(tail[1], true).length >= 4 ? atBreak(code) : nok(code); |
| 17398 |
} |
| 17399 |
/** |
| 17400 |
* At a break. |
| 17401 |
* |
| 17402 |
* ```markdown |
| 17403 |
* > | aaa |
| 17404 |
* ^ ^ |
| 17405 |
* ``` |
| 17406 |
* |
| 17407 |
* @type {State} |
| 17408 |
*/ |
| 17409 |
function atBreak(code) { |
| 17410 |
if (code === null) return after(code); |
| 17411 |
if (markdownLineEnding(code)) return effects.attempt(furtherStart, atBreak, after)(code); |
| 17412 |
effects.enter("codeFlowValue"); |
| 17413 |
return inside(code); |
| 17414 |
} |
| 17415 |
/** |
| 17416 |
* In code content. |
| 17417 |
* |
| 17418 |
* ```markdown |
| 17419 |
* > | aaa |
| 17420 |
* ^^^^ |
| 17421 |
* ``` |
| 17422 |
* |
| 17423 |
* @type {State} |
| 17424 |
*/ |
| 17425 |
function inside(code) { |
| 17426 |
if (code === null || markdownLineEnding(code)) { |
| 17427 |
effects.exit("codeFlowValue"); |
| 17428 |
return atBreak(code); |
| 17429 |
} |
| 17430 |
effects.consume(code); |
| 17431 |
return inside; |
| 17432 |
} |
| 17433 |
/** @type {State} */ |
| 17434 |
function after(code) { |
| 17435 |
effects.exit("codeIndented"); |
| 17436 |
return ok(code); |
| 17437 |
} |
| 17438 |
} |
| 17439 |
/** |
| 17440 |
* @this {TokenizeContext} |
| 17441 |
* @type {Tokenizer} |
| 17442 |
*/ |
| 17443 |
function tokenizeFurtherStart(effects, ok, nok) { |
| 17444 |
const self = this; |
| 17445 |
return furtherStart; |
| 17446 |
/** |
| 17447 |
* At eol, trying to parse another indent. |
| 17448 |
* |
| 17449 |
* ```markdown |
| 17450 |
* > | aaa |
| 17451 |
* ^ |
| 17452 |
* | bbb |
| 17453 |
* ``` |
| 17454 |
* |
| 17455 |
* @type {State} |
| 17456 |
*/ |
| 17457 |
function furtherStart(code) { |
| 17458 |
if (self.parser.lazy[self.now().line]) return nok(code); |
| 17459 |
if (markdownLineEnding(code)) { |
| 17460 |
effects.enter("lineEnding"); |
| 17461 |
effects.consume(code); |
| 17462 |
effects.exit("lineEnding"); |
| 17463 |
return furtherStart; |
| 17464 |
} |
| 17465 |
return factorySpace(effects, afterPrefix, "linePrefix", 5)(code); |
| 17466 |
} |
| 17467 |
/** |
| 17468 |
* At start, after 1 or 4 spaces. |
| 17469 |
* |
| 17470 |
* ```markdown |
| 17471 |
* > | aaa |
| 17472 |
* ^ |
| 17473 |
* ``` |
| 17474 |
* |
| 17475 |
* @type {State} |
| 17476 |
*/ |
| 17477 |
function afterPrefix(code) { |
| 17478 |
const tail = self.events[self.events.length - 1]; |
| 17479 |
return tail && tail[1].type === "linePrefix" && tail[2].sliceSerialize(tail[1], true).length >= 4 ? ok(code) : markdownLineEnding(code) ? furtherStart(code) : nok(code); |
| 17480 |
} |
| 17481 |
} |
| 17482 |
var codeIndented, furtherStart; |
| 17483 |
var init_code_indented = __esmMin((() => { |
| 17484 |
init_micromark_factory_space(); |
| 17485 |
init_micromark_util_character(); |
| 17486 |
codeIndented = { |
| 17487 |
name: "codeIndented", |
| 17488 |
tokenize: tokenizeCodeIndented |
| 17489 |
}; |
| 17490 |
furtherStart = { |
| 17491 |
tokenize: tokenizeFurtherStart, |
| 17492 |
partial: true |
| 17493 |
}; |
| 17494 |
})); |
| 17495 |
|
| 17496 |
//#endregion |
| 17497 |
//#region node_modules/micromark-core-commonmark/lib/code-text.js |
| 17498 |
/** @type {Resolver} */ |
| 17499 |
function resolveCodeText(events) { |
| 17500 |
let tailExitIndex = events.length - 4; |
| 17501 |
let headEnterIndex = 3; |
| 17502 |
/** @type {number} */ |
| 17503 |
let index; |
| 17504 |
/** @type {number | undefined} */ |
| 17505 |
let enter; |
| 17506 |
if ((events[headEnterIndex][1].type === "lineEnding" || events[headEnterIndex][1].type === "space") && (events[tailExitIndex][1].type === "lineEnding" || events[tailExitIndex][1].type === "space")) { |
| 17507 |
index = headEnterIndex; |
| 17508 |
while (++index < tailExitIndex) if (events[index][1].type === "codeTextData") { |
| 17509 |
events[headEnterIndex][1].type = "codeTextPadding"; |
| 17510 |
events[tailExitIndex][1].type = "codeTextPadding"; |
| 17511 |
headEnterIndex += 2; |
| 17512 |
tailExitIndex -= 2; |
| 17513 |
break; |
| 17514 |
} |
| 17515 |
} |
| 17516 |
index = headEnterIndex - 1; |
| 17517 |
tailExitIndex++; |
| 17518 |
while (++index <= tailExitIndex) if (enter === void 0) { |
| 17519 |
if (index !== tailExitIndex && events[index][1].type !== "lineEnding") enter = index; |
| 17520 |
} else if (index === tailExitIndex || events[index][1].type === "lineEnding") { |
| 17521 |
events[enter][1].type = "codeTextData"; |
| 17522 |
if (index !== enter + 2) { |
| 17523 |
events[enter][1].end = events[index - 1][1].end; |
| 17524 |
events.splice(enter + 2, index - enter - 2); |
| 17525 |
tailExitIndex -= index - enter - 2; |
| 17526 |
index = enter + 2; |
| 17527 |
} |
| 17528 |
enter = void 0; |
| 17529 |
} |
| 17530 |
return events; |
| 17531 |
} |
| 17532 |
/** |
| 17533 |
* @this {TokenizeContext} |
| 17534 |
* @type {Previous} |
| 17535 |
*/ |
| 17536 |
function previous(code) { |
| 17537 |
return code !== 96 || this.events[this.events.length - 1][1].type === "characterEscape"; |
| 17538 |
} |
| 17539 |
/** |
| 17540 |
* @this {TokenizeContext} |
| 17541 |
* @type {Tokenizer} |
| 17542 |
*/ |
| 17543 |
function tokenizeCodeText(effects, ok, nok) { |
| 17544 |
let sizeOpen = 0; |
| 17545 |
/** @type {number} */ |
| 17546 |
let size; |
| 17547 |
/** @type {Token} */ |
| 17548 |
let token; |
| 17549 |
return start; |
| 17550 |
/** |
| 17551 |
* Start of code (text). |
| 17552 |
* |
| 17553 |
* ```markdown |
| 17554 |
* > | `a` |
| 17555 |
* ^ |
| 17556 |
* > | \`a` |
| 17557 |
* ^ |
| 17558 |
* ``` |
| 17559 |
* |
| 17560 |
* @type {State} |
| 17561 |
*/ |
| 17562 |
function start(code) { |
| 17563 |
effects.enter("codeText"); |
| 17564 |
effects.enter("codeTextSequence"); |
| 17565 |
return sequenceOpen(code); |
| 17566 |
} |
| 17567 |
/** |
| 17568 |
* In opening sequence. |
| 17569 |
* |
| 17570 |
* ```markdown |
| 17571 |
* > | `a` |
| 17572 |
* ^ |
| 17573 |
* ``` |
| 17574 |
* |
| 17575 |
* @type {State} |
| 17576 |
*/ |
| 17577 |
function sequenceOpen(code) { |
| 17578 |
if (code === 96) { |
| 17579 |
effects.consume(code); |
| 17580 |
sizeOpen++; |
| 17581 |
return sequenceOpen; |
| 17582 |
} |
| 17583 |
effects.exit("codeTextSequence"); |
| 17584 |
return between(code); |
| 17585 |
} |
| 17586 |
/** |
| 17587 |
* Between something and something else. |
| 17588 |
* |
| 17589 |
* ```markdown |
| 17590 |
* > | `a` |
| 17591 |
* ^^ |
| 17592 |
* ``` |
| 17593 |
* |
| 17594 |
* @type {State} |
| 17595 |
*/ |
| 17596 |
function between(code) { |
| 17597 |
if (code === null) return nok(code); |
| 17598 |
if (code === 32) { |
| 17599 |
effects.enter("space"); |
| 17600 |
effects.consume(code); |
| 17601 |
effects.exit("space"); |
| 17602 |
return between; |
| 17603 |
} |
| 17604 |
if (code === 96) { |
| 17605 |
token = effects.enter("codeTextSequence"); |
| 17606 |
size = 0; |
| 17607 |
return sequenceClose(code); |
| 17608 |
} |
| 17609 |
if (markdownLineEnding(code)) { |
| 17610 |
effects.enter("lineEnding"); |
| 17611 |
effects.consume(code); |
| 17612 |
effects.exit("lineEnding"); |
| 17613 |
return between; |
| 17614 |
} |
| 17615 |
effects.enter("codeTextData"); |
| 17616 |
return data(code); |
| 17617 |
} |
| 17618 |
/** |
| 17619 |
* In data. |
| 17620 |
* |
| 17621 |
* ```markdown |
| 17622 |
* > | `a` |
| 17623 |
* ^ |
| 17624 |
* ``` |
| 17625 |
* |
| 17626 |
* @type {State} |
| 17627 |
*/ |
| 17628 |
function data(code) { |
| 17629 |
if (code === null || code === 32 || code === 96 || markdownLineEnding(code)) { |
| 17630 |
effects.exit("codeTextData"); |
| 17631 |
return between(code); |
| 17632 |
} |
| 17633 |
effects.consume(code); |
| 17634 |
return data; |
| 17635 |
} |
| 17636 |
/** |
| 17637 |
* In closing sequence. |
| 17638 |
* |
| 17639 |
* ```markdown |
| 17640 |
* > | `a` |
| 17641 |
* ^ |
| 17642 |
* ``` |
| 17643 |
* |
| 17644 |
* @type {State} |
| 17645 |
*/ |
| 17646 |
function sequenceClose(code) { |
| 17647 |
if (code === 96) { |
| 17648 |
effects.consume(code); |
| 17649 |
size++; |
| 17650 |
return sequenceClose; |
| 17651 |
} |
| 17652 |
if (size === sizeOpen) { |
| 17653 |
effects.exit("codeTextSequence"); |
| 17654 |
effects.exit("codeText"); |
| 17655 |
return ok(code); |
| 17656 |
} |
| 17657 |
token.type = "codeTextData"; |
| 17658 |
return data(code); |
| 17659 |
} |
| 17660 |
} |
| 17661 |
var codeText; |
| 17662 |
var init_code_text = __esmMin((() => { |
| 17663 |
init_micromark_util_character(); |
| 17664 |
codeText = { |
| 17665 |
name: "codeText", |
| 17666 |
tokenize: tokenizeCodeText, |
| 17667 |
resolve: resolveCodeText, |
| 17668 |
previous |
| 17669 |
}; |
| 17670 |
})); |
| 17671 |
|
| 17672 |
//#endregion |
| 17673 |
//#region node_modules/micromark-util-subtokenize/index.js |
| 17674 |
/** |
| 17675 |
* Tokenize subcontent. |
| 17676 |
* |
| 17677 |
* @param {Array<Event>} events |
| 17678 |
* List of events. |
| 17679 |
* @returns {boolean} |
| 17680 |
* Whether subtokens were found. |
| 17681 |
*/ |
| 17682 |
function subtokenize(events) { |
| 17683 |
/** @type {Record<string, number>} */ |
| 17684 |
const jumps = {}; |
| 17685 |
let index = -1; |
| 17686 |
/** @type {Event} */ |
| 17687 |
let event; |
| 17688 |
/** @type {number | undefined} */ |
| 17689 |
let lineIndex; |
| 17690 |
/** @type {number} */ |
| 17691 |
let otherIndex; |
| 17692 |
/** @type {Event} */ |
| 17693 |
let otherEvent; |
| 17694 |
/** @type {Array<Event>} */ |
| 17695 |
let parameters; |
| 17696 |
/** @type {Array<Event>} */ |
| 17697 |
let subevents; |
| 17698 |
/** @type {boolean | undefined} */ |
| 17699 |
let more; |
| 17700 |
while (++index < events.length) { |
| 17701 |
while (index in jumps) index = jumps[index]; |
| 17702 |
event = events[index]; |
| 17703 |
if (index && event[1].type === "chunkFlow" && events[index - 1][1].type === "listItemPrefix") { |
| 17704 |
subevents = event[1]._tokenizer.events; |
| 17705 |
otherIndex = 0; |
| 17706 |
if (otherIndex < subevents.length && subevents[otherIndex][1].type === "lineEndingBlank") otherIndex += 2; |
| 17707 |
if (otherIndex < subevents.length && subevents[otherIndex][1].type === "content") while (++otherIndex < subevents.length) { |
| 17708 |
if (subevents[otherIndex][1].type === "content") break; |
| 17709 |
if (subevents[otherIndex][1].type === "chunkText") { |
| 17710 |
subevents[otherIndex][1]._isInFirstContentOfListItem = true; |
| 17711 |
otherIndex++; |
| 17712 |
} |
| 17713 |
} |
| 17714 |
} |
| 17715 |
if (event[0] === "enter") { |
| 17716 |
if (event[1].contentType) { |
| 17717 |
Object.assign(jumps, subcontent(events, index)); |
| 17718 |
index = jumps[index]; |
| 17719 |
more = true; |
| 17720 |
} |
| 17721 |
} else if (event[1]._container) { |
| 17722 |
otherIndex = index; |
| 17723 |
lineIndex = void 0; |
| 17724 |
while (otherIndex--) { |
| 17725 |
otherEvent = events[otherIndex]; |
| 17726 |
if (otherEvent[1].type === "lineEnding" || otherEvent[1].type === "lineEndingBlank") { |
| 17727 |
if (otherEvent[0] === "enter") { |
| 17728 |
if (lineIndex) events[lineIndex][1].type = "lineEndingBlank"; |
| 17729 |
otherEvent[1].type = "lineEnding"; |
| 17730 |
lineIndex = otherIndex; |
| 17731 |
} |
| 17732 |
} else break; |
| 17733 |
} |
| 17734 |
if (lineIndex) { |
| 17735 |
event[1].end = Object.assign({}, events[lineIndex][1].start); |
| 17736 |
parameters = events.slice(lineIndex, index); |
| 17737 |
parameters.unshift(event); |
| 17738 |
splice(events, lineIndex, index - lineIndex + 1, parameters); |
| 17739 |
} |
| 17740 |
} |
| 17741 |
} |
| 17742 |
return !more; |
| 17743 |
} |
| 17744 |
/** |
| 17745 |
* Tokenize embedded tokens. |
| 17746 |
* |
| 17747 |
* @param {Array<Event>} events |
| 17748 |
* @param {number} eventIndex |
| 17749 |
* @returns {Record<string, number>} |
| 17750 |
*/ |
| 17751 |
function subcontent(events, eventIndex) { |
| 17752 |
const token = events[eventIndex][1]; |
| 17753 |
const context = events[eventIndex][2]; |
| 17754 |
let startPosition = eventIndex - 1; |
| 17755 |
/** @type {Array<number>} */ |
| 17756 |
const startPositions = []; |
| 17757 |
const tokenizer = token._tokenizer || context.parser[token.contentType](token.start); |
| 17758 |
const childEvents = tokenizer.events; |
| 17759 |
/** @type {Array<[number, number]>} */ |
| 17760 |
const jumps = []; |
| 17761 |
/** @type {Record<string, number>} */ |
| 17762 |
const gaps = {}; |
| 17763 |
/** @type {Array<Chunk>} */ |
| 17764 |
let stream; |
| 17765 |
/** @type {Token | undefined} */ |
| 17766 |
let previous; |
| 17767 |
let index = -1; |
| 17768 |
/** @type {Token | undefined} */ |
| 17769 |
let current = token; |
| 17770 |
let adjust = 0; |
| 17771 |
let start = 0; |
| 17772 |
const breaks = [start]; |
| 17773 |
while (current) { |
| 17774 |
while (events[++startPosition][1] !== current); |
| 17775 |
startPositions.push(startPosition); |
| 17776 |
if (!current._tokenizer) { |
| 17777 |
stream = context.sliceStream(current); |
| 17778 |
if (!current.next) stream.push(null); |
| 17779 |
if (previous) tokenizer.defineSkip(current.start); |
| 17780 |
if (current._isInFirstContentOfListItem) tokenizer._gfmTasklistFirstContentOfListItem = true; |
| 17781 |
tokenizer.write(stream); |
| 17782 |
if (current._isInFirstContentOfListItem) tokenizer._gfmTasklistFirstContentOfListItem = void 0; |
| 17783 |
} |
| 17784 |
previous = current; |
| 17785 |
current = current.next; |
| 17786 |
} |
| 17787 |
current = token; |
| 17788 |
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) { |
| 17789 |
start = index + 1; |
| 17790 |
breaks.push(start); |
| 17791 |
current._tokenizer = void 0; |
| 17792 |
current.previous = void 0; |
| 17793 |
current = current.next; |
| 17794 |
} |
| 17795 |
tokenizer.events = []; |
| 17796 |
if (current) { |
| 17797 |
current._tokenizer = void 0; |
| 17798 |
current.previous = void 0; |
| 17799 |
} else breaks.pop(); |
| 17800 |
index = breaks.length; |
| 17801 |
while (index--) { |
| 17802 |
const slice = childEvents.slice(breaks[index], breaks[index + 1]); |
| 17803 |
const start = startPositions.pop(); |
| 17804 |
jumps.unshift([start, start + slice.length - 1]); |
| 17805 |
splice(events, start, 2, slice); |
| 17806 |
} |
| 17807 |
index = -1; |
| 17808 |
while (++index < jumps.length) { |
| 17809 |
gaps[adjust + jumps[index][0]] = adjust + jumps[index][1]; |
| 17810 |
adjust += jumps[index][1] - jumps[index][0] - 1; |
| 17811 |
} |
| 17812 |
return gaps; |
| 17813 |
} |
| 17814 |
var init_micromark_util_subtokenize = __esmMin((() => { |
| 17815 |
init_micromark_util_chunked(); |
| 17816 |
})); |
| 17817 |
|
| 17818 |
//#endregion |
| 17819 |
//#region node_modules/micromark-core-commonmark/lib/content.js |
| 17820 |
/** |
| 17821 |
* Content is transparent: it’s parsed right now. That way, definitions are also |
| 17822 |
* parsed right now: before text in paragraphs (specifically, media) are parsed. |
| 17823 |
* |
| 17824 |
* @type {Resolver} |
| 17825 |
*/ |
| 17826 |
function resolveContent(events) { |
| 17827 |
subtokenize(events); |
| 17828 |
return events; |
| 17829 |
} |
| 17830 |
/** |
| 17831 |
* @this {TokenizeContext} |
| 17832 |
* @type {Tokenizer} |
| 17833 |
*/ |
| 17834 |
function tokenizeContent(effects, ok) { |
| 17835 |
/** @type {Token | undefined} */ |
| 17836 |
let previous; |
| 17837 |
return chunkStart; |
| 17838 |
/** |
| 17839 |
* Before a content chunk. |
| 17840 |
* |
| 17841 |
* ```markdown |
| 17842 |
* > | abc |
| 17843 |
* ^ |
| 17844 |
* ``` |
| 17845 |
* |
| 17846 |
* @type {State} |
| 17847 |
*/ |
| 17848 |
function chunkStart(code) { |
| 17849 |
effects.enter("content"); |
| 17850 |
previous = effects.enter("chunkContent", { contentType: "content" }); |
| 17851 |
return chunkInside(code); |
| 17852 |
} |
| 17853 |
/** |
| 17854 |
* In a content chunk. |
| 17855 |
* |
| 17856 |
* ```markdown |
| 17857 |
* > | abc |
| 17858 |
* ^^^ |
| 17859 |
* ``` |
| 17860 |
* |
| 17861 |
* @type {State} |
| 17862 |
*/ |
| 17863 |
function chunkInside(code) { |
| 17864 |
if (code === null) return contentEnd(code); |
| 17865 |
if (markdownLineEnding(code)) return effects.check(continuationConstruct, contentContinue, contentEnd)(code); |
| 17866 |
effects.consume(code); |
| 17867 |
return chunkInside; |
| 17868 |
} |
| 17869 |
/** |
| 17870 |
* |
| 17871 |
* |
| 17872 |
* @type {State} |
| 17873 |
*/ |
| 17874 |
function contentEnd(code) { |
| 17875 |
effects.exit("chunkContent"); |
| 17876 |
effects.exit("content"); |
| 17877 |
return ok(code); |
| 17878 |
} |
| 17879 |
/** |
| 17880 |
* |
| 17881 |
* |
| 17882 |
* @type {State} |
| 17883 |
*/ |
| 17884 |
function contentContinue(code) { |
| 17885 |
effects.consume(code); |
| 17886 |
effects.exit("chunkContent"); |
| 17887 |
previous.next = effects.enter("chunkContent", { |
| 17888 |
contentType: "content", |
| 17889 |
previous |
| 17890 |
}); |
| 17891 |
previous = previous.next; |
| 17892 |
return chunkInside; |
| 17893 |
} |
| 17894 |
} |
| 17895 |
/** |
| 17896 |
* @this {TokenizeContext} |
| 17897 |
* @type {Tokenizer} |
| 17898 |
*/ |
| 17899 |
function tokenizeContinuation(effects, ok, nok) { |
| 17900 |
const self = this; |
| 17901 |
return startLookahead; |
| 17902 |
/** |
| 17903 |
* |
| 17904 |
* |
| 17905 |
* @type {State} |
| 17906 |
*/ |
| 17907 |
function startLookahead(code) { |
| 17908 |
effects.exit("chunkContent"); |
| 17909 |
effects.enter("lineEnding"); |
| 17910 |
effects.consume(code); |
| 17911 |
effects.exit("lineEnding"); |
| 17912 |
return factorySpace(effects, prefixed, "linePrefix"); |
| 17913 |
} |
| 17914 |
/** |
| 17915 |
* |
| 17916 |
* |
| 17917 |
* @type {State} |
| 17918 |
*/ |
| 17919 |
function prefixed(code) { |
| 17920 |
if (code === null || markdownLineEnding(code)) return nok(code); |
| 17921 |
const tail = self.events[self.events.length - 1]; |
| 17922 |
if (!self.parser.constructs.disable.null.includes("codeIndented") && tail && tail[1].type === "linePrefix" && tail[2].sliceSerialize(tail[1], true).length >= 4) return ok(code); |
| 17923 |
return effects.interrupt(self.parser.constructs.flow, nok, ok)(code); |
| 17924 |
} |
| 17925 |
} |
| 17926 |
var content, continuationConstruct; |
| 17927 |
var init_content = __esmMin((() => { |
| 17928 |
init_micromark_factory_space(); |
| 17929 |
init_micromark_util_character(); |
| 17930 |
init_micromark_util_subtokenize(); |
| 17931 |
content = { |
| 17932 |
tokenize: tokenizeContent, |
| 17933 |
resolve: resolveContent |
| 17934 |
}; |
| 17935 |
continuationConstruct = { |
| 17936 |
tokenize: tokenizeContinuation, |
| 17937 |
partial: true |
| 17938 |
}; |
| 17939 |
})); |
| 17940 |
|
| 17941 |
//#endregion |
| 17942 |
//#region node_modules/micromark-factory-destination/index.js |
| 17943 |
/** |
| 17944 |
* Parse destinations. |
| 17945 |
* |
| 17946 |
* ###### Examples |
| 17947 |
* |
| 17948 |
* ```markdown |
| 17949 |
* <a> |
| 17950 |
* <a\>b> |
| 17951 |
* <a b> |
| 17952 |
* <a)> |
| 17953 |
* a |
| 17954 |
* a\)b |
| 17955 |
* a(b)c |
| 17956 |
* a(b) |
| 17957 |
* ``` |
| 17958 |
* |
| 17959 |
* @param {Effects} effects |
| 17960 |
* Context. |
| 17961 |
* @param {State} ok |
| 17962 |
* State switched to when successful. |
| 17963 |
* @param {State} nok |
| 17964 |
* State switched to when unsuccessful. |
| 17965 |
* @param {TokenType} type |
| 17966 |
* Type for whole (`<a>` or `b`). |
| 17967 |
* @param {TokenType} literalType |
| 17968 |
* Type when enclosed (`<a>`). |
| 17969 |
* @param {TokenType} literalMarkerType |
| 17970 |
* Type for enclosing (`<` and `>`). |
| 17971 |
* @param {TokenType} rawType |
| 17972 |
* Type when not enclosed (`b`). |
| 17973 |
* @param {TokenType} stringType |
| 17974 |
* Type for the value (`a` or `b`). |
| 17975 |
* @param {number | undefined} [max=Infinity] |
| 17976 |
* Depth of nested parens (inclusive). |
| 17977 |
* @returns {State} |
| 17978 |
* Start state. |
| 17979 |
*/ function factoryDestination(effects, ok, nok, type, literalType, literalMarkerType, rawType, stringType, max) { |
| 17980 |
const limit = max || Number.POSITIVE_INFINITY; |
| 17981 |
let balance = 0; |
| 17982 |
return start; |
| 17983 |
/** |
| 17984 |
* Start of destination. |
| 17985 |
* |
| 17986 |
* ```markdown |
| 17987 |
* > | <aa> |
| 17988 |
* ^ |
| 17989 |
* > | aa |
| 17990 |
* ^ |
| 17991 |
* ``` |
| 17992 |
* |
| 17993 |
* @type {State} |
| 17994 |
*/ |
| 17995 |
function start(code) { |
| 17996 |
if (code === 60) { |
| 17997 |
effects.enter(type); |
| 17998 |
effects.enter(literalType); |
| 17999 |
effects.enter(literalMarkerType); |
| 18000 |
effects.consume(code); |
| 18001 |
effects.exit(literalMarkerType); |
| 18002 |
return enclosedBefore; |
| 18003 |
} |
| 18004 |
if (code === null || code === 32 || code === 41 || asciiControl(code)) return nok(code); |
| 18005 |
effects.enter(type); |
| 18006 |
effects.enter(rawType); |
| 18007 |
effects.enter(stringType); |
| 18008 |
effects.enter("chunkString", { contentType: "string" }); |
| 18009 |
return raw(code); |
| 18010 |
} |
| 18011 |
/** |
| 18012 |
* After `<`, at an enclosed destination. |
| 18013 |
* |
| 18014 |
* ```markdown |
| 18015 |
* > | <aa> |
| 18016 |
* ^ |
| 18017 |
* ``` |
| 18018 |
* |
| 18019 |
* @type {State} |
| 18020 |
*/ |
| 18021 |
function enclosedBefore(code) { |
| 18022 |
if (code === 62) { |
| 18023 |
effects.enter(literalMarkerType); |
| 18024 |
effects.consume(code); |
| 18025 |
effects.exit(literalMarkerType); |
| 18026 |
effects.exit(literalType); |
| 18027 |
effects.exit(type); |
| 18028 |
return ok; |
| 18029 |
} |
| 18030 |
effects.enter(stringType); |
| 18031 |
effects.enter("chunkString", { contentType: "string" }); |
| 18032 |
return enclosed(code); |
| 18033 |
} |
| 18034 |
/** |
| 18035 |
* In enclosed destination. |
| 18036 |
* |
| 18037 |
* ```markdown |
| 18038 |
* > | <aa> |
| 18039 |
* ^ |
| 18040 |
* ``` |
| 18041 |
* |
| 18042 |
* @type {State} |
| 18043 |
*/ |
| 18044 |
function enclosed(code) { |
| 18045 |
if (code === 62) { |
| 18046 |
effects.exit("chunkString"); |
| 18047 |
effects.exit(stringType); |
| 18048 |
return enclosedBefore(code); |
| 18049 |
} |
| 18050 |
if (code === null || code === 60 || markdownLineEnding(code)) return nok(code); |
| 18051 |
effects.consume(code); |
| 18052 |
return code === 92 ? enclosedEscape : enclosed; |
| 18053 |
} |
| 18054 |
/** |
| 18055 |
* After `\`, at a special character. |
| 18056 |
* |
| 18057 |
* ```markdown |
| 18058 |
* > | <a\*a> |
| 18059 |
* ^ |
| 18060 |
* ``` |
| 18061 |
* |
| 18062 |
* @type {State} |
| 18063 |
*/ |
| 18064 |
function enclosedEscape(code) { |
| 18065 |
if (code === 60 || code === 62 || code === 92) { |
| 18066 |
effects.consume(code); |
| 18067 |
return enclosed; |
| 18068 |
} |
| 18069 |
return enclosed(code); |
| 18070 |
} |
| 18071 |
/** |
| 18072 |
* In raw destination. |
| 18073 |
* |
| 18074 |
* ```markdown |
| 18075 |
* > | aa |
| 18076 |
* ^ |
| 18077 |
* ``` |
| 18078 |
* |
| 18079 |
* @type {State} |
| 18080 |
*/ |
| 18081 |
function raw(code) { |
| 18082 |
if (!balance && (code === null || code === 41 || markdownLineEndingOrSpace(code))) { |
| 18083 |
effects.exit("chunkString"); |
| 18084 |
effects.exit(stringType); |
| 18085 |
effects.exit(rawType); |
| 18086 |
effects.exit(type); |
| 18087 |
return ok(code); |
| 18088 |
} |
| 18089 |
if (balance < limit && code === 40) { |
| 18090 |
effects.consume(code); |
| 18091 |
balance++; |
| 18092 |
return raw; |
| 18093 |
} |
| 18094 |
if (code === 41) { |
| 18095 |
effects.consume(code); |
| 18096 |
balance--; |
| 18097 |
return raw; |
| 18098 |
} |
| 18099 |
if (code === null || code === 32 || code === 40 || asciiControl(code)) return nok(code); |
| 18100 |
effects.consume(code); |
| 18101 |
return code === 92 ? rawEscape : raw; |
| 18102 |
} |
| 18103 |
/** |
| 18104 |
* After `\`, at special character. |
| 18105 |
* |
| 18106 |
* ```markdown |
| 18107 |
* > | a\*a |
| 18108 |
* ^ |
| 18109 |
* ``` |
| 18110 |
* |
| 18111 |
* @type {State} |
| 18112 |
*/ |
| 18113 |
function rawEscape(code) { |
| 18114 |
if (code === 40 || code === 41 || code === 92) { |
| 18115 |
effects.consume(code); |
| 18116 |
return raw; |
| 18117 |
} |
| 18118 |
return raw(code); |
| 18119 |
} |
| 18120 |
} |
| 18121 |
var init_micromark_factory_destination = __esmMin((() => { |
| 18122 |
init_micromark_util_character(); |
| 18123 |
})); |
| 18124 |
|
| 18125 |
//#endregion |
| 18126 |
//#region node_modules/micromark-factory-label/index.js |
| 18127 |
/** |
| 18128 |
* Parse labels. |
| 18129 |
* |
| 18130 |
* > 👉 **Note**: labels in markdown are capped at 999 characters in the string. |
| 18131 |
* |
| 18132 |
* ###### Examples |
| 18133 |
* |
| 18134 |
* ```markdown |
| 18135 |
* [a] |
| 18136 |
* [a |
| 18137 |
* b] |
| 18138 |
* [a\]b] |
| 18139 |
* ``` |
| 18140 |
* |
| 18141 |
* @this {TokenizeContext} |
| 18142 |
* Tokenize context. |
| 18143 |
* @param {Effects} effects |
| 18144 |
* Context. |
| 18145 |
* @param {State} ok |
| 18146 |
* State switched to when successful. |
| 18147 |
* @param {State} nok |
| 18148 |
* State switched to when unsuccessful. |
| 18149 |
* @param {TokenType} type |
| 18150 |
* Type of the whole label (`[a]`). |
| 18151 |
* @param {TokenType} markerType |
| 18152 |
* Type for the markers (`[` and `]`). |
| 18153 |
* @param {TokenType} stringType |
| 18154 |
* Type for the identifier (`a`). |
| 18155 |
* @returns {State} |
| 18156 |
* Start state. |
| 18157 |
*/ function factoryLabel(effects, ok, nok, type, markerType, stringType) { |
| 18158 |
const self = this; |
| 18159 |
let size = 0; |
| 18160 |
/** @type {boolean} */ |
| 18161 |
let seen; |
| 18162 |
return start; |
| 18163 |
/** |
| 18164 |
* Start of label. |
| 18165 |
* |
| 18166 |
* ```markdown |
| 18167 |
* > | [a] |
| 18168 |
* ^ |
| 18169 |
* ``` |
| 18170 |
* |
| 18171 |
* @type {State} |
| 18172 |
*/ |
| 18173 |
function start(code) { |
| 18174 |
effects.enter(type); |
| 18175 |
effects.enter(markerType); |
| 18176 |
effects.consume(code); |
| 18177 |
effects.exit(markerType); |
| 18178 |
effects.enter(stringType); |
| 18179 |
return atBreak; |
| 18180 |
} |
| 18181 |
/** |
| 18182 |
* In label, at something, before something else. |
| 18183 |
* |
| 18184 |
* ```markdown |
| 18185 |
* > | [a] |
| 18186 |
* ^ |
| 18187 |
* ``` |
| 18188 |
* |
| 18189 |
* @type {State} |
| 18190 |
*/ |
| 18191 |
function atBreak(code) { |
| 18192 |
if (size > 999 || code === null || code === 91 || code === 93 && !seen || code === 94 && !size && "_hiddenFootnoteSupport" in self.parser.constructs) return nok(code); |
| 18193 |
if (code === 93) { |
| 18194 |
effects.exit(stringType); |
| 18195 |
effects.enter(markerType); |
| 18196 |
effects.consume(code); |
| 18197 |
effects.exit(markerType); |
| 18198 |
effects.exit(type); |
| 18199 |
return ok; |
| 18200 |
} |
| 18201 |
if (markdownLineEnding(code)) { |
| 18202 |
effects.enter("lineEnding"); |
| 18203 |
effects.consume(code); |
| 18204 |
effects.exit("lineEnding"); |
| 18205 |
return atBreak; |
| 18206 |
} |
| 18207 |
effects.enter("chunkString", { contentType: "string" }); |
| 18208 |
return labelInside(code); |
| 18209 |
} |
| 18210 |
/** |
| 18211 |
* In label, in text. |
| 18212 |
* |
| 18213 |
* ```markdown |
| 18214 |
* > | [a] |
| 18215 |
* ^ |
| 18216 |
* ``` |
| 18217 |
* |
| 18218 |
* @type {State} |
| 18219 |
*/ |
| 18220 |
function labelInside(code) { |
| 18221 |
if (code === null || code === 91 || code === 93 || markdownLineEnding(code) || size++ > 999) { |
| 18222 |
effects.exit("chunkString"); |
| 18223 |
return atBreak(code); |
| 18224 |
} |
| 18225 |
effects.consume(code); |
| 18226 |
if (!seen) seen = !markdownSpace(code); |
| 18227 |
return code === 92 ? labelEscape : labelInside; |
| 18228 |
} |
| 18229 |
/** |
| 18230 |
* After `\`, at a special character. |
| 18231 |
* |
| 18232 |
* ```markdown |
| 18233 |
* > | [a\*a] |
| 18234 |
* ^ |
| 18235 |
* ``` |
| 18236 |
* |
| 18237 |
* @type {State} |
| 18238 |
*/ |
| 18239 |
function labelEscape(code) { |
| 18240 |
if (code === 91 || code === 92 || code === 93) { |
| 18241 |
effects.consume(code); |
| 18242 |
size++; |
| 18243 |
return labelInside; |
| 18244 |
} |
| 18245 |
return labelInside(code); |
| 18246 |
} |
| 18247 |
} |
| 18248 |
var init_micromark_factory_label = __esmMin((() => { |
| 18249 |
init_micromark_util_character(); |
| 18250 |
})); |
| 18251 |
|
| 18252 |
//#endregion |
| 18253 |
//#region node_modules/micromark-factory-title/index.js |
| 18254 |
/** |
| 18255 |
* Parse titles. |
| 18256 |
* |
| 18257 |
* ###### Examples |
| 18258 |
* |
| 18259 |
* ```markdown |
| 18260 |
* "a" |
| 18261 |
* 'b' |
| 18262 |
* (c) |
| 18263 |
* "a |
| 18264 |
* b" |
| 18265 |
* 'a |
| 18266 |
* b' |
| 18267 |
* (a\)b) |
| 18268 |
* ``` |
| 18269 |
* |
| 18270 |
* @param {Effects} effects |
| 18271 |
* Context. |
| 18272 |
* @param {State} ok |
| 18273 |
* State switched to when successful. |
| 18274 |
* @param {State} nok |
| 18275 |
* State switched to when unsuccessful. |
| 18276 |
* @param {TokenType} type |
| 18277 |
* Type of the whole title (`"a"`, `'b'`, `(c)`). |
| 18278 |
* @param {TokenType} markerType |
| 18279 |
* Type for the markers (`"`, `'`, `(`, and `)`). |
| 18280 |
* @param {TokenType} stringType |
| 18281 |
* Type for the value (`a`). |
| 18282 |
* @returns {State} |
| 18283 |
* Start state. |
| 18284 |
*/ function factoryTitle(effects, ok, nok, type, markerType, stringType) { |
| 18285 |
/** @type {NonNullable<Code>} */ |
| 18286 |
let marker; |
| 18287 |
return start; |
| 18288 |
/** |
| 18289 |
* Start of title. |
| 18290 |
* |
| 18291 |
* ```markdown |
| 18292 |
* > | "a" |
| 18293 |
* ^ |
| 18294 |
* ``` |
| 18295 |
* |
| 18296 |
* @type {State} |
| 18297 |
*/ |
| 18298 |
function start(code) { |
| 18299 |
if (code === 34 || code === 39 || code === 40) { |
| 18300 |
effects.enter(type); |
| 18301 |
effects.enter(markerType); |
| 18302 |
effects.consume(code); |
| 18303 |
effects.exit(markerType); |
| 18304 |
marker = code === 40 ? 41 : code; |
| 18305 |
return begin; |
| 18306 |
} |
| 18307 |
return nok(code); |
| 18308 |
} |
| 18309 |
/** |
| 18310 |
* After opening marker. |
| 18311 |
* |
| 18312 |
* This is also used at the closing marker. |
| 18313 |
* |
| 18314 |
* ```markdown |
| 18315 |
* > | "a" |
| 18316 |
* ^ |
| 18317 |
* ``` |
| 18318 |
* |
| 18319 |
* @type {State} |
| 18320 |
*/ |
| 18321 |
function begin(code) { |
| 18322 |
if (code === marker) { |
| 18323 |
effects.enter(markerType); |
| 18324 |
effects.consume(code); |
| 18325 |
effects.exit(markerType); |
| 18326 |
effects.exit(type); |
| 18327 |
return ok; |
| 18328 |
} |
| 18329 |
effects.enter(stringType); |
| 18330 |
return atBreak(code); |
| 18331 |
} |
| 18332 |
/** |
| 18333 |
* At something, before something else. |
| 18334 |
* |
| 18335 |
* ```markdown |
| 18336 |
* > | "a" |
| 18337 |
* ^ |
| 18338 |
* ``` |
| 18339 |
* |
| 18340 |
* @type {State} |
| 18341 |
*/ |
| 18342 |
function atBreak(code) { |
| 18343 |
if (code === marker) { |
| 18344 |
effects.exit(stringType); |
| 18345 |
return begin(marker); |
| 18346 |
} |
| 18347 |
if (code === null) return nok(code); |
| 18348 |
if (markdownLineEnding(code)) { |
| 18349 |
effects.enter("lineEnding"); |
| 18350 |
effects.consume(code); |
| 18351 |
effects.exit("lineEnding"); |
| 18352 |
return factorySpace(effects, atBreak, "linePrefix"); |
| 18353 |
} |
| 18354 |
effects.enter("chunkString", { contentType: "string" }); |
| 18355 |
return inside(code); |
| 18356 |
} |
| 18357 |
/** |
| 18358 |
* |
| 18359 |
* |
| 18360 |
* @type {State} |
| 18361 |
*/ |
| 18362 |
function inside(code) { |
| 18363 |
if (code === marker || code === null || markdownLineEnding(code)) { |
| 18364 |
effects.exit("chunkString"); |
| 18365 |
return atBreak(code); |
| 18366 |
} |
| 18367 |
effects.consume(code); |
| 18368 |
return code === 92 ? escape : inside; |
| 18369 |
} |
| 18370 |
/** |
| 18371 |
* After `\`, at a special character. |
| 18372 |
* |
| 18373 |
* ```markdown |
| 18374 |
* > | "a\*b" |
| 18375 |
* ^ |
| 18376 |
* ``` |
| 18377 |
* |
| 18378 |
* @type {State} |
| 18379 |
*/ |
| 18380 |
function escape(code) { |
| 18381 |
if (code === marker || code === 92) { |
| 18382 |
effects.consume(code); |
| 18383 |
return inside; |
| 18384 |
} |
| 18385 |
return inside(code); |
| 18386 |
} |
| 18387 |
} |
| 18388 |
var init_micromark_factory_title = __esmMin((() => { |
| 18389 |
init_micromark_factory_space(); |
| 18390 |
init_micromark_util_character(); |
| 18391 |
})); |
| 18392 |
|
| 18393 |
//#endregion |
| 18394 |
//#region node_modules/micromark-factory-whitespace/index.js |
| 18395 |
/** |
| 18396 |
* Parse spaces and tabs. |
| 18397 |
* |
| 18398 |
* There is no `nok` parameter: |
| 18399 |
* |
| 18400 |
* * line endings or spaces in markdown are often optional, in which case this |
| 18401 |
* factory can be used and `ok` will be switched to whether spaces were found |
| 18402 |
* or not |
| 18403 |
* * one line ending or space can be detected with |
| 18404 |
* `markdownLineEndingOrSpace(code)` right before using `factoryWhitespace` |
| 18405 |
* |
| 18406 |
* @param {Effects} effects |
| 18407 |
* Context. |
| 18408 |
* @param {State} ok |
| 18409 |
* State switched to when successful. |
| 18410 |
* @returns |
| 18411 |
* Start state. |
| 18412 |
*/ |
| 18413 |
function factoryWhitespace(effects, ok) { |
| 18414 |
/** @type {boolean} */ |
| 18415 |
let seen; |
| 18416 |
return start; |
| 18417 |
/** @type {State} */ |
| 18418 |
function start(code) { |
| 18419 |
if (markdownLineEnding(code)) { |
| 18420 |
effects.enter("lineEnding"); |
| 18421 |
effects.consume(code); |
| 18422 |
effects.exit("lineEnding"); |
| 18423 |
seen = true; |
| 18424 |
return start; |
| 18425 |
} |
| 18426 |
if (markdownSpace(code)) return factorySpace(effects, start, seen ? "linePrefix" : "lineSuffix")(code); |
| 18427 |
return ok(code); |
| 18428 |
} |
| 18429 |
} |
| 18430 |
var init_micromark_factory_whitespace = __esmMin((() => { |
| 18431 |
init_micromark_factory_space(); |
| 18432 |
init_micromark_util_character(); |
| 18433 |
})); |
| 18434 |
|
| 18435 |
//#endregion |
| 18436 |
//#region node_modules/micromark-util-normalize-identifier/index.js |
| 18437 |
/** |
| 18438 |
* Normalize an identifier (as found in references, definitions). |
| 18439 |
* |
| 18440 |
* Collapses markdown whitespace, trim, and then lower- and uppercase. |
| 18441 |
* |
| 18442 |
* Some characters are considered “uppercase”, such as U+03F4 (`ϴ`), but if their |
| 18443 |
* lowercase counterpart (U+03B8 (`θ`)) is uppercased will result in a different |
| 18444 |
* uppercase character (U+0398 (`Θ`)). |
| 18445 |
* So, to get a canonical form, we perform both lower- and uppercase. |
| 18446 |
* |
| 18447 |
* Using uppercase last makes sure keys will never interact with default |
| 18448 |
* prototypal values (such as `constructor`): nothing in the prototype of |
| 18449 |
* `Object` is uppercase. |
| 18450 |
* |
| 18451 |
* @param {string} value |
| 18452 |
* Identifier to normalize. |
| 18453 |
* @returns {string} |
| 18454 |
* Normalized identifier. |
| 18455 |
*/ |
| 18456 |
function normalizeIdentifier(value) { |
| 18457 |
return value.replace(/[\t\n\r ]+/g, " ").replace(/^ | $/g, "").toLowerCase().toUpperCase(); |
| 18458 |
} |
| 18459 |
var init_micromark_util_normalize_identifier = __esmMin((() => {})); |
| 18460 |
|
| 18461 |
//#endregion |
| 18462 |
//#region node_modules/micromark-core-commonmark/lib/definition.js |
| 18463 |
/** |
| 18464 |
* @this {TokenizeContext} |
| 18465 |
* @type {Tokenizer} |
| 18466 |
*/ |
| 18467 |
function tokenizeDefinition(effects, ok, nok) { |
| 18468 |
const self = this; |
| 18469 |
/** @type {string} */ |
| 18470 |
let identifier; |
| 18471 |
return start; |
| 18472 |
/** |
| 18473 |
* At start of a definition. |
| 18474 |
* |
| 18475 |
* ```markdown |
| 18476 |
* > | [a]: b "c" |
| 18477 |
* ^ |
| 18478 |
* ``` |
| 18479 |
* |
| 18480 |
* @type {State} |
| 18481 |
*/ |
| 18482 |
function start(code) { |
| 18483 |
effects.enter("definition"); |
| 18484 |
return before(code); |
| 18485 |
} |
| 18486 |
/** |
| 18487 |
* After optional whitespace, at `[`. |
| 18488 |
* |
| 18489 |
* ```markdown |
| 18490 |
* > | [a]: b "c" |
| 18491 |
* ^ |
| 18492 |
* ``` |
| 18493 |
* |
| 18494 |
* @type {State} |
| 18495 |
*/ |
| 18496 |
function before(code) { |
| 18497 |
return factoryLabel.call(self, effects, labelAfter, nok, "definitionLabel", "definitionLabelMarker", "definitionLabelString")(code); |
| 18498 |
} |
| 18499 |
/** |
| 18500 |
* After label. |
| 18501 |
* |
| 18502 |
* ```markdown |
| 18503 |
* > | [a]: b "c" |
| 18504 |
* ^ |
| 18505 |
* ``` |
| 18506 |
* |
| 18507 |
* @type {State} |
| 18508 |
*/ |
| 18509 |
function labelAfter(code) { |
| 18510 |
identifier = normalizeIdentifier(self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1)); |
| 18511 |
if (code === 58) { |
| 18512 |
effects.enter("definitionMarker"); |
| 18513 |
effects.consume(code); |
| 18514 |
effects.exit("definitionMarker"); |
| 18515 |
return markerAfter; |
| 18516 |
} |
| 18517 |
return nok(code); |
| 18518 |
} |
| 18519 |
/** |
| 18520 |
* After marker. |
| 18521 |
* |
| 18522 |
* ```markdown |
| 18523 |
* > | [a]: b "c" |
| 18524 |
* ^ |
| 18525 |
* ``` |
| 18526 |
* |
| 18527 |
* @type {State} |
| 18528 |
*/ |
| 18529 |
function markerAfter(code) { |
| 18530 |
return markdownLineEndingOrSpace(code) ? factoryWhitespace(effects, destinationBefore)(code) : destinationBefore(code); |
| 18531 |
} |
| 18532 |
/** |
| 18533 |
* Before destination. |
| 18534 |
* |
| 18535 |
* ```markdown |
| 18536 |
* > | [a]: b "c" |
| 18537 |
* ^ |
| 18538 |
* ``` |
| 18539 |
* |
| 18540 |
* @type {State} |
| 18541 |
*/ |
| 18542 |
function destinationBefore(code) { |
| 18543 |
return factoryDestination(effects, destinationAfter, nok, "definitionDestination", "definitionDestinationLiteral", "definitionDestinationLiteralMarker", "definitionDestinationRaw", "definitionDestinationString")(code); |
| 18544 |
} |
| 18545 |
/** |
| 18546 |
* After destination. |
| 18547 |
* |
| 18548 |
* ```markdown |
| 18549 |
* > | [a]: b "c" |
| 18550 |
* ^ |
| 18551 |
* ``` |
| 18552 |
* |
| 18553 |
* @type {State} |
| 18554 |
*/ |
| 18555 |
function destinationAfter(code) { |
| 18556 |
return effects.attempt(titleBefore, after, after)(code); |
| 18557 |
} |
| 18558 |
/** |
| 18559 |
* After definition. |
| 18560 |
* |
| 18561 |
* ```markdown |
| 18562 |
* > | [a]: b |
| 18563 |
* ^ |
| 18564 |
* > | [a]: b "c" |
| 18565 |
* ^ |
| 18566 |
* ``` |
| 18567 |
* |
| 18568 |
* @type {State} |
| 18569 |
*/ |
| 18570 |
function after(code) { |
| 18571 |
return markdownSpace(code) ? factorySpace(effects, afterWhitespace, "whitespace")(code) : afterWhitespace(code); |
| 18572 |
} |
| 18573 |
/** |
| 18574 |
* After definition, after optional whitespace. |
| 18575 |
* |
| 18576 |
* ```markdown |
| 18577 |
* > | [a]: b |
| 18578 |
* ^ |
| 18579 |
* > | [a]: b "c" |
| 18580 |
* ^ |
| 18581 |
* ``` |
| 18582 |
* |
| 18583 |
* @type {State} |
| 18584 |
*/ |
| 18585 |
function afterWhitespace(code) { |
| 18586 |
if (code === null || markdownLineEnding(code)) { |
| 18587 |
effects.exit("definition"); |
| 18588 |
self.parser.defined.push(identifier); |
| 18589 |
return ok(code); |
| 18590 |
} |
| 18591 |
return nok(code); |
| 18592 |
} |
| 18593 |
} |
| 18594 |
/** |
| 18595 |
* @this {TokenizeContext} |
| 18596 |
* @type {Tokenizer} |
| 18597 |
*/ |
| 18598 |
function tokenizeTitleBefore(effects, ok, nok) { |
| 18599 |
return titleBefore; |
| 18600 |
/** |
| 18601 |
* After destination, at whitespace. |
| 18602 |
* |
| 18603 |
* ```markdown |
| 18604 |
* > | [a]: b |
| 18605 |
* ^ |
| 18606 |
* > | [a]: b "c" |
| 18607 |
* ^ |
| 18608 |
* ``` |
| 18609 |
* |
| 18610 |
* @type {State} |
| 18611 |
*/ |
| 18612 |
function titleBefore(code) { |
| 18613 |
return markdownLineEndingOrSpace(code) ? factoryWhitespace(effects, beforeMarker)(code) : nok(code); |
| 18614 |
} |
| 18615 |
/** |
| 18616 |
* At title. |
| 18617 |
* |
| 18618 |
* ```markdown |
| 18619 |
* | [a]: b |
| 18620 |
* > | "c" |
| 18621 |
* ^ |
| 18622 |
* ``` |
| 18623 |
* |
| 18624 |
* @type {State} |
| 18625 |
*/ |
| 18626 |
function beforeMarker(code) { |
| 18627 |
return factoryTitle(effects, titleAfter, nok, "definitionTitle", "definitionTitleMarker", "definitionTitleString")(code); |
| 18628 |
} |
| 18629 |
/** |
| 18630 |
* After title. |
| 18631 |
* |
| 18632 |
* ```markdown |
| 18633 |
* > | [a]: b "c" |
| 18634 |
* ^ |
| 18635 |
* ``` |
| 18636 |
* |
| 18637 |
* @type {State} |
| 18638 |
*/ |
| 18639 |
function titleAfter(code) { |
| 18640 |
return markdownSpace(code) ? factorySpace(effects, titleAfterOptionalWhitespace, "whitespace")(code) : titleAfterOptionalWhitespace(code); |
| 18641 |
} |
| 18642 |
/** |
| 18643 |
* After title, after optional whitespace. |
| 18644 |
* |
| 18645 |
* ```markdown |
| 18646 |
* > | [a]: b "c" |
| 18647 |
* ^ |
| 18648 |
* ``` |
| 18649 |
* |
| 18650 |
* @type {State} |
| 18651 |
*/ |
| 18652 |
function titleAfterOptionalWhitespace(code) { |
| 18653 |
return code === null || markdownLineEnding(code) ? ok(code) : nok(code); |
| 18654 |
} |
| 18655 |
} |
| 18656 |
var definition, titleBefore; |
| 18657 |
var init_definition = __esmMin((() => { |
| 18658 |
init_micromark_factory_destination(); |
| 18659 |
init_micromark_factory_label(); |
| 18660 |
init_micromark_factory_space(); |
| 18661 |
init_micromark_factory_title(); |
| 18662 |
init_micromark_factory_whitespace(); |
| 18663 |
init_micromark_util_character(); |
| 18664 |
init_micromark_util_normalize_identifier(); |
| 18665 |
definition = { |
| 18666 |
name: "definition", |
| 18667 |
tokenize: tokenizeDefinition |
| 18668 |
}; |
| 18669 |
titleBefore = { |
| 18670 |
tokenize: tokenizeTitleBefore, |
| 18671 |
partial: true |
| 18672 |
}; |
| 18673 |
})); |
| 18674 |
|
| 18675 |
//#endregion |
| 18676 |
//#region node_modules/micromark-core-commonmark/lib/hard-break-escape.js |
| 18677 |
/** |
| 18678 |
* @this {TokenizeContext} |
| 18679 |
* @type {Tokenizer} |
| 18680 |
*/ |
| 18681 |
function tokenizeHardBreakEscape(effects, ok, nok) { |
| 18682 |
return start; |
| 18683 |
/** |
| 18684 |
* Start of a hard break (escape). |
| 18685 |
* |
| 18686 |
* ```markdown |
| 18687 |
* > | a\ |
| 18688 |
* ^ |
| 18689 |
* | b |
| 18690 |
* ``` |
| 18691 |
* |
| 18692 |
* @type {State} |
| 18693 |
*/ |
| 18694 |
function start(code) { |
| 18695 |
effects.enter("hardBreakEscape"); |
| 18696 |
effects.consume(code); |
| 18697 |
return after; |
| 18698 |
} |
| 18699 |
/** |
| 18700 |
* After `\`, at eol. |
| 18701 |
* |
| 18702 |
* ```markdown |
| 18703 |
* > | a\ |
| 18704 |
* ^ |
| 18705 |
* | b |
| 18706 |
* ``` |
| 18707 |
* |
| 18708 |
* @type {State} |
| 18709 |
*/ |
| 18710 |
function after(code) { |
| 18711 |
if (markdownLineEnding(code)) { |
| 18712 |
effects.exit("hardBreakEscape"); |
| 18713 |
return ok(code); |
| 18714 |
} |
| 18715 |
return nok(code); |
| 18716 |
} |
| 18717 |
} |
| 18718 |
var hardBreakEscape; |
| 18719 |
var init_hard_break_escape = __esmMin((() => { |
| 18720 |
init_micromark_util_character(); |
| 18721 |
hardBreakEscape = { |
| 18722 |
name: "hardBreakEscape", |
| 18723 |
tokenize: tokenizeHardBreakEscape |
| 18724 |
}; |
| 18725 |
})); |
| 18726 |
|
| 18727 |
//#endregion |
| 18728 |
//#region node_modules/micromark-core-commonmark/lib/heading-atx.js |
| 18729 |
/** @type {Resolver} */ |
| 18730 |
function resolveHeadingAtx(events, context) { |
| 18731 |
let contentEnd = events.length - 2; |
| 18732 |
let contentStart = 3; |
| 18733 |
/** @type {Token} */ |
| 18734 |
let content; |
| 18735 |
/** @type {Token} */ |
| 18736 |
let text; |
| 18737 |
if (events[contentStart][1].type === "whitespace") contentStart += 2; |
| 18738 |
if (contentEnd - 2 > contentStart && events[contentEnd][1].type === "whitespace") contentEnd -= 2; |
| 18739 |
if (events[contentEnd][1].type === "atxHeadingSequence" && (contentStart === contentEnd - 1 || contentEnd - 4 > contentStart && events[contentEnd - 2][1].type === "whitespace")) contentEnd -= contentStart + 1 === contentEnd ? 2 : 4; |
| 18740 |
if (contentEnd > contentStart) { |
| 18741 |
content = { |
| 18742 |
type: "atxHeadingText", |
| 18743 |
start: events[contentStart][1].start, |
| 18744 |
end: events[contentEnd][1].end |
| 18745 |
}; |
| 18746 |
text = { |
| 18747 |
type: "chunkText", |
| 18748 |
start: events[contentStart][1].start, |
| 18749 |
end: events[contentEnd][1].end, |
| 18750 |
contentType: "text" |
| 18751 |
}; |
| 18752 |
splice(events, contentStart, contentEnd - contentStart + 1, [ |
| 18753 |
[ |
| 18754 |
"enter", |
| 18755 |
content, |
| 18756 |
context |
| 18757 |
], |
| 18758 |
[ |
| 18759 |
"enter", |
| 18760 |
text, |
| 18761 |
context |
| 18762 |
], |
| 18763 |
[ |
| 18764 |
"exit", |
| 18765 |
text, |
| 18766 |
context |
| 18767 |
], |
| 18768 |
[ |
| 18769 |
"exit", |
| 18770 |
content, |
| 18771 |
context |
| 18772 |
] |
| 18773 |
]); |
| 18774 |
} |
| 18775 |
return events; |
| 18776 |
} |
| 18777 |
/** |
| 18778 |
* @this {TokenizeContext} |
| 18779 |
* @type {Tokenizer} |
| 18780 |
*/ |
| 18781 |
function tokenizeHeadingAtx(effects, ok, nok) { |
| 18782 |
let size = 0; |
| 18783 |
return start; |
| 18784 |
/** |
| 18785 |
* Start of a heading (atx). |
| 18786 |
* |
| 18787 |
* ```markdown |
| 18788 |
* > | ## aa |
| 18789 |
* ^ |
| 18790 |
* ``` |
| 18791 |
* |
| 18792 |
* @type {State} |
| 18793 |
*/ |
| 18794 |
function start(code) { |
| 18795 |
effects.enter("atxHeading"); |
| 18796 |
return before(code); |
| 18797 |
} |
| 18798 |
/** |
| 18799 |
* After optional whitespace, at `#`. |
| 18800 |
* |
| 18801 |
* ```markdown |
| 18802 |
* > | ## aa |
| 18803 |
* ^ |
| 18804 |
* ``` |
| 18805 |
* |
| 18806 |
* @type {State} |
| 18807 |
*/ |
| 18808 |
function before(code) { |
| 18809 |
effects.enter("atxHeadingSequence"); |
| 18810 |
return sequenceOpen(code); |
| 18811 |
} |
| 18812 |
/** |
| 18813 |
* In opening sequence. |
| 18814 |
* |
| 18815 |
* ```markdown |
| 18816 |
* > | ## aa |
| 18817 |
* ^ |
| 18818 |
* ``` |
| 18819 |
* |
| 18820 |
* @type {State} |
| 18821 |
*/ |
| 18822 |
function sequenceOpen(code) { |
| 18823 |
if (code === 35 && size++ < 6) { |
| 18824 |
effects.consume(code); |
| 18825 |
return sequenceOpen; |
| 18826 |
} |
| 18827 |
if (code === null || markdownLineEndingOrSpace(code)) { |
| 18828 |
effects.exit("atxHeadingSequence"); |
| 18829 |
return atBreak(code); |
| 18830 |
} |
| 18831 |
return nok(code); |
| 18832 |
} |
| 18833 |
/** |
| 18834 |
* After something, before something else. |
| 18835 |
* |
| 18836 |
* ```markdown |
| 18837 |
* > | ## aa |
| 18838 |
* ^ |
| 18839 |
* ``` |
| 18840 |
* |
| 18841 |
* @type {State} |
| 18842 |
*/ |
| 18843 |
function atBreak(code) { |
| 18844 |
if (code === 35) { |
| 18845 |
effects.enter("atxHeadingSequence"); |
| 18846 |
return sequenceFurther(code); |
| 18847 |
} |
| 18848 |
if (code === null || markdownLineEnding(code)) { |
| 18849 |
effects.exit("atxHeading"); |
| 18850 |
return ok(code); |
| 18851 |
} |
| 18852 |
if (markdownSpace(code)) return factorySpace(effects, atBreak, "whitespace")(code); |
| 18853 |
effects.enter("atxHeadingText"); |
| 18854 |
return data(code); |
| 18855 |
} |
| 18856 |
/** |
| 18857 |
* In further sequence (after whitespace). |
| 18858 |
* |
| 18859 |
* Could be normal “visible” hashes in the heading or a final sequence. |
| 18860 |
* |
| 18861 |
* ```markdown |
| 18862 |
* > | ## aa ## |
| 18863 |
* ^ |
| 18864 |
* ``` |
| 18865 |
* |
| 18866 |
* @type {State} |
| 18867 |
*/ |
| 18868 |
function sequenceFurther(code) { |
| 18869 |
if (code === 35) { |
| 18870 |
effects.consume(code); |
| 18871 |
return sequenceFurther; |
| 18872 |
} |
| 18873 |
effects.exit("atxHeadingSequence"); |
| 18874 |
return atBreak(code); |
| 18875 |
} |
| 18876 |
/** |
| 18877 |
* In text. |
| 18878 |
* |
| 18879 |
* ```markdown |
| 18880 |
* > | ## aa |
| 18881 |
* ^ |
| 18882 |
* ``` |
| 18883 |
* |
| 18884 |
* @type {State} |
| 18885 |
*/ |
| 18886 |
function data(code) { |
| 18887 |
if (code === null || code === 35 || markdownLineEndingOrSpace(code)) { |
| 18888 |
effects.exit("atxHeadingText"); |
| 18889 |
return atBreak(code); |
| 18890 |
} |
| 18891 |
effects.consume(code); |
| 18892 |
return data; |
| 18893 |
} |
| 18894 |
} |
| 18895 |
var headingAtx; |
| 18896 |
var init_heading_atx = __esmMin((() => { |
| 18897 |
init_micromark_factory_space(); |
| 18898 |
init_micromark_util_character(); |
| 18899 |
init_micromark_util_chunked(); |
| 18900 |
headingAtx = { |
| 18901 |
name: "headingAtx", |
| 18902 |
tokenize: tokenizeHeadingAtx, |
| 18903 |
resolve: resolveHeadingAtx |
| 18904 |
}; |
| 18905 |
})); |
| 18906 |
|
| 18907 |
//#endregion |
| 18908 |
//#region node_modules/micromark-util-html-tag-name/index.js |
| 18909 |
var htmlBlockNames, htmlRawNames; |
| 18910 |
var init_micromark_util_html_tag_name = __esmMin((() => { |
| 18911 |
htmlBlockNames = [ |
| 18912 |
"address", |
| 18913 |
"article", |
| 18914 |
"aside", |
| 18915 |
"base", |
| 18916 |
"basefont", |
| 18917 |
"blockquote", |
| 18918 |
"body", |
| 18919 |
"caption", |
| 18920 |
"center", |
| 18921 |
"col", |
| 18922 |
"colgroup", |
| 18923 |
"dd", |
| 18924 |
"details", |
| 18925 |
"dialog", |
| 18926 |
"dir", |
| 18927 |
"div", |
| 18928 |
"dl", |
| 18929 |
"dt", |
| 18930 |
"fieldset", |
| 18931 |
"figcaption", |
| 18932 |
"figure", |
| 18933 |
"footer", |
| 18934 |
"form", |
| 18935 |
"frame", |
| 18936 |
"frameset", |
| 18937 |
"h1", |
| 18938 |
"h2", |
| 18939 |
"h3", |
| 18940 |
"h4", |
| 18941 |
"h5", |
| 18942 |
"h6", |
| 18943 |
"head", |
| 18944 |
"header", |
| 18945 |
"hr", |
| 18946 |
"html", |
| 18947 |
"iframe", |
| 18948 |
"legend", |
| 18949 |
"li", |
| 18950 |
"link", |
| 18951 |
"main", |
| 18952 |
"menu", |
| 18953 |
"menuitem", |
| 18954 |
"nav", |
| 18955 |
"noframes", |
| 18956 |
"ol", |
| 18957 |
"optgroup", |
| 18958 |
"option", |
| 18959 |
"p", |
| 18960 |
"param", |
| 18961 |
"search", |
| 18962 |
"section", |
| 18963 |
"summary", |
| 18964 |
"table", |
| 18965 |
"tbody", |
| 18966 |
"td", |
| 18967 |
"tfoot", |
| 18968 |
"th", |
| 18969 |
"thead", |
| 18970 |
"title", |
| 18971 |
"tr", |
| 18972 |
"track", |
| 18973 |
"ul" |
| 18974 |
]; |
| 18975 |
htmlRawNames = [ |
| 18976 |
"pre", |
| 18977 |
"script", |
| 18978 |
"style", |
| 18979 |
"textarea" |
| 18980 |
]; |
| 18981 |
})); |
| 18982 |
|
| 18983 |
//#endregion |
| 18984 |
//#region node_modules/micromark-core-commonmark/lib/html-flow.js |
| 18985 |
/** @type {Resolver} */ |
| 18986 |
function resolveToHtmlFlow(events) { |
| 18987 |
let index = events.length; |
| 18988 |
while (index--) if (events[index][0] === "enter" && events[index][1].type === "htmlFlow") break; |
| 18989 |
if (index > 1 && events[index - 2][1].type === "linePrefix") { |
| 18990 |
events[index][1].start = events[index - 2][1].start; |
| 18991 |
events[index + 1][1].start = events[index - 2][1].start; |
| 18992 |
events.splice(index - 2, 2); |
| 18993 |
} |
| 18994 |
return events; |
| 18995 |
} |
| 18996 |
/** |
| 18997 |
* @this {TokenizeContext} |
| 18998 |
* @type {Tokenizer} |
| 18999 |
*/ |
| 19000 |
function tokenizeHtmlFlow(effects, ok, nok) { |
| 19001 |
const self = this; |
| 19002 |
/** @type {number} */ |
| 19003 |
let marker; |
| 19004 |
/** @type {boolean} */ |
| 19005 |
let closingTag; |
| 19006 |
/** @type {string} */ |
| 19007 |
let buffer; |
| 19008 |
/** @type {number} */ |
| 19009 |
let index; |
| 19010 |
/** @type {Code} */ |
| 19011 |
let markerB; |
| 19012 |
return start; |
| 19013 |
/** |
| 19014 |
* Start of HTML (flow). |
| 19015 |
* |
| 19016 |
* ```markdown |
| 19017 |
* > | <x /> |
| 19018 |
* ^ |
| 19019 |
* ``` |
| 19020 |
* |
| 19021 |
* @type {State} |
| 19022 |
*/ |
| 19023 |
function start(code) { |
| 19024 |
return before(code); |
| 19025 |
} |
| 19026 |
/** |
| 19027 |
* At `<`, after optional whitespace. |
| 19028 |
* |
| 19029 |
* ```markdown |
| 19030 |
* > | <x /> |
| 19031 |
* ^ |
| 19032 |
* ``` |
| 19033 |
* |
| 19034 |
* @type {State} |
| 19035 |
*/ |
| 19036 |
function before(code) { |
| 19037 |
effects.enter("htmlFlow"); |
| 19038 |
effects.enter("htmlFlowData"); |
| 19039 |
effects.consume(code); |
| 19040 |
return open; |
| 19041 |
} |
| 19042 |
/** |
| 19043 |
* After `<`, at tag name or other stuff. |
| 19044 |
* |
| 19045 |
* ```markdown |
| 19046 |
* > | <x /> |
| 19047 |
* ^ |
| 19048 |
* > | <!doctype> |
| 19049 |
* ^ |
| 19050 |
* > | <!--xxx--> |
| 19051 |
* ^ |
| 19052 |
* ``` |
| 19053 |
* |
| 19054 |
* @type {State} |
| 19055 |
*/ |
| 19056 |
function open(code) { |
| 19057 |
if (code === 33) { |
| 19058 |
effects.consume(code); |
| 19059 |
return declarationOpen; |
| 19060 |
} |
| 19061 |
if (code === 47) { |
| 19062 |
effects.consume(code); |
| 19063 |
closingTag = true; |
| 19064 |
return tagCloseStart; |
| 19065 |
} |
| 19066 |
if (code === 63) { |
| 19067 |
effects.consume(code); |
| 19068 |
marker = 3; |
| 19069 |
return self.interrupt ? ok : continuationDeclarationInside; |
| 19070 |
} |
| 19071 |
if (asciiAlpha(code)) { |
| 19072 |
effects.consume(code); |
| 19073 |
buffer = String.fromCharCode(code); |
| 19074 |
return tagName; |
| 19075 |
} |
| 19076 |
return nok(code); |
| 19077 |
} |
| 19078 |
/** |
| 19079 |
* After `<!`, at declaration, comment, or CDATA. |
| 19080 |
* |
| 19081 |
* ```markdown |
| 19082 |
* > | <!doctype> |
| 19083 |
* ^ |
| 19084 |
* > | <!--xxx--> |
| 19085 |
* ^ |
| 19086 |
* > | <![CDATA[>&<]]> |
| 19087 |
* ^ |
| 19088 |
* ``` |
| 19089 |
* |
| 19090 |
* @type {State} |
| 19091 |
*/ |
| 19092 |
function declarationOpen(code) { |
| 19093 |
if (code === 45) { |
| 19094 |
effects.consume(code); |
| 19095 |
marker = 2; |
| 19096 |
return commentOpenInside; |
| 19097 |
} |
| 19098 |
if (code === 91) { |
| 19099 |
effects.consume(code); |
| 19100 |
marker = 5; |
| 19101 |
index = 0; |
| 19102 |
return cdataOpenInside; |
| 19103 |
} |
| 19104 |
if (asciiAlpha(code)) { |
| 19105 |
effects.consume(code); |
| 19106 |
marker = 4; |
| 19107 |
return self.interrupt ? ok : continuationDeclarationInside; |
| 19108 |
} |
| 19109 |
return nok(code); |
| 19110 |
} |
| 19111 |
/** |
| 19112 |
* After `<!-`, inside a comment, at another `-`. |
| 19113 |
* |
| 19114 |
* ```markdown |
| 19115 |
* > | <!--xxx--> |
| 19116 |
* ^ |
| 19117 |
* ``` |
| 19118 |
* |
| 19119 |
* @type {State} |
| 19120 |
*/ |
| 19121 |
function commentOpenInside(code) { |
| 19122 |
if (code === 45) { |
| 19123 |
effects.consume(code); |
| 19124 |
return self.interrupt ? ok : continuationDeclarationInside; |
| 19125 |
} |
| 19126 |
return nok(code); |
| 19127 |
} |
| 19128 |
/** |
| 19129 |
* After `<![`, inside CDATA, expecting `CDATA[`. |
| 19130 |
* |
| 19131 |
* ```markdown |
| 19132 |
* > | <![CDATA[>&<]]> |
| 19133 |
* ^^^^^^ |
| 19134 |
* ``` |
| 19135 |
* |
| 19136 |
* @type {State} |
| 19137 |
*/ |
| 19138 |
function cdataOpenInside(code) { |
| 19139 |
if (code === "CDATA[".charCodeAt(index++)) { |
| 19140 |
effects.consume(code); |
| 19141 |
if (index === 6) return self.interrupt ? ok : continuation; |
| 19142 |
return cdataOpenInside; |
| 19143 |
} |
| 19144 |
return nok(code); |
| 19145 |
} |
| 19146 |
/** |
| 19147 |
* After `</`, in closing tag, at tag name. |
| 19148 |
* |
| 19149 |
* ```markdown |
| 19150 |
* > | </x> |
| 19151 |
* ^ |
| 19152 |
* ``` |
| 19153 |
* |
| 19154 |
* @type {State} |
| 19155 |
*/ |
| 19156 |
function tagCloseStart(code) { |
| 19157 |
if (asciiAlpha(code)) { |
| 19158 |
effects.consume(code); |
| 19159 |
buffer = String.fromCharCode(code); |
| 19160 |
return tagName; |
| 19161 |
} |
| 19162 |
return nok(code); |
| 19163 |
} |
| 19164 |
/** |
| 19165 |
* In tag name. |
| 19166 |
* |
| 19167 |
* ```markdown |
| 19168 |
* > | <ab> |
| 19169 |
* ^^ |
| 19170 |
* > | </ab> |
| 19171 |
* ^^ |
| 19172 |
* ``` |
| 19173 |
* |
| 19174 |
* @type {State} |
| 19175 |
*/ |
| 19176 |
function tagName(code) { |
| 19177 |
if (code === null || code === 47 || code === 62 || markdownLineEndingOrSpace(code)) { |
| 19178 |
const slash = code === 47; |
| 19179 |
const name = buffer.toLowerCase(); |
| 19180 |
if (!slash && !closingTag && htmlRawNames.includes(name)) { |
| 19181 |
marker = 1; |
| 19182 |
return self.interrupt ? ok(code) : continuation(code); |
| 19183 |
} |
| 19184 |
if (htmlBlockNames.includes(buffer.toLowerCase())) { |
| 19185 |
marker = 6; |
| 19186 |
if (slash) { |
| 19187 |
effects.consume(code); |
| 19188 |
return basicSelfClosing; |
| 19189 |
} |
| 19190 |
return self.interrupt ? ok(code) : continuation(code); |
| 19191 |
} |
| 19192 |
marker = 7; |
| 19193 |
return self.interrupt && !self.parser.lazy[self.now().line] ? nok(code) : closingTag ? completeClosingTagAfter(code) : completeAttributeNameBefore(code); |
| 19194 |
} |
| 19195 |
if (code === 45 || asciiAlphanumeric(code)) { |
| 19196 |
effects.consume(code); |
| 19197 |
buffer += String.fromCharCode(code); |
| 19198 |
return tagName; |
| 19199 |
} |
| 19200 |
return nok(code); |
| 19201 |
} |
| 19202 |
/** |
| 19203 |
* After closing slash of a basic tag name. |
| 19204 |
* |
| 19205 |
* ```markdown |
| 19206 |
* > | <div/> |
| 19207 |
* ^ |
| 19208 |
* ``` |
| 19209 |
* |
| 19210 |
* @type {State} |
| 19211 |
*/ |
| 19212 |
function basicSelfClosing(code) { |
| 19213 |
if (code === 62) { |
| 19214 |
effects.consume(code); |
| 19215 |
return self.interrupt ? ok : continuation; |
| 19216 |
} |
| 19217 |
return nok(code); |
| 19218 |
} |
| 19219 |
/** |
| 19220 |
* After closing slash of a complete tag name. |
| 19221 |
* |
| 19222 |
* ```markdown |
| 19223 |
* > | <x/> |
| 19224 |
* ^ |
| 19225 |
* ``` |
| 19226 |
* |
| 19227 |
* @type {State} |
| 19228 |
*/ |
| 19229 |
function completeClosingTagAfter(code) { |
| 19230 |
if (markdownSpace(code)) { |
| 19231 |
effects.consume(code); |
| 19232 |
return completeClosingTagAfter; |
| 19233 |
} |
| 19234 |
return completeEnd(code); |
| 19235 |
} |
| 19236 |
/** |
| 19237 |
* At an attribute name. |
| 19238 |
* |
| 19239 |
* At first, this state is used after a complete tag name, after whitespace, |
| 19240 |
* where it expects optional attributes or the end of the tag. |
| 19241 |
* It is also reused after attributes, when expecting more optional |
| 19242 |
* attributes. |
| 19243 |
* |
| 19244 |
* ```markdown |
| 19245 |
* > | <a /> |
| 19246 |
* ^ |
| 19247 |
* > | <a :b> |
| 19248 |
* ^ |
| 19249 |
* > | <a _b> |
| 19250 |
* ^ |
| 19251 |
* > | <a b> |
| 19252 |
* ^ |
| 19253 |
* > | <a > |
| 19254 |
* ^ |
| 19255 |
* ``` |
| 19256 |
* |
| 19257 |
* @type {State} |
| 19258 |
*/ |
| 19259 |
function completeAttributeNameBefore(code) { |
| 19260 |
if (code === 47) { |
| 19261 |
effects.consume(code); |
| 19262 |
return completeEnd; |
| 19263 |
} |
| 19264 |
if (code === 58 || code === 95 || asciiAlpha(code)) { |
| 19265 |
effects.consume(code); |
| 19266 |
return completeAttributeName; |
| 19267 |
} |
| 19268 |
if (markdownSpace(code)) { |
| 19269 |
effects.consume(code); |
| 19270 |
return completeAttributeNameBefore; |
| 19271 |
} |
| 19272 |
return completeEnd(code); |
| 19273 |
} |
| 19274 |
/** |
| 19275 |
* In attribute name. |
| 19276 |
* |
| 19277 |
* ```markdown |
| 19278 |
* > | <a :b> |
| 19279 |
* ^ |
| 19280 |
* > | <a _b> |
| 19281 |
* ^ |
| 19282 |
* > | <a b> |
| 19283 |
* ^ |
| 19284 |
* ``` |
| 19285 |
* |
| 19286 |
* @type {State} |
| 19287 |
*/ |
| 19288 |
function completeAttributeName(code) { |
| 19289 |
if (code === 45 || code === 46 || code === 58 || code === 95 || asciiAlphanumeric(code)) { |
| 19290 |
effects.consume(code); |
| 19291 |
return completeAttributeName; |
| 19292 |
} |
| 19293 |
return completeAttributeNameAfter(code); |
| 19294 |
} |
| 19295 |
/** |
| 19296 |
* After attribute name, at an optional initializer, the end of the tag, or |
| 19297 |
* whitespace. |
| 19298 |
* |
| 19299 |
* ```markdown |
| 19300 |
* > | <a b> |
| 19301 |
* ^ |
| 19302 |
* > | <a b=c> |
| 19303 |
* ^ |
| 19304 |
* ``` |
| 19305 |
* |
| 19306 |
* @type {State} |
| 19307 |
*/ |
| 19308 |
function completeAttributeNameAfter(code) { |
| 19309 |
if (code === 61) { |
| 19310 |
effects.consume(code); |
| 19311 |
return completeAttributeValueBefore; |
| 19312 |
} |
| 19313 |
if (markdownSpace(code)) { |
| 19314 |
effects.consume(code); |
| 19315 |
return completeAttributeNameAfter; |
| 19316 |
} |
| 19317 |
return completeAttributeNameBefore(code); |
| 19318 |
} |
| 19319 |
/** |
| 19320 |
* Before unquoted, double quoted, or single quoted attribute value, allowing |
| 19321 |
* whitespace. |
| 19322 |
* |
| 19323 |
* ```markdown |
| 19324 |
* > | <a b=c> |
| 19325 |
* ^ |
| 19326 |
* > | <a b="c"> |
| 19327 |
* ^ |
| 19328 |
* ``` |
| 19329 |
* |
| 19330 |
* @type {State} |
| 19331 |
*/ |
| 19332 |
function completeAttributeValueBefore(code) { |
| 19333 |
if (code === null || code === 60 || code === 61 || code === 62 || code === 96) return nok(code); |
| 19334 |
if (code === 34 || code === 39) { |
| 19335 |
effects.consume(code); |
| 19336 |
markerB = code; |
| 19337 |
return completeAttributeValueQuoted; |
| 19338 |
} |
| 19339 |
if (markdownSpace(code)) { |
| 19340 |
effects.consume(code); |
| 19341 |
return completeAttributeValueBefore; |
| 19342 |
} |
| 19343 |
return completeAttributeValueUnquoted(code); |
| 19344 |
} |
| 19345 |
/** |
| 19346 |
* In double or single quoted attribute value. |
| 19347 |
* |
| 19348 |
* ```markdown |
| 19349 |
* > | <a b="c"> |
| 19350 |
* ^ |
| 19351 |
* > | <a b='c'> |
| 19352 |
* ^ |
| 19353 |
* ``` |
| 19354 |
* |
| 19355 |
* @type {State} |
| 19356 |
*/ |
| 19357 |
function completeAttributeValueQuoted(code) { |
| 19358 |
if (code === markerB) { |
| 19359 |
effects.consume(code); |
| 19360 |
markerB = null; |
| 19361 |
return completeAttributeValueQuotedAfter; |
| 19362 |
} |
| 19363 |
if (code === null || markdownLineEnding(code)) return nok(code); |
| 19364 |
effects.consume(code); |
| 19365 |
return completeAttributeValueQuoted; |
| 19366 |
} |
| 19367 |
/** |
| 19368 |
* In unquoted attribute value. |
| 19369 |
* |
| 19370 |
* ```markdown |
| 19371 |
* > | <a b=c> |
| 19372 |
* ^ |
| 19373 |
* ``` |
| 19374 |
* |
| 19375 |
* @type {State} |
| 19376 |
*/ |
| 19377 |
function completeAttributeValueUnquoted(code) { |
| 19378 |
if (code === null || code === 34 || code === 39 || code === 47 || code === 60 || code === 61 || code === 62 || code === 96 || markdownLineEndingOrSpace(code)) return completeAttributeNameAfter(code); |
| 19379 |
effects.consume(code); |
| 19380 |
return completeAttributeValueUnquoted; |
| 19381 |
} |
| 19382 |
/** |
| 19383 |
* After double or single quoted attribute value, before whitespace or the |
| 19384 |
* end of the tag. |
| 19385 |
* |
| 19386 |
* ```markdown |
| 19387 |
* > | <a b="c"> |
| 19388 |
* ^ |
| 19389 |
* ``` |
| 19390 |
* |
| 19391 |
* @type {State} |
| 19392 |
*/ |
| 19393 |
function completeAttributeValueQuotedAfter(code) { |
| 19394 |
if (code === 47 || code === 62 || markdownSpace(code)) return completeAttributeNameBefore(code); |
| 19395 |
return nok(code); |
| 19396 |
} |
| 19397 |
/** |
| 19398 |
* In certain circumstances of a complete tag where only an `>` is allowed. |
| 19399 |
* |
| 19400 |
* ```markdown |
| 19401 |
* > | <a b="c"> |
| 19402 |
* ^ |
| 19403 |
* ``` |
| 19404 |
* |
| 19405 |
* @type {State} |
| 19406 |
*/ |
| 19407 |
function completeEnd(code) { |
| 19408 |
if (code === 62) { |
| 19409 |
effects.consume(code); |
| 19410 |
return completeAfter; |
| 19411 |
} |
| 19412 |
return nok(code); |
| 19413 |
} |
| 19414 |
/** |
| 19415 |
* After `>` in a complete tag. |
| 19416 |
* |
| 19417 |
* ```markdown |
| 19418 |
* > | <x> |
| 19419 |
* ^ |
| 19420 |
* ``` |
| 19421 |
* |
| 19422 |
* @type {State} |
| 19423 |
*/ |
| 19424 |
function completeAfter(code) { |
| 19425 |
if (code === null || markdownLineEnding(code)) return continuation(code); |
| 19426 |
if (markdownSpace(code)) { |
| 19427 |
effects.consume(code); |
| 19428 |
return completeAfter; |
| 19429 |
} |
| 19430 |
return nok(code); |
| 19431 |
} |
| 19432 |
/** |
| 19433 |
* In continuation of any HTML kind. |
| 19434 |
* |
| 19435 |
* ```markdown |
| 19436 |
* > | <!--xxx--> |
| 19437 |
* ^ |
| 19438 |
* ``` |
| 19439 |
* |
| 19440 |
* @type {State} |
| 19441 |
*/ |
| 19442 |
function continuation(code) { |
| 19443 |
if (code === 45 && marker === 2) { |
| 19444 |
effects.consume(code); |
| 19445 |
return continuationCommentInside; |
| 19446 |
} |
| 19447 |
if (code === 60 && marker === 1) { |
| 19448 |
effects.consume(code); |
| 19449 |
return continuationRawTagOpen; |
| 19450 |
} |
| 19451 |
if (code === 62 && marker === 4) { |
| 19452 |
effects.consume(code); |
| 19453 |
return continuationClose; |
| 19454 |
} |
| 19455 |
if (code === 63 && marker === 3) { |
| 19456 |
effects.consume(code); |
| 19457 |
return continuationDeclarationInside; |
| 19458 |
} |
| 19459 |
if (code === 93 && marker === 5) { |
| 19460 |
effects.consume(code); |
| 19461 |
return continuationCdataInside; |
| 19462 |
} |
| 19463 |
if (markdownLineEnding(code) && (marker === 6 || marker === 7)) { |
| 19464 |
effects.exit("htmlFlowData"); |
| 19465 |
return effects.check(blankLineBefore, continuationAfter, continuationStart)(code); |
| 19466 |
} |
| 19467 |
if (code === null || markdownLineEnding(code)) { |
| 19468 |
effects.exit("htmlFlowData"); |
| 19469 |
return continuationStart(code); |
| 19470 |
} |
| 19471 |
effects.consume(code); |
| 19472 |
return continuation; |
| 19473 |
} |
| 19474 |
/** |
| 19475 |
* In continuation, at eol. |
| 19476 |
* |
| 19477 |
* ```markdown |
| 19478 |
* > | <x> |
| 19479 |
* ^ |
| 19480 |
* | asd |
| 19481 |
* ``` |
| 19482 |
* |
| 19483 |
* @type {State} |
| 19484 |
*/ |
| 19485 |
function continuationStart(code) { |
| 19486 |
return effects.check(nonLazyContinuationStart, continuationStartNonLazy, continuationAfter)(code); |
| 19487 |
} |
| 19488 |
/** |
| 19489 |
* In continuation, at eol, before non-lazy content. |
| 19490 |
* |
| 19491 |
* ```markdown |
| 19492 |
* > | <x> |
| 19493 |
* ^ |
| 19494 |
* | asd |
| 19495 |
* ``` |
| 19496 |
* |
| 19497 |
* @type {State} |
| 19498 |
*/ |
| 19499 |
function continuationStartNonLazy(code) { |
| 19500 |
effects.enter("lineEnding"); |
| 19501 |
effects.consume(code); |
| 19502 |
effects.exit("lineEnding"); |
| 19503 |
return continuationBefore; |
| 19504 |
} |
| 19505 |
/** |
| 19506 |
* In continuation, before non-lazy content. |
| 19507 |
* |
| 19508 |
* ```markdown |
| 19509 |
* | <x> |
| 19510 |
* > | asd |
| 19511 |
* ^ |
| 19512 |
* ``` |
| 19513 |
* |
| 19514 |
* @type {State} |
| 19515 |
*/ |
| 19516 |
function continuationBefore(code) { |
| 19517 |
if (code === null || markdownLineEnding(code)) return continuationStart(code); |
| 19518 |
effects.enter("htmlFlowData"); |
| 19519 |
return continuation(code); |
| 19520 |
} |
| 19521 |
/** |
| 19522 |
* In comment continuation, after one `-`, expecting another. |
| 19523 |
* |
| 19524 |
* ```markdown |
| 19525 |
* > | <!--xxx--> |
| 19526 |
* ^ |
| 19527 |
* ``` |
| 19528 |
* |
| 19529 |
* @type {State} |
| 19530 |
*/ |
| 19531 |
function continuationCommentInside(code) { |
| 19532 |
if (code === 45) { |
| 19533 |
effects.consume(code); |
| 19534 |
return continuationDeclarationInside; |
| 19535 |
} |
| 19536 |
return continuation(code); |
| 19537 |
} |
| 19538 |
/** |
| 19539 |
* In raw continuation, after `<`, at `/`. |
| 19540 |
* |
| 19541 |
* ```markdown |
| 19542 |
* > | <script>console.log(1)<\/script> |
| 19543 |
* ^ |
| 19544 |
* ``` |
| 19545 |
* |
| 19546 |
* @type {State} |
| 19547 |
*/ |
| 19548 |
function continuationRawTagOpen(code) { |
| 19549 |
if (code === 47) { |
| 19550 |
effects.consume(code); |
| 19551 |
buffer = ""; |
| 19552 |
return continuationRawEndTag; |
| 19553 |
} |
| 19554 |
return continuation(code); |
| 19555 |
} |
| 19556 |
/** |
| 19557 |
* In raw continuation, after `</`, in a raw tag name. |
| 19558 |
* |
| 19559 |
* ```markdown |
| 19560 |
* > | <script>console.log(1)<\/script> |
| 19561 |
* ^^^^^^ |
| 19562 |
* ``` |
| 19563 |
* |
| 19564 |
* @type {State} |
| 19565 |
*/ |
| 19566 |
function continuationRawEndTag(code) { |
| 19567 |
if (code === 62) { |
| 19568 |
const name = buffer.toLowerCase(); |
| 19569 |
if (htmlRawNames.includes(name)) { |
| 19570 |
effects.consume(code); |
| 19571 |
return continuationClose; |
| 19572 |
} |
| 19573 |
return continuation(code); |
| 19574 |
} |
| 19575 |
if (asciiAlpha(code) && buffer.length < 8) { |
| 19576 |
effects.consume(code); |
| 19577 |
buffer += String.fromCharCode(code); |
| 19578 |
return continuationRawEndTag; |
| 19579 |
} |
| 19580 |
return continuation(code); |
| 19581 |
} |
| 19582 |
/** |
| 19583 |
* In cdata continuation, after `]`, expecting `]>`. |
| 19584 |
* |
| 19585 |
* ```markdown |
| 19586 |
* > | <![CDATA[>&<]]> |
| 19587 |
* ^ |
| 19588 |
* ``` |
| 19589 |
* |
| 19590 |
* @type {State} |
| 19591 |
*/ |
| 19592 |
function continuationCdataInside(code) { |
| 19593 |
if (code === 93) { |
| 19594 |
effects.consume(code); |
| 19595 |
return continuationDeclarationInside; |
| 19596 |
} |
| 19597 |
return continuation(code); |
| 19598 |
} |
| 19599 |
/** |
| 19600 |
* In declaration or instruction continuation, at `>`. |
| 19601 |
* |
| 19602 |
* ```markdown |
| 19603 |
* > | <!--> |
| 19604 |
* ^ |
| 19605 |
* > | <?> |
| 19606 |
* ^ |
| 19607 |
* > | <!q> |
| 19608 |
* ^ |
| 19609 |
* > | <!--ab--> |
| 19610 |
* ^ |
| 19611 |
* > | <![CDATA[>&<]]> |
| 19612 |
* ^ |
| 19613 |
* ``` |
| 19614 |
* |
| 19615 |
* @type {State} |
| 19616 |
*/ |
| 19617 |
function continuationDeclarationInside(code) { |
| 19618 |
if (code === 62) { |
| 19619 |
effects.consume(code); |
| 19620 |
return continuationClose; |
| 19621 |
} |
| 19622 |
if (code === 45 && marker === 2) { |
| 19623 |
effects.consume(code); |
| 19624 |
return continuationDeclarationInside; |
| 19625 |
} |
| 19626 |
return continuation(code); |
| 19627 |
} |
| 19628 |
/** |
| 19629 |
* In closed continuation: everything we get until the eol/eof is part of it. |
| 19630 |
* |
| 19631 |
* ```markdown |
| 19632 |
* > | <!doctype> |
| 19633 |
* ^ |
| 19634 |
* ``` |
| 19635 |
* |
| 19636 |
* @type {State} |
| 19637 |
*/ |
| 19638 |
function continuationClose(code) { |
| 19639 |
if (code === null || markdownLineEnding(code)) { |
| 19640 |
effects.exit("htmlFlowData"); |
| 19641 |
return continuationAfter(code); |
| 19642 |
} |
| 19643 |
effects.consume(code); |
| 19644 |
return continuationClose; |
| 19645 |
} |
| 19646 |
/** |
| 19647 |
* Done. |
| 19648 |
* |
| 19649 |
* ```markdown |
| 19650 |
* > | <!doctype> |
| 19651 |
* ^ |
| 19652 |
* ``` |
| 19653 |
* |
| 19654 |
* @type {State} |
| 19655 |
*/ |
| 19656 |
function continuationAfter(code) { |
| 19657 |
effects.exit("htmlFlow"); |
| 19658 |
return ok(code); |
| 19659 |
} |
| 19660 |
} |
| 19661 |
/** |
| 19662 |
* @this {TokenizeContext} |
| 19663 |
* @type {Tokenizer} |
| 19664 |
*/ |
| 19665 |
function tokenizeNonLazyContinuationStart(effects, ok, nok) { |
| 19666 |
const self = this; |
| 19667 |
return start; |
| 19668 |
/** |
| 19669 |
* At eol, before continuation. |
| 19670 |
* |
| 19671 |
* ```markdown |
| 19672 |
* > | * ```js |
| 19673 |
* ^ |
| 19674 |
* | b |
| 19675 |
* ``` |
| 19676 |
* |
| 19677 |
* @type {State} |
| 19678 |
*/ |
| 19679 |
function start(code) { |
| 19680 |
if (markdownLineEnding(code)) { |
| 19681 |
effects.enter("lineEnding"); |
| 19682 |
effects.consume(code); |
| 19683 |
effects.exit("lineEnding"); |
| 19684 |
return after; |
| 19685 |
} |
| 19686 |
return nok(code); |
| 19687 |
} |
| 19688 |
/** |
| 19689 |
* A continuation. |
| 19690 |
* |
| 19691 |
* ```markdown |
| 19692 |
* | * ```js |
| 19693 |
* > | b |
| 19694 |
* ^ |
| 19695 |
* ``` |
| 19696 |
* |
| 19697 |
* @type {State} |
| 19698 |
*/ |
| 19699 |
function after(code) { |
| 19700 |
return self.parser.lazy[self.now().line] ? nok(code) : ok(code); |
| 19701 |
} |
| 19702 |
} |
| 19703 |
/** |
| 19704 |
* @this {TokenizeContext} |
| 19705 |
* @type {Tokenizer} |
| 19706 |
*/ |
| 19707 |
function tokenizeBlankLineBefore(effects, ok, nok) { |
| 19708 |
return start; |
| 19709 |
/** |
| 19710 |
* Before eol, expecting blank line. |
| 19711 |
* |
| 19712 |
* ```markdown |
| 19713 |
* > | <div> |
| 19714 |
* ^ |
| 19715 |
* | |
| 19716 |
* ``` |
| 19717 |
* |
| 19718 |
* @type {State} |
| 19719 |
*/ |
| 19720 |
function start(code) { |
| 19721 |
effects.enter("lineEnding"); |
| 19722 |
effects.consume(code); |
| 19723 |
effects.exit("lineEnding"); |
| 19724 |
return effects.attempt(blankLine, ok, nok); |
| 19725 |
} |
| 19726 |
} |
| 19727 |
var htmlFlow, blankLineBefore, nonLazyContinuationStart; |
| 19728 |
var init_html_flow = __esmMin((() => { |
| 19729 |
init_micromark_util_character(); |
| 19730 |
init_micromark_util_html_tag_name(); |
| 19731 |
init_blank_line(); |
| 19732 |
htmlFlow = { |
| 19733 |
name: "htmlFlow", |
| 19734 |
tokenize: tokenizeHtmlFlow, |
| 19735 |
resolveTo: resolveToHtmlFlow, |
| 19736 |
concrete: true |
| 19737 |
}; |
| 19738 |
blankLineBefore = { |
| 19739 |
tokenize: tokenizeBlankLineBefore, |
| 19740 |
partial: true |
| 19741 |
}; |
| 19742 |
nonLazyContinuationStart = { |
| 19743 |
tokenize: tokenizeNonLazyContinuationStart, |
| 19744 |
partial: true |
| 19745 |
}; |
| 19746 |
})); |
| 19747 |
|
| 19748 |
//#endregion |
| 19749 |
//#region node_modules/micromark-core-commonmark/lib/html-text.js |
| 19750 |
/** |
| 19751 |
* @this {TokenizeContext} |
| 19752 |
* @type {Tokenizer} |
| 19753 |
*/ |
| 19754 |
function tokenizeHtmlText(effects, ok, nok) { |
| 19755 |
const self = this; |
| 19756 |
/** @type {NonNullable<Code> | undefined} */ |
| 19757 |
let marker; |
| 19758 |
/** @type {number} */ |
| 19759 |
let index; |
| 19760 |
/** @type {State} */ |
| 19761 |
let returnState; |
| 19762 |
return start; |
| 19763 |
/** |
| 19764 |
* Start of HTML (text). |
| 19765 |
* |
| 19766 |
* ```markdown |
| 19767 |
* > | a <b> c |
| 19768 |
* ^ |
| 19769 |
* ``` |
| 19770 |
* |
| 19771 |
* @type {State} |
| 19772 |
*/ |
| 19773 |
function start(code) { |
| 19774 |
effects.enter("htmlText"); |
| 19775 |
effects.enter("htmlTextData"); |
| 19776 |
effects.consume(code); |
| 19777 |
return open; |
| 19778 |
} |
| 19779 |
/** |
| 19780 |
* After `<`, at tag name or other stuff. |
| 19781 |
* |
| 19782 |
* ```markdown |
| 19783 |
* > | a <b> c |
| 19784 |
* ^ |
| 19785 |
* > | a <!doctype> c |
| 19786 |
* ^ |
| 19787 |
* > | a <!--b--> c |
| 19788 |
* ^ |
| 19789 |
* ``` |
| 19790 |
* |
| 19791 |
* @type {State} |
| 19792 |
*/ |
| 19793 |
function open(code) { |
| 19794 |
if (code === 33) { |
| 19795 |
effects.consume(code); |
| 19796 |
return declarationOpen; |
| 19797 |
} |
| 19798 |
if (code === 47) { |
| 19799 |
effects.consume(code); |
| 19800 |
return tagCloseStart; |
| 19801 |
} |
| 19802 |
if (code === 63) { |
| 19803 |
effects.consume(code); |
| 19804 |
return instruction; |
| 19805 |
} |
| 19806 |
if (asciiAlpha(code)) { |
| 19807 |
effects.consume(code); |
| 19808 |
return tagOpen; |
| 19809 |
} |
| 19810 |
return nok(code); |
| 19811 |
} |
| 19812 |
/** |
| 19813 |
* After `<!`, at declaration, comment, or CDATA. |
| 19814 |
* |
| 19815 |
* ```markdown |
| 19816 |
* > | a <!doctype> c |
| 19817 |
* ^ |
| 19818 |
* > | a <!--b--> c |
| 19819 |
* ^ |
| 19820 |
* > | a <![CDATA[>&<]]> c |
| 19821 |
* ^ |
| 19822 |
* ``` |
| 19823 |
* |
| 19824 |
* @type {State} |
| 19825 |
*/ |
| 19826 |
function declarationOpen(code) { |
| 19827 |
if (code === 45) { |
| 19828 |
effects.consume(code); |
| 19829 |
return commentOpenInside; |
| 19830 |
} |
| 19831 |
if (code === 91) { |
| 19832 |
effects.consume(code); |
| 19833 |
index = 0; |
| 19834 |
return cdataOpenInside; |
| 19835 |
} |
| 19836 |
if (asciiAlpha(code)) { |
| 19837 |
effects.consume(code); |
| 19838 |
return declaration; |
| 19839 |
} |
| 19840 |
return nok(code); |
| 19841 |
} |
| 19842 |
/** |
| 19843 |
* In a comment, after `<!-`, at another `-`. |
| 19844 |
* |
| 19845 |
* ```markdown |
| 19846 |
* > | a <!--b--> c |
| 19847 |
* ^ |
| 19848 |
* ``` |
| 19849 |
* |
| 19850 |
* @type {State} |
| 19851 |
*/ |
| 19852 |
function commentOpenInside(code) { |
| 19853 |
if (code === 45) { |
| 19854 |
effects.consume(code); |
| 19855 |
return commentEnd; |
| 19856 |
} |
| 19857 |
return nok(code); |
| 19858 |
} |
| 19859 |
/** |
| 19860 |
* In comment. |
| 19861 |
* |
| 19862 |
* ```markdown |
| 19863 |
* > | a <!--b--> c |
| 19864 |
* ^ |
| 19865 |
* ``` |
| 19866 |
* |
| 19867 |
* @type {State} |
| 19868 |
*/ |
| 19869 |
function comment(code) { |
| 19870 |
if (code === null) return nok(code); |
| 19871 |
if (code === 45) { |
| 19872 |
effects.consume(code); |
| 19873 |
return commentClose; |
| 19874 |
} |
| 19875 |
if (markdownLineEnding(code)) { |
| 19876 |
returnState = comment; |
| 19877 |
return lineEndingBefore(code); |
| 19878 |
} |
| 19879 |
effects.consume(code); |
| 19880 |
return comment; |
| 19881 |
} |
| 19882 |
/** |
| 19883 |
* In comment, after `-`. |
| 19884 |
* |
| 19885 |
* ```markdown |
| 19886 |
* > | a <!--b--> c |
| 19887 |
* ^ |
| 19888 |
* ``` |
| 19889 |
* |
| 19890 |
* @type {State} |
| 19891 |
*/ |
| 19892 |
function commentClose(code) { |
| 19893 |
if (code === 45) { |
| 19894 |
effects.consume(code); |
| 19895 |
return commentEnd; |
| 19896 |
} |
| 19897 |
return comment(code); |
| 19898 |
} |
| 19899 |
/** |
| 19900 |
* In comment, after `--`. |
| 19901 |
* |
| 19902 |
* ```markdown |
| 19903 |
* > | a <!--b--> c |
| 19904 |
* ^ |
| 19905 |
* ``` |
| 19906 |
* |
| 19907 |
* @type {State} |
| 19908 |
*/ |
| 19909 |
function commentEnd(code) { |
| 19910 |
return code === 62 ? end(code) : code === 45 ? commentClose(code) : comment(code); |
| 19911 |
} |
| 19912 |
/** |
| 19913 |
* After `<![`, in CDATA, expecting `CDATA[`. |
| 19914 |
* |
| 19915 |
* ```markdown |
| 19916 |
* > | a <![CDATA[>&<]]> b |
| 19917 |
* ^^^^^^ |
| 19918 |
* ``` |
| 19919 |
* |
| 19920 |
* @type {State} |
| 19921 |
*/ |
| 19922 |
function cdataOpenInside(code) { |
| 19923 |
if (code === "CDATA[".charCodeAt(index++)) { |
| 19924 |
effects.consume(code); |
| 19925 |
return index === 6 ? cdata : cdataOpenInside; |
| 19926 |
} |
| 19927 |
return nok(code); |
| 19928 |
} |
| 19929 |
/** |
| 19930 |
* In CDATA. |
| 19931 |
* |
| 19932 |
* ```markdown |
| 19933 |
* > | a <![CDATA[>&<]]> b |
| 19934 |
* ^^^ |
| 19935 |
* ``` |
| 19936 |
* |
| 19937 |
* @type {State} |
| 19938 |
*/ |
| 19939 |
function cdata(code) { |
| 19940 |
if (code === null) return nok(code); |
| 19941 |
if (code === 93) { |
| 19942 |
effects.consume(code); |
| 19943 |
return cdataClose; |
| 19944 |
} |
| 19945 |
if (markdownLineEnding(code)) { |
| 19946 |
returnState = cdata; |
| 19947 |
return lineEndingBefore(code); |
| 19948 |
} |
| 19949 |
effects.consume(code); |
| 19950 |
return cdata; |
| 19951 |
} |
| 19952 |
/** |
| 19953 |
* In CDATA, after `]`, at another `]`. |
| 19954 |
* |
| 19955 |
* ```markdown |
| 19956 |
* > | a <![CDATA[>&<]]> b |
| 19957 |
* ^ |
| 19958 |
* ``` |
| 19959 |
* |
| 19960 |
* @type {State} |
| 19961 |
*/ |
| 19962 |
function cdataClose(code) { |
| 19963 |
if (code === 93) { |
| 19964 |
effects.consume(code); |
| 19965 |
return cdataEnd; |
| 19966 |
} |
| 19967 |
return cdata(code); |
| 19968 |
} |
| 19969 |
/** |
| 19970 |
* In CDATA, after `]]`, at `>`. |
| 19971 |
* |
| 19972 |
* ```markdown |
| 19973 |
* > | a <![CDATA[>&<]]> b |
| 19974 |
* ^ |
| 19975 |
* ``` |
| 19976 |
* |
| 19977 |
* @type {State} |
| 19978 |
*/ |
| 19979 |
function cdataEnd(code) { |
| 19980 |
if (code === 62) return end(code); |
| 19981 |
if (code === 93) { |
| 19982 |
effects.consume(code); |
| 19983 |
return cdataEnd; |
| 19984 |
} |
| 19985 |
return cdata(code); |
| 19986 |
} |
| 19987 |
/** |
| 19988 |
* In declaration. |
| 19989 |
* |
| 19990 |
* ```markdown |
| 19991 |
* > | a <!b> c |
| 19992 |
* ^ |
| 19993 |
* ``` |
| 19994 |
* |
| 19995 |
* @type {State} |
| 19996 |
*/ |
| 19997 |
function declaration(code) { |
| 19998 |
if (code === null || code === 62) return end(code); |
| 19999 |
if (markdownLineEnding(code)) { |
| 20000 |
returnState = declaration; |
| 20001 |
return lineEndingBefore(code); |
| 20002 |
} |
| 20003 |
effects.consume(code); |
| 20004 |
return declaration; |
| 20005 |
} |
| 20006 |
/** |
| 20007 |
* In instruction. |
| 20008 |
* |
| 20009 |
* ```markdown |
| 20010 |
* > | a <?b?> c |
| 20011 |
* ^ |
| 20012 |
* ``` |
| 20013 |
* |
| 20014 |
* @type {State} |
| 20015 |
*/ |
| 20016 |
function instruction(code) { |
| 20017 |
if (code === null) return nok(code); |
| 20018 |
if (code === 63) { |
| 20019 |
effects.consume(code); |
| 20020 |
return instructionClose; |
| 20021 |
} |
| 20022 |
if (markdownLineEnding(code)) { |
| 20023 |
returnState = instruction; |
| 20024 |
return lineEndingBefore(code); |
| 20025 |
} |
| 20026 |
effects.consume(code); |
| 20027 |
return instruction; |
| 20028 |
} |
| 20029 |
/** |
| 20030 |
* In instruction, after `?`, at `>`. |
| 20031 |
* |
| 20032 |
* ```markdown |
| 20033 |
* > | a <?b?> c |
| 20034 |
* ^ |
| 20035 |
* ``` |
| 20036 |
* |
| 20037 |
* @type {State} |
| 20038 |
*/ |
| 20039 |
function instructionClose(code) { |
| 20040 |
return code === 62 ? end(code) : instruction(code); |
| 20041 |
} |
| 20042 |
/** |
| 20043 |
* After `</`, in closing tag, at tag name. |
| 20044 |
* |
| 20045 |
* ```markdown |
| 20046 |
* > | a </b> c |
| 20047 |
* ^ |
| 20048 |
* ``` |
| 20049 |
* |
| 20050 |
* @type {State} |
| 20051 |
*/ |
| 20052 |
function tagCloseStart(code) { |
| 20053 |
if (asciiAlpha(code)) { |
| 20054 |
effects.consume(code); |
| 20055 |
return tagClose; |
| 20056 |
} |
| 20057 |
return nok(code); |
| 20058 |
} |
| 20059 |
/** |
| 20060 |
* After `</x`, in a tag name. |
| 20061 |
* |
| 20062 |
* ```markdown |
| 20063 |
* > | a </b> c |
| 20064 |
* ^ |
| 20065 |
* ``` |
| 20066 |
* |
| 20067 |
* @type {State} |
| 20068 |
*/ |
| 20069 |
function tagClose(code) { |
| 20070 |
if (code === 45 || asciiAlphanumeric(code)) { |
| 20071 |
effects.consume(code); |
| 20072 |
return tagClose; |
| 20073 |
} |
| 20074 |
return tagCloseBetween(code); |
| 20075 |
} |
| 20076 |
/** |
| 20077 |
* In closing tag, after tag name. |
| 20078 |
* |
| 20079 |
* ```markdown |
| 20080 |
* > | a </b> c |
| 20081 |
* ^ |
| 20082 |
* ``` |
| 20083 |
* |
| 20084 |
* @type {State} |
| 20085 |
*/ |
| 20086 |
function tagCloseBetween(code) { |
| 20087 |
if (markdownLineEnding(code)) { |
| 20088 |
returnState = tagCloseBetween; |
| 20089 |
return lineEndingBefore(code); |
| 20090 |
} |
| 20091 |
if (markdownSpace(code)) { |
| 20092 |
effects.consume(code); |
| 20093 |
return tagCloseBetween; |
| 20094 |
} |
| 20095 |
return end(code); |
| 20096 |
} |
| 20097 |
/** |
| 20098 |
* After `<x`, in opening tag name. |
| 20099 |
* |
| 20100 |
* ```markdown |
| 20101 |
* > | a <b> c |
| 20102 |
* ^ |
| 20103 |
* ``` |
| 20104 |
* |
| 20105 |
* @type {State} |
| 20106 |
*/ |
| 20107 |
function tagOpen(code) { |
| 20108 |
if (code === 45 || asciiAlphanumeric(code)) { |
| 20109 |
effects.consume(code); |
| 20110 |
return tagOpen; |
| 20111 |
} |
| 20112 |
if (code === 47 || code === 62 || markdownLineEndingOrSpace(code)) return tagOpenBetween(code); |
| 20113 |
return nok(code); |
| 20114 |
} |
| 20115 |
/** |
| 20116 |
* In opening tag, after tag name. |
| 20117 |
* |
| 20118 |
* ```markdown |
| 20119 |
* > | a <b> c |
| 20120 |
* ^ |
| 20121 |
* ``` |
| 20122 |
* |
| 20123 |
* @type {State} |
| 20124 |
*/ |
| 20125 |
function tagOpenBetween(code) { |
| 20126 |
if (code === 47) { |
| 20127 |
effects.consume(code); |
| 20128 |
return end; |
| 20129 |
} |
| 20130 |
if (code === 58 || code === 95 || asciiAlpha(code)) { |
| 20131 |
effects.consume(code); |
| 20132 |
return tagOpenAttributeName; |
| 20133 |
} |
| 20134 |
if (markdownLineEnding(code)) { |
| 20135 |
returnState = tagOpenBetween; |
| 20136 |
return lineEndingBefore(code); |
| 20137 |
} |
| 20138 |
if (markdownSpace(code)) { |
| 20139 |
effects.consume(code); |
| 20140 |
return tagOpenBetween; |
| 20141 |
} |
| 20142 |
return end(code); |
| 20143 |
} |
| 20144 |
/** |
| 20145 |
* In attribute name. |
| 20146 |
* |
| 20147 |
* ```markdown |
| 20148 |
* > | a <b c> d |
| 20149 |
* ^ |
| 20150 |
* ``` |
| 20151 |
* |
| 20152 |
* @type {State} |
| 20153 |
*/ |
| 20154 |
function tagOpenAttributeName(code) { |
| 20155 |
if (code === 45 || code === 46 || code === 58 || code === 95 || asciiAlphanumeric(code)) { |
| 20156 |
effects.consume(code); |
| 20157 |
return tagOpenAttributeName; |
| 20158 |
} |
| 20159 |
return tagOpenAttributeNameAfter(code); |
| 20160 |
} |
| 20161 |
/** |
| 20162 |
* After attribute name, before initializer, the end of the tag, or |
| 20163 |
* whitespace. |
| 20164 |
* |
| 20165 |
* ```markdown |
| 20166 |
* > | a <b c> d |
| 20167 |
* ^ |
| 20168 |
* ``` |
| 20169 |
* |
| 20170 |
* @type {State} |
| 20171 |
*/ |
| 20172 |
function tagOpenAttributeNameAfter(code) { |
| 20173 |
if (code === 61) { |
| 20174 |
effects.consume(code); |
| 20175 |
return tagOpenAttributeValueBefore; |
| 20176 |
} |
| 20177 |
if (markdownLineEnding(code)) { |
| 20178 |
returnState = tagOpenAttributeNameAfter; |
| 20179 |
return lineEndingBefore(code); |
| 20180 |
} |
| 20181 |
if (markdownSpace(code)) { |
| 20182 |
effects.consume(code); |
| 20183 |
return tagOpenAttributeNameAfter; |
| 20184 |
} |
| 20185 |
return tagOpenBetween(code); |
| 20186 |
} |
| 20187 |
/** |
| 20188 |
* Before unquoted, double quoted, or single quoted attribute value, allowing |
| 20189 |
* whitespace. |
| 20190 |
* |
| 20191 |
* ```markdown |
| 20192 |
* > | a <b c=d> e |
| 20193 |
* ^ |
| 20194 |
* ``` |
| 20195 |
* |
| 20196 |
* @type {State} |
| 20197 |
*/ |
| 20198 |
function tagOpenAttributeValueBefore(code) { |
| 20199 |
if (code === null || code === 60 || code === 61 || code === 62 || code === 96) return nok(code); |
| 20200 |
if (code === 34 || code === 39) { |
| 20201 |
effects.consume(code); |
| 20202 |
marker = code; |
| 20203 |
return tagOpenAttributeValueQuoted; |
| 20204 |
} |
| 20205 |
if (markdownLineEnding(code)) { |
| 20206 |
returnState = tagOpenAttributeValueBefore; |
| 20207 |
return lineEndingBefore(code); |
| 20208 |
} |
| 20209 |
if (markdownSpace(code)) { |
| 20210 |
effects.consume(code); |
| 20211 |
return tagOpenAttributeValueBefore; |
| 20212 |
} |
| 20213 |
effects.consume(code); |
| 20214 |
return tagOpenAttributeValueUnquoted; |
| 20215 |
} |
| 20216 |
/** |
| 20217 |
* In double or single quoted attribute value. |
| 20218 |
* |
| 20219 |
* ```markdown |
| 20220 |
* > | a <b c="d"> e |
| 20221 |
* ^ |
| 20222 |
* ``` |
| 20223 |
* |
| 20224 |
* @type {State} |
| 20225 |
*/ |
| 20226 |
function tagOpenAttributeValueQuoted(code) { |
| 20227 |
if (code === marker) { |
| 20228 |
effects.consume(code); |
| 20229 |
marker = void 0; |
| 20230 |
return tagOpenAttributeValueQuotedAfter; |
| 20231 |
} |
| 20232 |
if (code === null) return nok(code); |
| 20233 |
if (markdownLineEnding(code)) { |
| 20234 |
returnState = tagOpenAttributeValueQuoted; |
| 20235 |
return lineEndingBefore(code); |
| 20236 |
} |
| 20237 |
effects.consume(code); |
| 20238 |
return tagOpenAttributeValueQuoted; |
| 20239 |
} |
| 20240 |
/** |
| 20241 |
* In unquoted attribute value. |
| 20242 |
* |
| 20243 |
* ```markdown |
| 20244 |
* > | a <b c=d> e |
| 20245 |
* ^ |
| 20246 |
* ``` |
| 20247 |
* |
| 20248 |
* @type {State} |
| 20249 |
*/ |
| 20250 |
function tagOpenAttributeValueUnquoted(code) { |
| 20251 |
if (code === null || code === 34 || code === 39 || code === 60 || code === 61 || code === 96) return nok(code); |
| 20252 |
if (code === 47 || code === 62 || markdownLineEndingOrSpace(code)) return tagOpenBetween(code); |
| 20253 |
effects.consume(code); |
| 20254 |
return tagOpenAttributeValueUnquoted; |
| 20255 |
} |
| 20256 |
/** |
| 20257 |
* After double or single quoted attribute value, before whitespace or the end |
| 20258 |
* of the tag. |
| 20259 |
* |
| 20260 |
* ```markdown |
| 20261 |
* > | a <b c="d"> e |
| 20262 |
* ^ |
| 20263 |
* ``` |
| 20264 |
* |
| 20265 |
* @type {State} |
| 20266 |
*/ |
| 20267 |
function tagOpenAttributeValueQuotedAfter(code) { |
| 20268 |
if (code === 47 || code === 62 || markdownLineEndingOrSpace(code)) return tagOpenBetween(code); |
| 20269 |
return nok(code); |
| 20270 |
} |
| 20271 |
/** |
| 20272 |
* In certain circumstances of a tag where only an `>` is allowed. |
| 20273 |
* |
| 20274 |
* ```markdown |
| 20275 |
* > | a <b c="d"> e |
| 20276 |
* ^ |
| 20277 |
* ``` |
| 20278 |
* |
| 20279 |
* @type {State} |
| 20280 |
*/ |
| 20281 |
function end(code) { |
| 20282 |
if (code === 62) { |
| 20283 |
effects.consume(code); |
| 20284 |
effects.exit("htmlTextData"); |
| 20285 |
effects.exit("htmlText"); |
| 20286 |
return ok; |
| 20287 |
} |
| 20288 |
return nok(code); |
| 20289 |
} |
| 20290 |
/** |
| 20291 |
* At eol. |
| 20292 |
* |
| 20293 |
* > 👉 **Note**: we can’t have blank lines in text, so no need to worry about |
| 20294 |
* > empty tokens. |
| 20295 |
* |
| 20296 |
* ```markdown |
| 20297 |
* > | a <!--a |
| 20298 |
* ^ |
| 20299 |
* | b--> |
| 20300 |
* ``` |
| 20301 |
* |
| 20302 |
* @type {State} |
| 20303 |
*/ |
| 20304 |
function lineEndingBefore(code) { |
| 20305 |
effects.exit("htmlTextData"); |
| 20306 |
effects.enter("lineEnding"); |
| 20307 |
effects.consume(code); |
| 20308 |
effects.exit("lineEnding"); |
| 20309 |
return lineEndingAfter; |
| 20310 |
} |
| 20311 |
/** |
| 20312 |
* After eol, at optional whitespace. |
| 20313 |
* |
| 20314 |
* > 👉 **Note**: we can’t have blank lines in text, so no need to worry about |
| 20315 |
* > empty tokens. |
| 20316 |
* |
| 20317 |
* ```markdown |
| 20318 |
* | a <!--a |
| 20319 |
* > | b--> |
| 20320 |
* ^ |
| 20321 |
* ``` |
| 20322 |
* |
| 20323 |
* @type {State} |
| 20324 |
*/ |
| 20325 |
function lineEndingAfter(code) { |
| 20326 |
return markdownSpace(code) ? factorySpace(effects, lineEndingAfterPrefix, "linePrefix", self.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4)(code) : lineEndingAfterPrefix(code); |
| 20327 |
} |
| 20328 |
/** |
| 20329 |
* After eol, after optional whitespace. |
| 20330 |
* |
| 20331 |
* > 👉 **Note**: we can’t have blank lines in text, so no need to worry about |
| 20332 |
* > empty tokens. |
| 20333 |
* |
| 20334 |
* ```markdown |
| 20335 |
* | a <!--a |
| 20336 |
* > | b--> |
| 20337 |
* ^ |
| 20338 |
* ``` |
| 20339 |
* |
| 20340 |
* @type {State} |
| 20341 |
*/ |
| 20342 |
function lineEndingAfterPrefix(code) { |
| 20343 |
effects.enter("htmlTextData"); |
| 20344 |
return returnState(code); |
| 20345 |
} |
| 20346 |
} |
| 20347 |
var htmlText; |
| 20348 |
var init_html_text = __esmMin((() => { |
| 20349 |
init_micromark_factory_space(); |
| 20350 |
init_micromark_util_character(); |
| 20351 |
htmlText = { |
| 20352 |
name: "htmlText", |
| 20353 |
tokenize: tokenizeHtmlText |
| 20354 |
}; |
| 20355 |
})); |
| 20356 |
|
| 20357 |
//#endregion |
| 20358 |
//#region node_modules/micromark-core-commonmark/lib/label-end.js |
| 20359 |
/** @type {Resolver} */ |
| 20360 |
function resolveAllLabelEnd(events) { |
| 20361 |
let index = -1; |
| 20362 |
while (++index < events.length) { |
| 20363 |
const token = events[index][1]; |
| 20364 |
if (token.type === "labelImage" || token.type === "labelLink" || token.type === "labelEnd") { |
| 20365 |
events.splice(index + 1, token.type === "labelImage" ? 4 : 2); |
| 20366 |
token.type = "data"; |
| 20367 |
index++; |
| 20368 |
} |
| 20369 |
} |
| 20370 |
return events; |
| 20371 |
} |
| 20372 |
/** @type {Resolver} */ |
| 20373 |
function resolveToLabelEnd(events, context) { |
| 20374 |
let index = events.length; |
| 20375 |
let offset = 0; |
| 20376 |
/** @type {Token} */ |
| 20377 |
let token; |
| 20378 |
/** @type {number | undefined} */ |
| 20379 |
let open; |
| 20380 |
/** @type {number | undefined} */ |
| 20381 |
let close; |
| 20382 |
/** @type {Array<Event>} */ |
| 20383 |
let media; |
| 20384 |
while (index--) { |
| 20385 |
token = events[index][1]; |
| 20386 |
if (open) { |
| 20387 |
if (token.type === "link" || token.type === "labelLink" && token._inactive) break; |
| 20388 |
if (events[index][0] === "enter" && token.type === "labelLink") token._inactive = true; |
| 20389 |
} else if (close) { |
| 20390 |
if (events[index][0] === "enter" && (token.type === "labelImage" || token.type === "labelLink") && !token._balanced) { |
| 20391 |
open = index; |
| 20392 |
if (token.type !== "labelLink") { |
| 20393 |
offset = 2; |
| 20394 |
break; |
| 20395 |
} |
| 20396 |
} |
| 20397 |
} else if (token.type === "labelEnd") close = index; |
| 20398 |
} |
| 20399 |
const group = { |
| 20400 |
type: events[open][1].type === "labelLink" ? "link" : "image", |
| 20401 |
start: Object.assign({}, events[open][1].start), |
| 20402 |
end: Object.assign({}, events[events.length - 1][1].end) |
| 20403 |
}; |
| 20404 |
const label = { |
| 20405 |
type: "label", |
| 20406 |
start: Object.assign({}, events[open][1].start), |
| 20407 |
end: Object.assign({}, events[close][1].end) |
| 20408 |
}; |
| 20409 |
const text = { |
| 20410 |
type: "labelText", |
| 20411 |
start: Object.assign({}, events[open + offset + 2][1].end), |
| 20412 |
end: Object.assign({}, events[close - 2][1].start) |
| 20413 |
}; |
| 20414 |
media = [[ |
| 20415 |
"enter", |
| 20416 |
group, |
| 20417 |
context |
| 20418 |
], [ |
| 20419 |
"enter", |
| 20420 |
label, |
| 20421 |
context |
| 20422 |
]]; |
| 20423 |
media = push(media, events.slice(open + 1, open + offset + 3)); |
| 20424 |
media = push(media, [[ |
| 20425 |
"enter", |
| 20426 |
text, |
| 20427 |
context |
| 20428 |
]]); |
| 20429 |
media = push(media, resolveAll(context.parser.constructs.insideSpan.null, events.slice(open + offset + 4, close - 3), context)); |
| 20430 |
media = push(media, [ |
| 20431 |
[ |
| 20432 |
"exit", |
| 20433 |
text, |
| 20434 |
context |
| 20435 |
], |
| 20436 |
events[close - 2], |
| 20437 |
events[close - 1], |
| 20438 |
[ |
| 20439 |
"exit", |
| 20440 |
label, |
| 20441 |
context |
| 20442 |
] |
| 20443 |
]); |
| 20444 |
media = push(media, events.slice(close + 1)); |
| 20445 |
media = push(media, [[ |
| 20446 |
"exit", |
| 20447 |
group, |
| 20448 |
context |
| 20449 |
]]); |
| 20450 |
splice(events, open, events.length, media); |
| 20451 |
return events; |
| 20452 |
} |
| 20453 |
/** |
| 20454 |
* @this {TokenizeContext} |
| 20455 |
* @type {Tokenizer} |
| 20456 |
*/ |
| 20457 |
function tokenizeLabelEnd(effects, ok, nok) { |
| 20458 |
const self = this; |
| 20459 |
let index = self.events.length; |
| 20460 |
/** @type {Token} */ |
| 20461 |
let labelStart; |
| 20462 |
/** @type {boolean} */ |
| 20463 |
let defined; |
| 20464 |
while (index--) if ((self.events[index][1].type === "labelImage" || self.events[index][1].type === "labelLink") && !self.events[index][1]._balanced) { |
| 20465 |
labelStart = self.events[index][1]; |
| 20466 |
break; |
| 20467 |
} |
| 20468 |
return start; |
| 20469 |
/** |
| 20470 |
* Start of label end. |
| 20471 |
* |
| 20472 |
* ```markdown |
| 20473 |
* > | [a](b) c |
| 20474 |
* ^ |
| 20475 |
* > | [a][b] c |
| 20476 |
* ^ |
| 20477 |
* > | [a][] b |
| 20478 |
* ^ |
| 20479 |
* > | [a] b |
| 20480 |
* ``` |
| 20481 |
* |
| 20482 |
* @type {State} |
| 20483 |
*/ |
| 20484 |
function start(code) { |
| 20485 |
if (!labelStart) return nok(code); |
| 20486 |
if (labelStart._inactive) return labelEndNok(code); |
| 20487 |
defined = self.parser.defined.includes(normalizeIdentifier(self.sliceSerialize({ |
| 20488 |
start: labelStart.end, |
| 20489 |
end: self.now() |
| 20490 |
}))); |
| 20491 |
effects.enter("labelEnd"); |
| 20492 |
effects.enter("labelMarker"); |
| 20493 |
effects.consume(code); |
| 20494 |
effects.exit("labelMarker"); |
| 20495 |
effects.exit("labelEnd"); |
| 20496 |
return after; |
| 20497 |
} |
| 20498 |
/** |
| 20499 |
* After `]`. |
| 20500 |
* |
| 20501 |
* ```markdown |
| 20502 |
* > | [a](b) c |
| 20503 |
* ^ |
| 20504 |
* > | [a][b] c |
| 20505 |
* ^ |
| 20506 |
* > | [a][] b |
| 20507 |
* ^ |
| 20508 |
* > | [a] b |
| 20509 |
* ^ |
| 20510 |
* ``` |
| 20511 |
* |
| 20512 |
* @type {State} |
| 20513 |
*/ |
| 20514 |
function after(code) { |
| 20515 |
if (code === 40) return effects.attempt(resourceConstruct, labelEndOk, defined ? labelEndOk : labelEndNok)(code); |
| 20516 |
if (code === 91) return effects.attempt(referenceFullConstruct, labelEndOk, defined ? referenceNotFull : labelEndNok)(code); |
| 20517 |
return defined ? labelEndOk(code) : labelEndNok(code); |
| 20518 |
} |
| 20519 |
/** |
| 20520 |
* After `]`, at `[`, but not at a full reference. |
| 20521 |
* |
| 20522 |
* > 👉 **Note**: we only get here if the label is defined. |
| 20523 |
* |
| 20524 |
* ```markdown |
| 20525 |
* > | [a][] b |
| 20526 |
* ^ |
| 20527 |
* > | [a] b |
| 20528 |
* ^ |
| 20529 |
* ``` |
| 20530 |
* |
| 20531 |
* @type {State} |
| 20532 |
*/ |
| 20533 |
function referenceNotFull(code) { |
| 20534 |
return effects.attempt(referenceCollapsedConstruct, labelEndOk, labelEndNok)(code); |
| 20535 |
} |
| 20536 |
/** |
| 20537 |
* Done, we found something. |
| 20538 |
* |
| 20539 |
* ```markdown |
| 20540 |
* > | [a](b) c |
| 20541 |
* ^ |
| 20542 |
* > | [a][b] c |
| 20543 |
* ^ |
| 20544 |
* > | [a][] b |
| 20545 |
* ^ |
| 20546 |
* > | [a] b |
| 20547 |
* ^ |
| 20548 |
* ``` |
| 20549 |
* |
| 20550 |
* @type {State} |
| 20551 |
*/ |
| 20552 |
function labelEndOk(code) { |
| 20553 |
return ok(code); |
| 20554 |
} |
| 20555 |
/** |
| 20556 |
* Done, it’s nothing. |
| 20557 |
* |
| 20558 |
* There was an okay opening, but we didn’t match anything. |
| 20559 |
* |
| 20560 |
* ```markdown |
| 20561 |
* > | [a](b c |
| 20562 |
* ^ |
| 20563 |
* > | [a][b c |
| 20564 |
* ^ |
| 20565 |
* > | [a] b |
| 20566 |
* ^ |
| 20567 |
* ``` |
| 20568 |
* |
| 20569 |
* @type {State} |
| 20570 |
*/ |
| 20571 |
function labelEndNok(code) { |
| 20572 |
labelStart._balanced = true; |
| 20573 |
return nok(code); |
| 20574 |
} |
| 20575 |
} |
| 20576 |
/** |
| 20577 |
* @this {TokenizeContext} |
| 20578 |
* @type {Tokenizer} |
| 20579 |
*/ |
| 20580 |
function tokenizeResource(effects, ok, nok) { |
| 20581 |
return resourceStart; |
| 20582 |
/** |
| 20583 |
* At a resource. |
| 20584 |
* |
| 20585 |
* ```markdown |
| 20586 |
* > | [a](b) c |
| 20587 |
* ^ |
| 20588 |
* ``` |
| 20589 |
* |
| 20590 |
* @type {State} |
| 20591 |
*/ |
| 20592 |
function resourceStart(code) { |
| 20593 |
effects.enter("resource"); |
| 20594 |
effects.enter("resourceMarker"); |
| 20595 |
effects.consume(code); |
| 20596 |
effects.exit("resourceMarker"); |
| 20597 |
return resourceBefore; |
| 20598 |
} |
| 20599 |
/** |
| 20600 |
* In resource, after `(`, at optional whitespace. |
| 20601 |
* |
| 20602 |
* ```markdown |
| 20603 |
* > | [a](b) c |
| 20604 |
* ^ |
| 20605 |
* ``` |
| 20606 |
* |
| 20607 |
* @type {State} |
| 20608 |
*/ |
| 20609 |
function resourceBefore(code) { |
| 20610 |
return markdownLineEndingOrSpace(code) ? factoryWhitespace(effects, resourceOpen)(code) : resourceOpen(code); |
| 20611 |
} |
| 20612 |
/** |
| 20613 |
* In resource, after optional whitespace, at `)` or a destination. |
| 20614 |
* |
| 20615 |
* ```markdown |
| 20616 |
* > | [a](b) c |
| 20617 |
* ^ |
| 20618 |
* ``` |
| 20619 |
* |
| 20620 |
* @type {State} |
| 20621 |
*/ |
| 20622 |
function resourceOpen(code) { |
| 20623 |
if (code === 41) return resourceEnd(code); |
| 20624 |
return factoryDestination(effects, resourceDestinationAfter, resourceDestinationMissing, "resourceDestination", "resourceDestinationLiteral", "resourceDestinationLiteralMarker", "resourceDestinationRaw", "resourceDestinationString", 32)(code); |
| 20625 |
} |
| 20626 |
/** |
| 20627 |
* In resource, after destination, at optional whitespace. |
| 20628 |
* |
| 20629 |
* ```markdown |
| 20630 |
* > | [a](b) c |
| 20631 |
* ^ |
| 20632 |
* ``` |
| 20633 |
* |
| 20634 |
* @type {State} |
| 20635 |
*/ |
| 20636 |
function resourceDestinationAfter(code) { |
| 20637 |
return markdownLineEndingOrSpace(code) ? factoryWhitespace(effects, resourceBetween)(code) : resourceEnd(code); |
| 20638 |
} |
| 20639 |
/** |
| 20640 |
* At invalid destination. |
| 20641 |
* |
| 20642 |
* ```markdown |
| 20643 |
* > | [a](<<) b |
| 20644 |
* ^ |
| 20645 |
* ``` |
| 20646 |
* |
| 20647 |
* @type {State} |
| 20648 |
*/ |
| 20649 |
function resourceDestinationMissing(code) { |
| 20650 |
return nok(code); |
| 20651 |
} |
| 20652 |
/** |
| 20653 |
* In resource, after destination and whitespace, at `(` or title. |
| 20654 |
* |
| 20655 |
* ```markdown |
| 20656 |
* > | [a](b ) c |
| 20657 |
* ^ |
| 20658 |
* ``` |
| 20659 |
* |
| 20660 |
* @type {State} |
| 20661 |
*/ |
| 20662 |
function resourceBetween(code) { |
| 20663 |
if (code === 34 || code === 39 || code === 40) return factoryTitle(effects, resourceTitleAfter, nok, "resourceTitle", "resourceTitleMarker", "resourceTitleString")(code); |
| 20664 |
return resourceEnd(code); |
| 20665 |
} |
| 20666 |
/** |
| 20667 |
* In resource, after title, at optional whitespace. |
| 20668 |
* |
| 20669 |
* ```markdown |
| 20670 |
* > | [a](b "c") d |
| 20671 |
* ^ |
| 20672 |
* ``` |
| 20673 |
* |
| 20674 |
* @type {State} |
| 20675 |
*/ |
| 20676 |
function resourceTitleAfter(code) { |
| 20677 |
return markdownLineEndingOrSpace(code) ? factoryWhitespace(effects, resourceEnd)(code) : resourceEnd(code); |
| 20678 |
} |
| 20679 |
/** |
| 20680 |
* In resource, at `)`. |
| 20681 |
* |
| 20682 |
* ```markdown |
| 20683 |
* > | [a](b) d |
| 20684 |
* ^ |
| 20685 |
* ``` |
| 20686 |
* |
| 20687 |
* @type {State} |
| 20688 |
*/ |
| 20689 |
function resourceEnd(code) { |
| 20690 |
if (code === 41) { |
| 20691 |
effects.enter("resourceMarker"); |
| 20692 |
effects.consume(code); |
| 20693 |
effects.exit("resourceMarker"); |
| 20694 |
effects.exit("resource"); |
| 20695 |
return ok; |
| 20696 |
} |
| 20697 |
return nok(code); |
| 20698 |
} |
| 20699 |
} |
| 20700 |
/** |
| 20701 |
* @this {TokenizeContext} |
| 20702 |
* @type {Tokenizer} |
| 20703 |
*/ |
| 20704 |
function tokenizeReferenceFull(effects, ok, nok) { |
| 20705 |
const self = this; |
| 20706 |
return referenceFull; |
| 20707 |
/** |
| 20708 |
* In a reference (full), at the `[`. |
| 20709 |
* |
| 20710 |
* ```markdown |
| 20711 |
* > | [a][b] d |
| 20712 |
* ^ |
| 20713 |
* ``` |
| 20714 |
* |
| 20715 |
* @type {State} |
| 20716 |
*/ |
| 20717 |
function referenceFull(code) { |
| 20718 |
return factoryLabel.call(self, effects, referenceFullAfter, referenceFullMissing, "reference", "referenceMarker", "referenceString")(code); |
| 20719 |
} |
| 20720 |
/** |
| 20721 |
* In a reference (full), after `]`. |
| 20722 |
* |
| 20723 |
* ```markdown |
| 20724 |
* > | [a][b] d |
| 20725 |
* ^ |
| 20726 |
* ``` |
| 20727 |
* |
| 20728 |
* @type {State} |
| 20729 |
*/ |
| 20730 |
function referenceFullAfter(code) { |
| 20731 |
return self.parser.defined.includes(normalizeIdentifier(self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1))) ? ok(code) : nok(code); |
| 20732 |
} |
| 20733 |
/** |
| 20734 |
* In reference (full) that was missing. |
| 20735 |
* |
| 20736 |
* ```markdown |
| 20737 |
* > | [a][b d |
| 20738 |
* ^ |
| 20739 |
* ``` |
| 20740 |
* |
| 20741 |
* @type {State} |
| 20742 |
*/ |
| 20743 |
function referenceFullMissing(code) { |
| 20744 |
return nok(code); |
| 20745 |
} |
| 20746 |
} |
| 20747 |
/** |
| 20748 |
* @this {TokenizeContext} |
| 20749 |
* @type {Tokenizer} |
| 20750 |
*/ |
| 20751 |
function tokenizeReferenceCollapsed(effects, ok, nok) { |
| 20752 |
return referenceCollapsedStart; |
| 20753 |
/** |
| 20754 |
* In reference (collapsed), at `[`. |
| 20755 |
* |
| 20756 |
* > 👉 **Note**: we only get here if the label is defined. |
| 20757 |
* |
| 20758 |
* ```markdown |
| 20759 |
* > | [a][] d |
| 20760 |
* ^ |
| 20761 |
* ``` |
| 20762 |
* |
| 20763 |
* @type {State} |
| 20764 |
*/ |
| 20765 |
function referenceCollapsedStart(code) { |
| 20766 |
effects.enter("reference"); |
| 20767 |
effects.enter("referenceMarker"); |
| 20768 |
effects.consume(code); |
| 20769 |
effects.exit("referenceMarker"); |
| 20770 |
return referenceCollapsedOpen; |
| 20771 |
} |
| 20772 |
/** |
| 20773 |
* In reference (collapsed), at `]`. |
| 20774 |
* |
| 20775 |
* > 👉 **Note**: we only get here if the label is defined. |
| 20776 |
* |
| 20777 |
* ```markdown |
| 20778 |
* > | [a][] d |
| 20779 |
* ^ |
| 20780 |
* ``` |
| 20781 |
* |
| 20782 |
* @type {State} |
| 20783 |
*/ |
| 20784 |
function referenceCollapsedOpen(code) { |
| 20785 |
if (code === 93) { |
| 20786 |
effects.enter("referenceMarker"); |
| 20787 |
effects.consume(code); |
| 20788 |
effects.exit("referenceMarker"); |
| 20789 |
effects.exit("reference"); |
| 20790 |
return ok; |
| 20791 |
} |
| 20792 |
return nok(code); |
| 20793 |
} |
| 20794 |
} |
| 20795 |
var labelEnd, resourceConstruct, referenceFullConstruct, referenceCollapsedConstruct; |
| 20796 |
var init_label_end = __esmMin((() => { |
| 20797 |
init_micromark_factory_destination(); |
| 20798 |
init_micromark_factory_label(); |
| 20799 |
init_micromark_factory_title(); |
| 20800 |
init_micromark_factory_whitespace(); |
| 20801 |
init_micromark_util_character(); |
| 20802 |
init_micromark_util_chunked(); |
| 20803 |
init_micromark_util_normalize_identifier(); |
| 20804 |
init_micromark_util_resolve_all(); |
| 20805 |
labelEnd = { |
| 20806 |
name: "labelEnd", |
| 20807 |
tokenize: tokenizeLabelEnd, |
| 20808 |
resolveTo: resolveToLabelEnd, |
| 20809 |
resolveAll: resolveAllLabelEnd |
| 20810 |
}; |
| 20811 |
resourceConstruct = { tokenize: tokenizeResource }; |
| 20812 |
referenceFullConstruct = { tokenize: tokenizeReferenceFull }; |
| 20813 |
referenceCollapsedConstruct = { tokenize: tokenizeReferenceCollapsed }; |
| 20814 |
})); |
| 20815 |
|
| 20816 |
//#endregion |
| 20817 |
//#region node_modules/micromark-core-commonmark/lib/label-start-image.js |
| 20818 |
/** |
| 20819 |
* @this {TokenizeContext} |
| 20820 |
* @type {Tokenizer} |
| 20821 |
*/ |
| 20822 |
function tokenizeLabelStartImage(effects, ok, nok) { |
| 20823 |
const self = this; |
| 20824 |
return start; |
| 20825 |
/** |
| 20826 |
* Start of label (image) start. |
| 20827 |
* |
| 20828 |
* ```markdown |
| 20829 |
* > | a ![b] c |
| 20830 |
* ^ |
| 20831 |
* ``` |
| 20832 |
* |
| 20833 |
* @type {State} |
| 20834 |
*/ |
| 20835 |
function start(code) { |
| 20836 |
effects.enter("labelImage"); |
| 20837 |
effects.enter("labelImageMarker"); |
| 20838 |
effects.consume(code); |
| 20839 |
effects.exit("labelImageMarker"); |
| 20840 |
return open; |
| 20841 |
} |
| 20842 |
/** |
| 20843 |
* After `!`, at `[`. |
| 20844 |
* |
| 20845 |
* ```markdown |
| 20846 |
* > | a ![b] c |
| 20847 |
* ^ |
| 20848 |
* ``` |
| 20849 |
* |
| 20850 |
* @type {State} |
| 20851 |
*/ |
| 20852 |
function open(code) { |
| 20853 |
if (code === 91) { |
| 20854 |
effects.enter("labelMarker"); |
| 20855 |
effects.consume(code); |
| 20856 |
effects.exit("labelMarker"); |
| 20857 |
effects.exit("labelImage"); |
| 20858 |
return after; |
| 20859 |
} |
| 20860 |
return nok(code); |
| 20861 |
} |
| 20862 |
/** |
| 20863 |
* After `![`. |
| 20864 |
* |
| 20865 |
* ```markdown |
| 20866 |
* > | a ![b] c |
| 20867 |
* ^ |
| 20868 |
* ``` |
| 20869 |
* |
| 20870 |
* This is needed in because, when GFM footnotes are enabled, images never |
| 20871 |
* form when started with a `^`. |
| 20872 |
* Instead, links form: |
| 20873 |
* |
| 20874 |
* ```markdown |
| 20875 |
*  |
| 20876 |
* |
| 20877 |
* ![^a][b] |
| 20878 |
* |
| 20879 |
* [b]: c |
| 20880 |
* ``` |
| 20881 |
* |
| 20882 |
* ```html |
| 20883 |
* <p>!<a href=\"b\">^a</a></p> |
| 20884 |
* <p>!<a href=\"c\">^a</a></p> |
| 20885 |
* ``` |
| 20886 |
* |
| 20887 |
* @type {State} |
| 20888 |
*/ |
| 20889 |
function after(code) { |
| 20890 |
/* c8 ignore next 3 */ |
| 20891 |
return code === 94 && "_hiddenFootnoteSupport" in self.parser.constructs ? nok(code) : ok(code); |
| 20892 |
} |
| 20893 |
} |
| 20894 |
var labelStartImage; |
| 20895 |
var init_label_start_image = __esmMin((() => { |
| 20896 |
init_label_end(); |
| 20897 |
labelStartImage = { |
| 20898 |
name: "labelStartImage", |
| 20899 |
tokenize: tokenizeLabelStartImage, |
| 20900 |
resolveAll: labelEnd.resolveAll |
| 20901 |
}; |
| 20902 |
})); |
| 20903 |
|
| 20904 |
//#endregion |
| 20905 |
//#region node_modules/micromark-core-commonmark/lib/label-start-link.js |
| 20906 |
/** |
| 20907 |
* @this {TokenizeContext} |
| 20908 |
* @type {Tokenizer} |
| 20909 |
*/ |
| 20910 |
function tokenizeLabelStartLink(effects, ok, nok) { |
| 20911 |
const self = this; |
| 20912 |
return start; |
| 20913 |
/** |
| 20914 |
* Start of label (link) start. |
| 20915 |
* |
| 20916 |
* ```markdown |
| 20917 |
* > | a [b] c |
| 20918 |
* ^ |
| 20919 |
* ``` |
| 20920 |
* |
| 20921 |
* @type {State} |
| 20922 |
*/ |
| 20923 |
function start(code) { |
| 20924 |
effects.enter("labelLink"); |
| 20925 |
effects.enter("labelMarker"); |
| 20926 |
effects.consume(code); |
| 20927 |
effects.exit("labelMarker"); |
| 20928 |
effects.exit("labelLink"); |
| 20929 |
return after; |
| 20930 |
} |
| 20931 |
/** @type {State} */ |
| 20932 |
function after(code) { |
| 20933 |
/* c8 ignore next 3 */ |
| 20934 |
return code === 94 && "_hiddenFootnoteSupport" in self.parser.constructs ? nok(code) : ok(code); |
| 20935 |
} |
| 20936 |
} |
| 20937 |
var labelStartLink; |
| 20938 |
var init_label_start_link = __esmMin((() => { |
| 20939 |
init_label_end(); |
| 20940 |
labelStartLink = { |
| 20941 |
name: "labelStartLink", |
| 20942 |
tokenize: tokenizeLabelStartLink, |
| 20943 |
resolveAll: labelEnd.resolveAll |
| 20944 |
}; |
| 20945 |
})); |
| 20946 |
|
| 20947 |
//#endregion |
| 20948 |
//#region node_modules/micromark-core-commonmark/lib/line-ending.js |
| 20949 |
/** |
| 20950 |
* @this {TokenizeContext} |
| 20951 |
* @type {Tokenizer} |
| 20952 |
*/ |
| 20953 |
function tokenizeLineEnding(effects, ok) { |
| 20954 |
return start; |
| 20955 |
/** @type {State} */ |
| 20956 |
function start(code) { |
| 20957 |
effects.enter("lineEnding"); |
| 20958 |
effects.consume(code); |
| 20959 |
effects.exit("lineEnding"); |
| 20960 |
return factorySpace(effects, ok, "linePrefix"); |
| 20961 |
} |
| 20962 |
} |
| 20963 |
var lineEnding; |
| 20964 |
var init_line_ending = __esmMin((() => { |
| 20965 |
init_micromark_factory_space(); |
| 20966 |
lineEnding = { |
| 20967 |
name: "lineEnding", |
| 20968 |
tokenize: tokenizeLineEnding |
| 20969 |
}; |
| 20970 |
})); |
| 20971 |
|
| 20972 |
//#endregion |
| 20973 |
//#region node_modules/micromark-core-commonmark/lib/thematic-break.js |
| 20974 |
/** |
| 20975 |
* @this {TokenizeContext} |
| 20976 |
* @type {Tokenizer} |
| 20977 |
*/ |
| 20978 |
function tokenizeThematicBreak(effects, ok, nok) { |
| 20979 |
let size = 0; |
| 20980 |
/** @type {NonNullable<Code>} */ |
| 20981 |
let marker; |
| 20982 |
return start; |
| 20983 |
/** |
| 20984 |
* Start of thematic break. |
| 20985 |
* |
| 20986 |
* ```markdown |
| 20987 |
* > | *** |
| 20988 |
* ^ |
| 20989 |
* ``` |
| 20990 |
* |
| 20991 |
* @type {State} |
| 20992 |
*/ |
| 20993 |
function start(code) { |
| 20994 |
effects.enter("thematicBreak"); |
| 20995 |
return before(code); |
| 20996 |
} |
| 20997 |
/** |
| 20998 |
* After optional whitespace, at marker. |
| 20999 |
* |
| 21000 |
* ```markdown |
| 21001 |
* > | *** |
| 21002 |
* ^ |
| 21003 |
* ``` |
| 21004 |
* |
| 21005 |
* @type {State} |
| 21006 |
*/ |
| 21007 |
function before(code) { |
| 21008 |
marker = code; |
| 21009 |
return atBreak(code); |
| 21010 |
} |
| 21011 |
/** |
| 21012 |
* After something, before something else. |
| 21013 |
* |
| 21014 |
* ```markdown |
| 21015 |
* > | *** |
| 21016 |
* ^ |
| 21017 |
* ``` |
| 21018 |
* |
| 21019 |
* @type {State} |
| 21020 |
*/ |
| 21021 |
function atBreak(code) { |
| 21022 |
if (code === marker) { |
| 21023 |
effects.enter("thematicBreakSequence"); |
| 21024 |
return sequence(code); |
| 21025 |
} |
| 21026 |
if (size >= 3 && (code === null || markdownLineEnding(code))) { |
| 21027 |
effects.exit("thematicBreak"); |
| 21028 |
return ok(code); |
| 21029 |
} |
| 21030 |
return nok(code); |
| 21031 |
} |
| 21032 |
/** |
| 21033 |
* In sequence. |
| 21034 |
* |
| 21035 |
* ```markdown |
| 21036 |
* > | *** |
| 21037 |
* ^ |
| 21038 |
* ``` |
| 21039 |
* |
| 21040 |
* @type {State} |
| 21041 |
*/ |
| 21042 |
function sequence(code) { |
| 21043 |
if (code === marker) { |
| 21044 |
effects.consume(code); |
| 21045 |
size++; |
| 21046 |
return sequence; |
| 21047 |
} |
| 21048 |
effects.exit("thematicBreakSequence"); |
| 21049 |
return markdownSpace(code) ? factorySpace(effects, atBreak, "whitespace")(code) : atBreak(code); |
| 21050 |
} |
| 21051 |
} |
| 21052 |
var thematicBreak$1; |
| 21053 |
var init_thematic_break$1 = __esmMin((() => { |
| 21054 |
init_micromark_factory_space(); |
| 21055 |
init_micromark_util_character(); |
| 21056 |
thematicBreak$1 = { |
| 21057 |
name: "thematicBreak", |
| 21058 |
tokenize: tokenizeThematicBreak |
| 21059 |
}; |
| 21060 |
})); |
| 21061 |
|
| 21062 |
//#endregion |
| 21063 |
//#region node_modules/micromark-core-commonmark/lib/list.js |
| 21064 |
/** |
| 21065 |
* @type {Tokenizer} |
| 21066 |
* @this {TokenizeContext} |
| 21067 |
*/ |
| 21068 |
function tokenizeListStart(effects, ok, nok) { |
| 21069 |
const self = this; |
| 21070 |
const tail = self.events[self.events.length - 1]; |
| 21071 |
let initialSize = tail && tail[1].type === "linePrefix" ? tail[2].sliceSerialize(tail[1], true).length : 0; |
| 21072 |
let size = 0; |
| 21073 |
return start; |
| 21074 |
/** @type {State} */ |
| 21075 |
function start(code) { |
| 21076 |
const kind = self.containerState.type || (code === 42 || code === 43 || code === 45 ? "listUnordered" : "listOrdered"); |
| 21077 |
if (kind === "listUnordered" ? !self.containerState.marker || code === self.containerState.marker : asciiDigit(code)) { |
| 21078 |
if (!self.containerState.type) { |
| 21079 |
self.containerState.type = kind; |
| 21080 |
effects.enter(kind, { _container: true }); |
| 21081 |
} |
| 21082 |
if (kind === "listUnordered") { |
| 21083 |
effects.enter("listItemPrefix"); |
| 21084 |
return code === 42 || code === 45 ? effects.check(thematicBreak$1, nok, atMarker)(code) : atMarker(code); |
| 21085 |
} |
| 21086 |
if (!self.interrupt || code === 49) { |
| 21087 |
effects.enter("listItemPrefix"); |
| 21088 |
effects.enter("listItemValue"); |
| 21089 |
return inside(code); |
| 21090 |
} |
| 21091 |
} |
| 21092 |
return nok(code); |
| 21093 |
} |
| 21094 |
/** @type {State} */ |
| 21095 |
function inside(code) { |
| 21096 |
if (asciiDigit(code) && ++size < 10) { |
| 21097 |
effects.consume(code); |
| 21098 |
return inside; |
| 21099 |
} |
| 21100 |
if ((!self.interrupt || size < 2) && (self.containerState.marker ? code === self.containerState.marker : code === 41 || code === 46)) { |
| 21101 |
effects.exit("listItemValue"); |
| 21102 |
return atMarker(code); |
| 21103 |
} |
| 21104 |
return nok(code); |
| 21105 |
} |
| 21106 |
/** |
| 21107 |
* @type {State} |
| 21108 |
**/ |
| 21109 |
function atMarker(code) { |
| 21110 |
effects.enter("listItemMarker"); |
| 21111 |
effects.consume(code); |
| 21112 |
effects.exit("listItemMarker"); |
| 21113 |
self.containerState.marker = self.containerState.marker || code; |
| 21114 |
return effects.check(blankLine, self.interrupt ? nok : onBlank, effects.attempt(listItemPrefixWhitespaceConstruct, endOfPrefix, otherPrefix)); |
| 21115 |
} |
| 21116 |
/** @type {State} */ |
| 21117 |
function onBlank(code) { |
| 21118 |
self.containerState.initialBlankLine = true; |
| 21119 |
initialSize++; |
| 21120 |
return endOfPrefix(code); |
| 21121 |
} |
| 21122 |
/** @type {State} */ |
| 21123 |
function otherPrefix(code) { |
| 21124 |
if (markdownSpace(code)) { |
| 21125 |
effects.enter("listItemPrefixWhitespace"); |
| 21126 |
effects.consume(code); |
| 21127 |
effects.exit("listItemPrefixWhitespace"); |
| 21128 |
return endOfPrefix; |
| 21129 |
} |
| 21130 |
return nok(code); |
| 21131 |
} |
| 21132 |
/** @type {State} */ |
| 21133 |
function endOfPrefix(code) { |
| 21134 |
self.containerState.size = initialSize + self.sliceSerialize(effects.exit("listItemPrefix"), true).length; |
| 21135 |
return ok(code); |
| 21136 |
} |
| 21137 |
} |
| 21138 |
/** |
| 21139 |
* @type {Tokenizer} |
| 21140 |
* @this {TokenizeContext} |
| 21141 |
*/ |
| 21142 |
function tokenizeListContinuation(effects, ok, nok) { |
| 21143 |
const self = this; |
| 21144 |
self.containerState._closeFlow = void 0; |
| 21145 |
return effects.check(blankLine, onBlank, notBlank); |
| 21146 |
/** @type {State} */ |
| 21147 |
function onBlank(code) { |
| 21148 |
self.containerState.furtherBlankLines = self.containerState.furtherBlankLines || self.containerState.initialBlankLine; |
| 21149 |
return factorySpace(effects, ok, "listItemIndent", self.containerState.size + 1)(code); |
| 21150 |
} |
| 21151 |
/** @type {State} */ |
| 21152 |
function notBlank(code) { |
| 21153 |
if (self.containerState.furtherBlankLines || !markdownSpace(code)) { |
| 21154 |
self.containerState.furtherBlankLines = void 0; |
| 21155 |
self.containerState.initialBlankLine = void 0; |
| 21156 |
return notInCurrentItem(code); |
| 21157 |
} |
| 21158 |
self.containerState.furtherBlankLines = void 0; |
| 21159 |
self.containerState.initialBlankLine = void 0; |
| 21160 |
return effects.attempt(indentConstruct, ok, notInCurrentItem)(code); |
| 21161 |
} |
| 21162 |
/** @type {State} */ |
| 21163 |
function notInCurrentItem(code) { |
| 21164 |
self.containerState._closeFlow = true; |
| 21165 |
self.interrupt = void 0; |
| 21166 |
return factorySpace(effects, effects.attempt(list$1, ok, nok), "linePrefix", self.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4)(code); |
| 21167 |
} |
| 21168 |
} |
| 21169 |
/** |
| 21170 |
* @type {Tokenizer} |
| 21171 |
* @this {TokenizeContext} |
| 21172 |
*/ |
| 21173 |
function tokenizeIndent(effects, ok, nok) { |
| 21174 |
const self = this; |
| 21175 |
return factorySpace(effects, afterPrefix, "listItemIndent", self.containerState.size + 1); |
| 21176 |
/** @type {State} */ |
| 21177 |
function afterPrefix(code) { |
| 21178 |
const tail = self.events[self.events.length - 1]; |
| 21179 |
return tail && tail[1].type === "listItemIndent" && tail[2].sliceSerialize(tail[1], true).length === self.containerState.size ? ok(code) : nok(code); |
| 21180 |
} |
| 21181 |
} |
| 21182 |
/** |
| 21183 |
* @type {Exiter} |
| 21184 |
* @this {TokenizeContext} |
| 21185 |
*/ |
| 21186 |
function tokenizeListEnd(effects) { |
| 21187 |
effects.exit(this.containerState.type); |
| 21188 |
} |
| 21189 |
/** |
| 21190 |
* @type {Tokenizer} |
| 21191 |
* @this {TokenizeContext} |
| 21192 |
*/ |
| 21193 |
function tokenizeListItemPrefixWhitespace(effects, ok, nok) { |
| 21194 |
const self = this; |
| 21195 |
return factorySpace(effects, afterPrefix, "listItemPrefixWhitespace", self.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 5); |
| 21196 |
/** @type {State} */ |
| 21197 |
function afterPrefix(code) { |
| 21198 |
const tail = self.events[self.events.length - 1]; |
| 21199 |
return !markdownSpace(code) && tail && tail[1].type === "listItemPrefixWhitespace" ? ok(code) : nok(code); |
| 21200 |
} |
| 21201 |
} |
| 21202 |
var list$1, listItemPrefixWhitespaceConstruct, indentConstruct; |
| 21203 |
var init_list$1 = __esmMin((() => { |
| 21204 |
init_micromark_factory_space(); |
| 21205 |
init_micromark_util_character(); |
| 21206 |
init_blank_line(); |
| 21207 |
init_thematic_break$1(); |
| 21208 |
list$1 = { |
| 21209 |
name: "list", |
| 21210 |
tokenize: tokenizeListStart, |
| 21211 |
continuation: { tokenize: tokenizeListContinuation }, |
| 21212 |
exit: tokenizeListEnd |
| 21213 |
}; |
| 21214 |
listItemPrefixWhitespaceConstruct = { |
| 21215 |
tokenize: tokenizeListItemPrefixWhitespace, |
| 21216 |
partial: true |
| 21217 |
}; |
| 21218 |
indentConstruct = { |
| 21219 |
tokenize: tokenizeIndent, |
| 21220 |
partial: true |
| 21221 |
}; |
| 21222 |
})); |
| 21223 |
|
| 21224 |
//#endregion |
| 21225 |
//#region node_modules/micromark-core-commonmark/lib/setext-underline.js |
| 21226 |
/** @type {Resolver} */ |
| 21227 |
function resolveToSetextUnderline(events, context) { |
| 21228 |
let index = events.length; |
| 21229 |
/** @type {number | undefined} */ |
| 21230 |
let content; |
| 21231 |
/** @type {number | undefined} */ |
| 21232 |
let text; |
| 21233 |
/** @type {number | undefined} */ |
| 21234 |
let definition; |
| 21235 |
while (index--) if (events[index][0] === "enter") { |
| 21236 |
if (events[index][1].type === "content") { |
| 21237 |
content = index; |
| 21238 |
break; |
| 21239 |
} |
| 21240 |
if (events[index][1].type === "paragraph") text = index; |
| 21241 |
} else { |
| 21242 |
if (events[index][1].type === "content") events.splice(index, 1); |
| 21243 |
if (!definition && events[index][1].type === "definition") definition = index; |
| 21244 |
} |
| 21245 |
const heading = { |
| 21246 |
type: "setextHeading", |
| 21247 |
start: Object.assign({}, events[text][1].start), |
| 21248 |
end: Object.assign({}, events[events.length - 1][1].end) |
| 21249 |
}; |
| 21250 |
events[text][1].type = "setextHeadingText"; |
| 21251 |
if (definition) { |
| 21252 |
events.splice(text, 0, [ |
| 21253 |
"enter", |
| 21254 |
heading, |
| 21255 |
context |
| 21256 |
]); |
| 21257 |
events.splice(definition + 1, 0, [ |
| 21258 |
"exit", |
| 21259 |
events[content][1], |
| 21260 |
context |
| 21261 |
]); |
| 21262 |
events[content][1].end = Object.assign({}, events[definition][1].end); |
| 21263 |
} else events[content][1] = heading; |
| 21264 |
events.push([ |
| 21265 |
"exit", |
| 21266 |
heading, |
| 21267 |
context |
| 21268 |
]); |
| 21269 |
return events; |
| 21270 |
} |
| 21271 |
/** |
| 21272 |
* @this {TokenizeContext} |
| 21273 |
* @type {Tokenizer} |
| 21274 |
*/ |
| 21275 |
function tokenizeSetextUnderline(effects, ok, nok) { |
| 21276 |
const self = this; |
| 21277 |
/** @type {NonNullable<Code>} */ |
| 21278 |
let marker; |
| 21279 |
return start; |
| 21280 |
/** |
| 21281 |
* At start of heading (setext) underline. |
| 21282 |
* |
| 21283 |
* ```markdown |
| 21284 |
* | aa |
| 21285 |
* > | == |
| 21286 |
* ^ |
| 21287 |
* ``` |
| 21288 |
* |
| 21289 |
* @type {State} |
| 21290 |
*/ |
| 21291 |
function start(code) { |
| 21292 |
let index = self.events.length; |
| 21293 |
/** @type {boolean | undefined} */ |
| 21294 |
let paragraph; |
| 21295 |
while (index--) if (self.events[index][1].type !== "lineEnding" && self.events[index][1].type !== "linePrefix" && self.events[index][1].type !== "content") { |
| 21296 |
paragraph = self.events[index][1].type === "paragraph"; |
| 21297 |
break; |
| 21298 |
} |
| 21299 |
if (!self.parser.lazy[self.now().line] && (self.interrupt || paragraph)) { |
| 21300 |
effects.enter("setextHeadingLine"); |
| 21301 |
marker = code; |
| 21302 |
return before(code); |
| 21303 |
} |
| 21304 |
return nok(code); |
| 21305 |
} |
| 21306 |
/** |
| 21307 |
* After optional whitespace, at `-` or `=`. |
| 21308 |
* |
| 21309 |
* ```markdown |
| 21310 |
* | aa |
| 21311 |
* > | == |
| 21312 |
* ^ |
| 21313 |
* ``` |
| 21314 |
* |
| 21315 |
* @type {State} |
| 21316 |
*/ |
| 21317 |
function before(code) { |
| 21318 |
effects.enter("setextHeadingLineSequence"); |
| 21319 |
return inside(code); |
| 21320 |
} |
| 21321 |
/** |
| 21322 |
* In sequence. |
| 21323 |
* |
| 21324 |
* ```markdown |
| 21325 |
* | aa |
| 21326 |
* > | == |
| 21327 |
* ^ |
| 21328 |
* ``` |
| 21329 |
* |
| 21330 |
* @type {State} |
| 21331 |
*/ |
| 21332 |
function inside(code) { |
| 21333 |
if (code === marker) { |
| 21334 |
effects.consume(code); |
| 21335 |
return inside; |
| 21336 |
} |
| 21337 |
effects.exit("setextHeadingLineSequence"); |
| 21338 |
return markdownSpace(code) ? factorySpace(effects, after, "lineSuffix")(code) : after(code); |
| 21339 |
} |
| 21340 |
/** |
| 21341 |
* After sequence, after optional whitespace. |
| 21342 |
* |
| 21343 |
* ```markdown |
| 21344 |
* | aa |
| 21345 |
* > | == |
| 21346 |
* ^ |
| 21347 |
* ``` |
| 21348 |
* |
| 21349 |
* @type {State} |
| 21350 |
*/ |
| 21351 |
function after(code) { |
| 21352 |
if (code === null || markdownLineEnding(code)) { |
| 21353 |
effects.exit("setextHeadingLine"); |
| 21354 |
return ok(code); |
| 21355 |
} |
| 21356 |
return nok(code); |
| 21357 |
} |
| 21358 |
} |
| 21359 |
var setextUnderline; |
| 21360 |
var init_setext_underline = __esmMin((() => { |
| 21361 |
init_micromark_factory_space(); |
| 21362 |
init_micromark_util_character(); |
| 21363 |
setextUnderline = { |
| 21364 |
name: "setextUnderline", |
| 21365 |
tokenize: tokenizeSetextUnderline, |
| 21366 |
resolveTo: resolveToSetextUnderline |
| 21367 |
}; |
| 21368 |
})); |
| 21369 |
|
| 21370 |
//#endregion |
| 21371 |
//#region node_modules/micromark-core-commonmark/index.js |
| 21372 |
var init_micromark_core_commonmark = __esmMin((() => { |
| 21373 |
init_attention(); |
| 21374 |
init_autolink(); |
| 21375 |
init_blank_line(); |
| 21376 |
init_block_quote(); |
| 21377 |
init_character_escape(); |
| 21378 |
init_character_reference(); |
| 21379 |
init_code_fenced(); |
| 21380 |
init_code_indented(); |
| 21381 |
init_code_text(); |
| 21382 |
init_content(); |
| 21383 |
init_definition(); |
| 21384 |
init_hard_break_escape(); |
| 21385 |
init_heading_atx(); |
| 21386 |
init_html_flow(); |
| 21387 |
init_html_text(); |
| 21388 |
init_label_end(); |
| 21389 |
init_label_start_image(); |
| 21390 |
init_label_start_link(); |
| 21391 |
init_line_ending(); |
| 21392 |
init_list$1(); |
| 21393 |
init_setext_underline(); |
| 21394 |
init_thematic_break$1(); |
| 21395 |
})); |
| 21396 |
|
| 21397 |
//#endregion |
| 21398 |
//#region node_modules/micromark/lib/initialize/flow.js |
| 21399 |
/** |
| 21400 |
* @this {TokenizeContext} |
| 21401 |
* @type {Initializer} |
| 21402 |
*/ |
| 21403 |
function initializeFlow(effects) { |
| 21404 |
const self = this; |
| 21405 |
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"))); |
| 21406 |
return initial; |
| 21407 |
/** @type {State} */ |
| 21408 |
function atBlankEnding(code) { |
| 21409 |
if (code === null) { |
| 21410 |
effects.consume(code); |
| 21411 |
return; |
| 21412 |
} |
| 21413 |
effects.enter("lineEndingBlank"); |
| 21414 |
effects.consume(code); |
| 21415 |
effects.exit("lineEndingBlank"); |
| 21416 |
self.currentConstruct = void 0; |
| 21417 |
return initial; |
| 21418 |
} |
| 21419 |
/** @type {State} */ |
| 21420 |
function afterConstruct(code) { |
| 21421 |
if (code === null) { |
| 21422 |
effects.consume(code); |
| 21423 |
return; |
| 21424 |
} |
| 21425 |
effects.enter("lineEnding"); |
| 21426 |
effects.consume(code); |
| 21427 |
effects.exit("lineEnding"); |
| 21428 |
self.currentConstruct = void 0; |
| 21429 |
return initial; |
| 21430 |
} |
| 21431 |
} |
| 21432 |
var flow$1; |
| 21433 |
var init_flow = __esmMin((() => { |
| 21434 |
init_micromark_core_commonmark(); |
| 21435 |
init_micromark_factory_space(); |
| 21436 |
flow$1 = { tokenize: initializeFlow }; |
| 21437 |
})); |
| 21438 |
|
| 21439 |
//#endregion |
| 21440 |
//#region node_modules/micromark/lib/initialize/text.js |
| 21441 |
/** |
| 21442 |
* @param {'string' | 'text'} field |
| 21443 |
* @returns {InitialConstruct} |
| 21444 |
*/ |
| 21445 |
function initializeFactory(field) { |
| 21446 |
return { |
| 21447 |
tokenize: initializeText, |
| 21448 |
resolveAll: createResolver(field === "text" ? resolveAllLineSuffixes : void 0) |
| 21449 |
}; |
| 21450 |
/** |
| 21451 |
* @this {TokenizeContext} |
| 21452 |
* @type {Initializer} |
| 21453 |
*/ |
| 21454 |
function initializeText(effects) { |
| 21455 |
const self = this; |
| 21456 |
const constructs = this.parser.constructs[field]; |
| 21457 |
const text = effects.attempt(constructs, start, notText); |
| 21458 |
return start; |
| 21459 |
/** @type {State} */ |
| 21460 |
function start(code) { |
| 21461 |
return atBreak(code) ? text(code) : notText(code); |
| 21462 |
} |
| 21463 |
/** @type {State} */ |
| 21464 |
function notText(code) { |
| 21465 |
if (code === null) { |
| 21466 |
effects.consume(code); |
| 21467 |
return; |
| 21468 |
} |
| 21469 |
effects.enter("data"); |
| 21470 |
effects.consume(code); |
| 21471 |
return data; |
| 21472 |
} |
| 21473 |
/** @type {State} */ |
| 21474 |
function data(code) { |
| 21475 |
if (atBreak(code)) { |
| 21476 |
effects.exit("data"); |
| 21477 |
return text(code); |
| 21478 |
} |
| 21479 |
effects.consume(code); |
| 21480 |
return data; |
| 21481 |
} |
| 21482 |
/** |
| 21483 |
* @param {Code} code |
| 21484 |
* @returns {boolean} |
| 21485 |
*/ |
| 21486 |
function atBreak(code) { |
| 21487 |
if (code === null) return true; |
| 21488 |
const list = constructs[code]; |
| 21489 |
let index = -1; |
| 21490 |
if (list) while (++index < list.length) { |
| 21491 |
const item = list[index]; |
| 21492 |
if (!item.previous || item.previous.call(self, self.previous)) return true; |
| 21493 |
} |
| 21494 |
return false; |
| 21495 |
} |
| 21496 |
} |
| 21497 |
} |
| 21498 |
/** |
| 21499 |
* @param {Resolver | undefined} [extraResolver] |
| 21500 |
* @returns {Resolver} |
| 21501 |
*/ |
| 21502 |
function createResolver(extraResolver) { |
| 21503 |
return resolveAllText; |
| 21504 |
/** @type {Resolver} */ |
| 21505 |
function resolveAllText(events, context) { |
| 21506 |
let index = -1; |
| 21507 |
/** @type {number | undefined} */ |
| 21508 |
let enter; |
| 21509 |
while (++index <= events.length) if (enter === void 0) { |
| 21510 |
if (events[index] && events[index][1].type === "data") { |
| 21511 |
enter = index; |
| 21512 |
index++; |
| 21513 |
} |
| 21514 |
} else if (!events[index] || events[index][1].type !== "data") { |
| 21515 |
if (index !== enter + 2) { |
| 21516 |
events[enter][1].end = events[index - 1][1].end; |
| 21517 |
events.splice(enter + 2, index - enter - 2); |
| 21518 |
index = enter + 2; |
| 21519 |
} |
| 21520 |
enter = void 0; |
| 21521 |
} |
| 21522 |
return extraResolver ? extraResolver(events, context) : events; |
| 21523 |
} |
| 21524 |
} |
| 21525 |
/** |
| 21526 |
* A rather ugly set of instructions which again looks at chunks in the input |
| 21527 |
* stream. |
| 21528 |
* The reason to do this here is that it is *much* faster to parse in reverse. |
| 21529 |
* And that we can’t hook into `null` to split the line suffix before an EOF. |
| 21530 |
* To do: figure out if we can make this into a clean utility, or even in core. |
| 21531 |
* As it will be useful for GFMs literal autolink extension (and maybe even |
| 21532 |
* tables?) |
| 21533 |
* |
| 21534 |
* @type {Resolver} |
| 21535 |
*/ |
| 21536 |
function resolveAllLineSuffixes(events, context) { |
| 21537 |
let eventIndex = 0; |
| 21538 |
while (++eventIndex <= events.length) if ((eventIndex === events.length || events[eventIndex][1].type === "lineEnding") && events[eventIndex - 1][1].type === "data") { |
| 21539 |
const data = events[eventIndex - 1][1]; |
| 21540 |
const chunks = context.sliceStream(data); |
| 21541 |
let index = chunks.length; |
| 21542 |
let bufferIndex = -1; |
| 21543 |
let size = 0; |
| 21544 |
/** @type {boolean | undefined} */ |
| 21545 |
let tabs; |
| 21546 |
while (index--) { |
| 21547 |
const chunk = chunks[index]; |
| 21548 |
if (typeof chunk === "string") { |
| 21549 |
bufferIndex = chunk.length; |
| 21550 |
while (chunk.charCodeAt(bufferIndex - 1) === 32) { |
| 21551 |
size++; |
| 21552 |
bufferIndex--; |
| 21553 |
} |
| 21554 |
if (bufferIndex) break; |
| 21555 |
bufferIndex = -1; |
| 21556 |
} else if (chunk === -2) { |
| 21557 |
tabs = true; |
| 21558 |
size++; |
| 21559 |
} else if (chunk === -1) {} else { |
| 21560 |
index++; |
| 21561 |
break; |
| 21562 |
} |
| 21563 |
} |
| 21564 |
if (size) { |
| 21565 |
const token = { |
| 21566 |
type: eventIndex === events.length || tabs || size < 2 ? "lineSuffix" : "hardBreakTrailing", |
| 21567 |
start: { |
| 21568 |
line: data.end.line, |
| 21569 |
column: data.end.column - size, |
| 21570 |
offset: data.end.offset - size, |
| 21571 |
_index: data.start._index + index, |
| 21572 |
_bufferIndex: index ? bufferIndex : data.start._bufferIndex + bufferIndex |
| 21573 |
}, |
| 21574 |
end: Object.assign({}, data.end) |
| 21575 |
}; |
| 21576 |
data.end = Object.assign({}, token.start); |
| 21577 |
if (data.start.offset === data.end.offset) Object.assign(data, token); |
| 21578 |
else { |
| 21579 |
events.splice(eventIndex, 0, [ |
| 21580 |
"enter", |
| 21581 |
token, |
| 21582 |
context |
| 21583 |
], [ |
| 21584 |
"exit", |
| 21585 |
token, |
| 21586 |
context |
| 21587 |
]); |
| 21588 |
eventIndex += 2; |
| 21589 |
} |
| 21590 |
} |
| 21591 |
eventIndex++; |
| 21592 |
} |
| 21593 |
return events; |
| 21594 |
} |
| 21595 |
var resolver, string$1, text$2; |
| 21596 |
var init_text$1 = __esmMin((() => { |
| 21597 |
resolver = { resolveAll: createResolver() }; |
| 21598 |
string$1 = initializeFactory("string"); |
| 21599 |
text$2 = initializeFactory("text"); |
| 21600 |
})); |
| 21601 |
|
| 21602 |
//#endregion |
| 21603 |
//#region node_modules/micromark/lib/create-tokenizer.js |
| 21604 |
/** |
| 21605 |
* Create a tokenizer. |
| 21606 |
* Tokenizers deal with one type of data (e.g., containers, flow, text). |
| 21607 |
* The parser is the object dealing with it all. |
| 21608 |
* `initialize` works like other constructs, except that only its `tokenize` |
| 21609 |
* function is used, in which case it doesn’t receive an `ok` or `nok`. |
| 21610 |
* `from` can be given to set the point before the first character, although |
| 21611 |
* when further lines are indented, they must be set with `defineSkip`. |
| 21612 |
* |
| 21613 |
* @param {ParseContext} parser |
| 21614 |
* @param {InitialConstruct} initialize |
| 21615 |
* @param {Omit<Point, '_bufferIndex' | '_index'> | undefined} [from] |
| 21616 |
* @returns {TokenizeContext} |
| 21617 |
*/ |
| 21618 |
function createTokenizer(parser, initialize, from) { |
| 21619 |
/** @type {Point} */ |
| 21620 |
let point = Object.assign(from ? Object.assign({}, from) : { |
| 21621 |
line: 1, |
| 21622 |
column: 1, |
| 21623 |
offset: 0 |
| 21624 |
}, { |
| 21625 |
_index: 0, |
| 21626 |
_bufferIndex: -1 |
| 21627 |
}); |
| 21628 |
/** @type {Record<string, number>} */ |
| 21629 |
const columnStart = {}; |
| 21630 |
/** @type {Array<Construct>} */ |
| 21631 |
const resolveAllConstructs = []; |
| 21632 |
/** @type {Array<Chunk>} */ |
| 21633 |
let chunks = []; |
| 21634 |
/** @type {Array<Token>} */ |
| 21635 |
let stack = []; |
| 21636 |
/** |
| 21637 |
* Tools used for tokenizing. |
| 21638 |
* |
| 21639 |
* @type {Effects} |
| 21640 |
*/ |
| 21641 |
const effects = { |
| 21642 |
consume, |
| 21643 |
enter, |
| 21644 |
exit, |
| 21645 |
attempt: constructFactory(onsuccessfulconstruct), |
| 21646 |
check: constructFactory(onsuccessfulcheck), |
| 21647 |
interrupt: constructFactory(onsuccessfulcheck, { interrupt: true }) |
| 21648 |
}; |
| 21649 |
/** |
| 21650 |
* State and tools for resolving and serializing. |
| 21651 |
* |
| 21652 |
* @type {TokenizeContext} |
| 21653 |
*/ |
| 21654 |
const context = { |
| 21655 |
previous: null, |
| 21656 |
code: null, |
| 21657 |
containerState: {}, |
| 21658 |
events: [], |
| 21659 |
parser, |
| 21660 |
sliceStream, |
| 21661 |
sliceSerialize, |
| 21662 |
now, |
| 21663 |
defineSkip, |
| 21664 |
write |
| 21665 |
}; |
| 21666 |
/** |
| 21667 |
* The state function. |
| 21668 |
* |
| 21669 |
* @type {State | void} |
| 21670 |
*/ |
| 21671 |
let state = initialize.tokenize.call(context, effects); |
| 21672 |
if (initialize.resolveAll) resolveAllConstructs.push(initialize); |
| 21673 |
return context; |
| 21674 |
/** @type {TokenizeContext['write']} */ |
| 21675 |
function write(slice) { |
| 21676 |
chunks = push(chunks, slice); |
| 21677 |
main(); |
| 21678 |
if (chunks[chunks.length - 1] !== null) return []; |
| 21679 |
addResult(initialize, 0); |
| 21680 |
context.events = resolveAll(resolveAllConstructs, context.events, context); |
| 21681 |
return context.events; |
| 21682 |
} |
| 21683 |
/** @type {TokenizeContext['sliceSerialize']} */ |
| 21684 |
function sliceSerialize(token, expandTabs) { |
| 21685 |
return serializeChunks(sliceStream(token), expandTabs); |
| 21686 |
} |
| 21687 |
/** @type {TokenizeContext['sliceStream']} */ |
| 21688 |
function sliceStream(token) { |
| 21689 |
return sliceChunks(chunks, token); |
| 21690 |
} |
| 21691 |
/** @type {TokenizeContext['now']} */ |
| 21692 |
function now() { |
| 21693 |
const { line, column, offset, _index, _bufferIndex } = point; |
| 21694 |
return { |
| 21695 |
line, |
| 21696 |
column, |
| 21697 |
offset, |
| 21698 |
_index, |
| 21699 |
_bufferIndex |
| 21700 |
}; |
| 21701 |
} |
| 21702 |
/** @type {TokenizeContext['defineSkip']} */ |
| 21703 |
function defineSkip(value) { |
| 21704 |
columnStart[value.line] = value.column; |
| 21705 |
accountForPotentialSkip(); |
| 21706 |
} |
| 21707 |
/** |
| 21708 |
* Main loop (note that `_index` and `_bufferIndex` in `point` are modified by |
| 21709 |
* `consume`). |
| 21710 |
* Here is where we walk through the chunks, which either include strings of |
| 21711 |
* several characters, or numerical character codes. |
| 21712 |
* The reason to do this in a loop instead of a call is so the stack can |
| 21713 |
* drain. |
| 21714 |
* |
| 21715 |
* @returns {void} |
| 21716 |
*/ |
| 21717 |
function main() { |
| 21718 |
/** @type {number} */ |
| 21719 |
let chunkIndex; |
| 21720 |
while (point._index < chunks.length) { |
| 21721 |
const chunk = chunks[point._index]; |
| 21722 |
if (typeof chunk === "string") { |
| 21723 |
chunkIndex = point._index; |
| 21724 |
if (point._bufferIndex < 0) point._bufferIndex = 0; |
| 21725 |
while (point._index === chunkIndex && point._bufferIndex < chunk.length) go(chunk.charCodeAt(point._bufferIndex)); |
| 21726 |
} else go(chunk); |
| 21727 |
} |
| 21728 |
} |
| 21729 |
/** |
| 21730 |
* Deal with one code. |
| 21731 |
* |
| 21732 |
* @param {Code} code |
| 21733 |
* @returns {void} |
| 21734 |
*/ |
| 21735 |
function go(code) { |
| 21736 |
state = state(code); |
| 21737 |
} |
| 21738 |
/** @type {Effects['consume']} */ |
| 21739 |
function consume(code) { |
| 21740 |
if (markdownLineEnding(code)) { |
| 21741 |
point.line++; |
| 21742 |
point.column = 1; |
| 21743 |
point.offset += code === -3 ? 2 : 1; |
| 21744 |
accountForPotentialSkip(); |
| 21745 |
} else if (code !== -1) { |
| 21746 |
point.column++; |
| 21747 |
point.offset++; |
| 21748 |
} |
| 21749 |
if (point._bufferIndex < 0) point._index++; |
| 21750 |
else { |
| 21751 |
point._bufferIndex++; |
| 21752 |
if (point._bufferIndex === chunks[point._index].length) { |
| 21753 |
point._bufferIndex = -1; |
| 21754 |
point._index++; |
| 21755 |
} |
| 21756 |
} |
| 21757 |
context.previous = code; |
| 21758 |
} |
| 21759 |
/** @type {Effects['enter']} */ |
| 21760 |
function enter(type, fields) { |
| 21761 |
/** @type {Token} */ |
| 21762 |
const token = fields || {}; |
| 21763 |
token.type = type; |
| 21764 |
token.start = now(); |
| 21765 |
context.events.push([ |
| 21766 |
"enter", |
| 21767 |
token, |
| 21768 |
context |
| 21769 |
]); |
| 21770 |
stack.push(token); |
| 21771 |
return token; |
| 21772 |
} |
| 21773 |
/** @type {Effects['exit']} */ |
| 21774 |
function exit(type) { |
| 21775 |
const token = stack.pop(); |
| 21776 |
token.end = now(); |
| 21777 |
context.events.push([ |
| 21778 |
"exit", |
| 21779 |
token, |
| 21780 |
context |
| 21781 |
]); |
| 21782 |
return token; |
| 21783 |
} |
| 21784 |
/** |
| 21785 |
* Use results. |
| 21786 |
* |
| 21787 |
* @type {ReturnHandle} |
| 21788 |
*/ |
| 21789 |
function onsuccessfulconstruct(construct, info) { |
| 21790 |
addResult(construct, info.from); |
| 21791 |
} |
| 21792 |
/** |
| 21793 |
* Discard results. |
| 21794 |
* |
| 21795 |
* @type {ReturnHandle} |
| 21796 |
*/ |
| 21797 |
function onsuccessfulcheck(_, info) { |
| 21798 |
info.restore(); |
| 21799 |
} |
| 21800 |
/** |
| 21801 |
* Factory to attempt/check/interrupt. |
| 21802 |
* |
| 21803 |
* @param {ReturnHandle} onreturn |
| 21804 |
* @param {{interrupt?: boolean | undefined} | undefined} [fields] |
| 21805 |
*/ |
| 21806 |
function constructFactory(onreturn, fields) { |
| 21807 |
return hook; |
| 21808 |
/** |
| 21809 |
* Handle either an object mapping codes to constructs, a list of |
| 21810 |
* constructs, or a single construct. |
| 21811 |
* |
| 21812 |
* @param {Array<Construct> | Construct | ConstructRecord} constructs |
| 21813 |
* @param {State} returnState |
| 21814 |
* @param {State | undefined} [bogusState] |
| 21815 |
* @returns {State} |
| 21816 |
*/ |
| 21817 |
function hook(constructs, returnState, bogusState) { |
| 21818 |
/** @type {Array<Construct>} */ |
| 21819 |
let listOfConstructs; |
| 21820 |
/** @type {number} */ |
| 21821 |
let constructIndex; |
| 21822 |
/** @type {Construct} */ |
| 21823 |
let currentConstruct; |
| 21824 |
/** @type {Info} */ |
| 21825 |
let info; |
| 21826 |
return Array.isArray(constructs) ? handleListOfConstructs(constructs) : "tokenize" in constructs ? handleListOfConstructs([constructs]) : handleMapOfConstructs(constructs); |
| 21827 |
/** |
| 21828 |
* Handle a list of construct. |
| 21829 |
* |
| 21830 |
* @param {ConstructRecord} map |
| 21831 |
* @returns {State} |
| 21832 |
*/ |
| 21833 |
function handleMapOfConstructs(map) { |
| 21834 |
return start; |
| 21835 |
/** @type {State} */ |
| 21836 |
function start(code) { |
| 21837 |
const def = code !== null && map[code]; |
| 21838 |
const all = code !== null && map.null; |
| 21839 |
return handleListOfConstructs([...Array.isArray(def) ? def : def ? [def] : [], ...Array.isArray(all) ? all : all ? [all] : []])(code); |
| 21840 |
} |
| 21841 |
} |
| 21842 |
/** |
| 21843 |
* Handle a list of construct. |
| 21844 |
* |
| 21845 |
* @param {Array<Construct>} list |
| 21846 |
* @returns {State} |
| 21847 |
*/ |
| 21848 |
function handleListOfConstructs(list) { |
| 21849 |
listOfConstructs = list; |
| 21850 |
constructIndex = 0; |
| 21851 |
if (list.length === 0) return bogusState; |
| 21852 |
return handleConstruct(list[constructIndex]); |
| 21853 |
} |
| 21854 |
/** |
| 21855 |
* Handle a single construct. |
| 21856 |
* |
| 21857 |
* @param {Construct} construct |
| 21858 |
* @returns {State} |
| 21859 |
*/ |
| 21860 |
function handleConstruct(construct) { |
| 21861 |
return start; |
| 21862 |
/** @type {State} */ |
| 21863 |
function start(code) { |
| 21864 |
info = store(); |
| 21865 |
currentConstruct = construct; |
| 21866 |
if (!construct.partial) context.currentConstruct = construct; |
| 21867 |
if (construct.name && context.parser.constructs.disable.null.includes(construct.name)) return nok(code); |
| 21868 |
return construct.tokenize.call(fields ? Object.assign(Object.create(context), fields) : context, effects, ok, nok)(code); |
| 21869 |
} |
| 21870 |
} |
| 21871 |
/** @type {State} */ |
| 21872 |
function ok(code) { |
| 21873 |
onreturn(currentConstruct, info); |
| 21874 |
return returnState; |
| 21875 |
} |
| 21876 |
/** @type {State} */ |
| 21877 |
function nok(code) { |
| 21878 |
info.restore(); |
| 21879 |
if (++constructIndex < listOfConstructs.length) return handleConstruct(listOfConstructs[constructIndex]); |
| 21880 |
return bogusState; |
| 21881 |
} |
| 21882 |
} |
| 21883 |
} |
| 21884 |
/** |
| 21885 |
* @param {Construct} construct |
| 21886 |
* @param {number} from |
| 21887 |
* @returns {void} |
| 21888 |
*/ |
| 21889 |
function addResult(construct, from) { |
| 21890 |
if (construct.resolveAll && !resolveAllConstructs.includes(construct)) resolveAllConstructs.push(construct); |
| 21891 |
if (construct.resolve) splice(context.events, from, context.events.length - from, construct.resolve(context.events.slice(from), context)); |
| 21892 |
if (construct.resolveTo) context.events = construct.resolveTo(context.events, context); |
| 21893 |
} |
| 21894 |
/** |
| 21895 |
* Store state. |
| 21896 |
* |
| 21897 |
* @returns {Info} |
| 21898 |
*/ |
| 21899 |
function store() { |
| 21900 |
const startPoint = now(); |
| 21901 |
const startPrevious = context.previous; |
| 21902 |
const startCurrentConstruct = context.currentConstruct; |
| 21903 |
const startEventsIndex = context.events.length; |
| 21904 |
const startStack = Array.from(stack); |
| 21905 |
return { |
| 21906 |
restore, |
| 21907 |
from: startEventsIndex |
| 21908 |
}; |
| 21909 |
/** |
| 21910 |
* Restore state. |
| 21911 |
* |
| 21912 |
* @returns {void} |
| 21913 |
*/ |
| 21914 |
function restore() { |
| 21915 |
point = startPoint; |
| 21916 |
context.previous = startPrevious; |
| 21917 |
context.currentConstruct = startCurrentConstruct; |
| 21918 |
context.events.length = startEventsIndex; |
| 21919 |
stack = startStack; |
| 21920 |
accountForPotentialSkip(); |
| 21921 |
} |
| 21922 |
} |
| 21923 |
/** |
| 21924 |
* Move the current point a bit forward in the line when it’s on a column |
| 21925 |
* skip. |
| 21926 |
* |
| 21927 |
* @returns {void} |
| 21928 |
*/ |
| 21929 |
function accountForPotentialSkip() { |
| 21930 |
if (point.line in columnStart && point.column < 2) { |
| 21931 |
point.column = columnStart[point.line]; |
| 21932 |
point.offset += columnStart[point.line] - 1; |
| 21933 |
} |
| 21934 |
} |
| 21935 |
} |
| 21936 |
/** |
| 21937 |
* Get the chunks from a slice of chunks in the range of a token. |
| 21938 |
* |
| 21939 |
* @param {Array<Chunk>} chunks |
| 21940 |
* @param {Pick<Token, 'end' | 'start'>} token |
| 21941 |
* @returns {Array<Chunk>} |
| 21942 |
*/ |
| 21943 |
function sliceChunks(chunks, token) { |
| 21944 |
const startIndex = token.start._index; |
| 21945 |
const startBufferIndex = token.start._bufferIndex; |
| 21946 |
const endIndex = token.end._index; |
| 21947 |
const endBufferIndex = token.end._bufferIndex; |
| 21948 |
/** @type {Array<Chunk>} */ |
| 21949 |
let view; |
| 21950 |
if (startIndex === endIndex) view = [chunks[startIndex].slice(startBufferIndex, endBufferIndex)]; |
| 21951 |
else { |
| 21952 |
view = chunks.slice(startIndex, endIndex); |
| 21953 |
if (startBufferIndex > -1) { |
| 21954 |
const head = view[0]; |
| 21955 |
if (typeof head === "string") view[0] = head.slice(startBufferIndex); |
| 21956 |
else view.shift(); |
| 21957 |
} |
| 21958 |
if (endBufferIndex > 0) view.push(chunks[endIndex].slice(0, endBufferIndex)); |
| 21959 |
} |
| 21960 |
return view; |
| 21961 |
} |
| 21962 |
/** |
| 21963 |
* Get the string value of a slice of chunks. |
| 21964 |
* |
| 21965 |
* @param {Array<Chunk>} chunks |
| 21966 |
* @param {boolean | undefined} [expandTabs=false] |
| 21967 |
* @returns {string} |
| 21968 |
*/ |
| 21969 |
function serializeChunks(chunks, expandTabs) { |
| 21970 |
let index = -1; |
| 21971 |
/** @type {Array<string>} */ |
| 21972 |
const result = []; |
| 21973 |
/** @type {boolean | undefined} */ |
| 21974 |
let atTab; |
| 21975 |
while (++index < chunks.length) { |
| 21976 |
const chunk = chunks[index]; |
| 21977 |
/** @type {string} */ |
| 21978 |
let value; |
| 21979 |
if (typeof chunk === "string") value = chunk; |
| 21980 |
else switch (chunk) { |
| 21981 |
case -5: |
| 21982 |
value = "\r"; |
| 21983 |
break; |
| 21984 |
case -4: |
| 21985 |
value = "\n"; |
| 21986 |
break; |
| 21987 |
case -3: |
| 21988 |
value = "\r\n"; |
| 21989 |
break; |
| 21990 |
case -2: |
| 21991 |
value = expandTabs ? " " : " "; |
| 21992 |
break; |
| 21993 |
case -1: |
| 21994 |
if (!expandTabs && atTab) continue; |
| 21995 |
value = " "; |
| 21996 |
break; |
| 21997 |
default: value = String.fromCharCode(chunk); |
| 21998 |
} |
| 21999 |
atTab = chunk === -2; |
| 22000 |
result.push(value); |
| 22001 |
} |
| 22002 |
return result.join(""); |
| 22003 |
} |
| 22004 |
var init_create_tokenizer = __esmMin((() => { |
| 22005 |
init_micromark_util_character(); |
| 22006 |
init_micromark_util_chunked(); |
| 22007 |
init_micromark_util_resolve_all(); |
| 22008 |
})); |
| 22009 |
|
| 22010 |
//#endregion |
| 22011 |
//#region node_modules/micromark/lib/constructs.js |
| 22012 |
var constructs_exports = /* @__PURE__ */ __exportAll({ |
| 22013 |
attentionMarkers: () => attentionMarkers, |
| 22014 |
contentInitial: () => contentInitial, |
| 22015 |
disable: () => disable, |
| 22016 |
document: () => document$1, |
| 22017 |
flow: () => flow, |
| 22018 |
flowInitial: () => flowInitial, |
| 22019 |
insideSpan: () => insideSpan, |
| 22020 |
string: () => string, |
| 22021 |
text: () => text$1 |
| 22022 |
}); |
| 22023 |
var document$1, contentInitial, flowInitial, flow, string, text$1, insideSpan, attentionMarkers, disable; |
| 22024 |
var init_constructs = __esmMin((() => { |
| 22025 |
init_micromark_core_commonmark(); |
| 22026 |
init_text$1(); |
| 22027 |
document$1 = { |
| 22028 |
[42]: list$1, |
| 22029 |
[43]: list$1, |
| 22030 |
[45]: list$1, |
| 22031 |
[48]: list$1, |
| 22032 |
[49]: list$1, |
| 22033 |
[50]: list$1, |
| 22034 |
[51]: list$1, |
| 22035 |
[52]: list$1, |
| 22036 |
[53]: list$1, |
| 22037 |
[54]: list$1, |
| 22038 |
[55]: list$1, |
| 22039 |
[56]: list$1, |
| 22040 |
[57]: list$1, |
| 22041 |
[62]: blockQuote |
| 22042 |
}; |
| 22043 |
contentInitial = { [91]: definition }; |
| 22044 |
flowInitial = { |
| 22045 |
[-2]: codeIndented, |
| 22046 |
[-1]: codeIndented, |
| 22047 |
[32]: codeIndented |
| 22048 |
}; |
| 22049 |
flow = { |
| 22050 |
[35]: headingAtx, |
| 22051 |
[42]: thematicBreak$1, |
| 22052 |
[45]: [setextUnderline, thematicBreak$1], |
| 22053 |
[60]: htmlFlow, |
| 22054 |
[61]: setextUnderline, |
| 22055 |
[95]: thematicBreak$1, |
| 22056 |
[96]: codeFenced, |
| 22057 |
[126]: codeFenced |
| 22058 |
}; |
| 22059 |
string = { |
| 22060 |
[38]: characterReference, |
| 22061 |
[92]: characterEscape |
| 22062 |
}; |
| 22063 |
text$1 = { |
| 22064 |
[-5]: lineEnding, |
| 22065 |
[-4]: lineEnding, |
| 22066 |
[-3]: lineEnding, |
| 22067 |
[33]: labelStartImage, |
| 22068 |
[38]: characterReference, |
| 22069 |
[42]: attention, |
| 22070 |
[60]: [autolink, htmlText], |
| 22071 |
[91]: labelStartLink, |
| 22072 |
[92]: [hardBreakEscape, characterEscape], |
| 22073 |
[93]: labelEnd, |
| 22074 |
[95]: attention, |
| 22075 |
[96]: codeText |
| 22076 |
}; |
| 22077 |
insideSpan = { null: [attention, resolver] }; |
| 22078 |
attentionMarkers = { null: [42, 95] }; |
| 22079 |
disable = { null: [] }; |
| 22080 |
})); |
| 22081 |
|
| 22082 |
//#endregion |
| 22083 |
//#region node_modules/micromark/lib/parse.js |
| 22084 |
/** |
| 22085 |
* @param {ParseOptions | null | undefined} [options] |
| 22086 |
* @returns {ParseContext} |
| 22087 |
*/ |
| 22088 |
function parse(options) { |
| 22089 |
/** @type {ParseContext} */ |
| 22090 |
const parser = { |
| 22091 |
defined: [], |
| 22092 |
lazy: {}, |
| 22093 |
constructs: combineExtensions([constructs_exports, ...(options || {}).extensions || []]), |
| 22094 |
content: create(content$1), |
| 22095 |
document: create(document$2), |
| 22096 |
flow: create(flow$1), |
| 22097 |
string: create(string$1), |
| 22098 |
text: create(text$2) |
| 22099 |
}; |
| 22100 |
return parser; |
| 22101 |
/** |
| 22102 |
* @param {InitialConstruct} initial |
| 22103 |
*/ |
| 22104 |
function create(initial) { |
| 22105 |
return creator; |
| 22106 |
/** @type {Create} */ |
| 22107 |
function creator(from) { |
| 22108 |
return createTokenizer(parser, initial, from); |
| 22109 |
} |
| 22110 |
} |
| 22111 |
} |
| 22112 |
var init_parse = __esmMin((() => { |
| 22113 |
init_micromark_util_combine_extensions(); |
| 22114 |
init_content$1(); |
| 22115 |
init_document(); |
| 22116 |
init_flow(); |
| 22117 |
init_text$1(); |
| 22118 |
init_create_tokenizer(); |
| 22119 |
init_constructs(); |
| 22120 |
})); |
| 22121 |
|
| 22122 |
//#endregion |
| 22123 |
//#region node_modules/micromark/lib/preprocess.js |
| 22124 |
/** |
| 22125 |
* @returns {Preprocessor} |
| 22126 |
*/ |
| 22127 |
function preprocess() { |
| 22128 |
let column = 1; |
| 22129 |
let buffer = ""; |
| 22130 |
/** @type {boolean | undefined} */ |
| 22131 |
let start = true; |
| 22132 |
/** @type {boolean | undefined} */ |
| 22133 |
let atCarriageReturn; |
| 22134 |
return preprocessor; |
| 22135 |
/** @type {Preprocessor} */ |
| 22136 |
function preprocessor(value, encoding, end) { |
| 22137 |
/** @type {Array<Chunk>} */ |
| 22138 |
const chunks = []; |
| 22139 |
/** @type {RegExpMatchArray | null} */ |
| 22140 |
let match; |
| 22141 |
/** @type {number} */ |
| 22142 |
let next; |
| 22143 |
/** @type {number} */ |
| 22144 |
let startPosition; |
| 22145 |
/** @type {number} */ |
| 22146 |
let endPosition; |
| 22147 |
/** @type {Code} */ |
| 22148 |
let code; |
| 22149 |
value = buffer + value.toString(encoding); |
| 22150 |
startPosition = 0; |
| 22151 |
buffer = ""; |
| 22152 |
if (start) { |
| 22153 |
if (value.charCodeAt(0) === 65279) startPosition++; |
| 22154 |
start = void 0; |
| 22155 |
} |
| 22156 |
while (startPosition < value.length) { |
| 22157 |
search.lastIndex = startPosition; |
| 22158 |
match = search.exec(value); |
| 22159 |
endPosition = match && match.index !== void 0 ? match.index : value.length; |
| 22160 |
code = value.charCodeAt(endPosition); |
| 22161 |
if (!match) { |
| 22162 |
buffer = value.slice(startPosition); |
| 22163 |
break; |
| 22164 |
} |
| 22165 |
if (code === 10 && startPosition === endPosition && atCarriageReturn) { |
| 22166 |
chunks.push(-3); |
| 22167 |
atCarriageReturn = void 0; |
| 22168 |
} else { |
| 22169 |
if (atCarriageReturn) { |
| 22170 |
chunks.push(-5); |
| 22171 |
atCarriageReturn = void 0; |
| 22172 |
} |
| 22173 |
if (startPosition < endPosition) { |
| 22174 |
chunks.push(value.slice(startPosition, endPosition)); |
| 22175 |
column += endPosition - startPosition; |
| 22176 |
} |
| 22177 |
switch (code) { |
| 22178 |
case 0: |
| 22179 |
chunks.push(65533); |
| 22180 |
column++; |
| 22181 |
break; |
| 22182 |
case 9: |
| 22183 |
next = Math.ceil(column / 4) * 4; |
| 22184 |
chunks.push(-2); |
| 22185 |
while (column++ < next) chunks.push(-1); |
| 22186 |
break; |
| 22187 |
case 10: |
| 22188 |
chunks.push(-4); |
| 22189 |
column = 1; |
| 22190 |
break; |
| 22191 |
default: |
| 22192 |
atCarriageReturn = true; |
| 22193 |
column = 1; |
| 22194 |
} |
| 22195 |
} |
| 22196 |
startPosition = endPosition + 1; |
| 22197 |
} |
| 22198 |
if (end) { |
| 22199 |
if (atCarriageReturn) chunks.push(-5); |
| 22200 |
if (buffer) chunks.push(buffer); |
| 22201 |
chunks.push(null); |
| 22202 |
} |
| 22203 |
return chunks; |
| 22204 |
} |
| 22205 |
} |
| 22206 |
var search; |
| 22207 |
var init_preprocess = __esmMin((() => { |
| 22208 |
search = /[\0\t\n\r]/g; |
| 22209 |
})); |
| 22210 |
|
| 22211 |
//#endregion |
| 22212 |
//#region node_modules/micromark/lib/postprocess.js |
| 22213 |
/** |
| 22214 |
* @param {Array<Event>} events |
| 22215 |
* @returns {Array<Event>} |
| 22216 |
*/ |
| 22217 |
function postprocess(events) { |
| 22218 |
while (!subtokenize(events)); |
| 22219 |
return events; |
| 22220 |
} |
| 22221 |
var init_postprocess = __esmMin((() => { |
| 22222 |
init_micromark_util_subtokenize(); |
| 22223 |
})); |
| 22224 |
|
| 22225 |
//#endregion |
| 22226 |
//#region node_modules/micromark-util-decode-numeric-character-reference/index.js |
| 22227 |
/** |
| 22228 |
* Turn the number (in string form as either hexa- or plain decimal) coming from |
| 22229 |
* a numeric character reference into a character. |
| 22230 |
* |
| 22231 |
* Sort of like `String.fromCharCode(Number.parseInt(value, base))`, but makes |
| 22232 |
* non-characters and control characters safe. |
| 22233 |
* |
| 22234 |
* @param {string} value |
| 22235 |
* Value to decode. |
| 22236 |
* @param {number} base |
| 22237 |
* Numeric base. |
| 22238 |
* @returns {string} |
| 22239 |
* Character. |
| 22240 |
*/ |
| 22241 |
function decodeNumericCharacterReference(value, base) { |
| 22242 |
const code = Number.parseInt(value, base); |
| 22243 |
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 "�"; |
| 22244 |
return String.fromCharCode(code); |
| 22245 |
} |
| 22246 |
var init_micromark_util_decode_numeric_character_reference = __esmMin((() => {})); |
| 22247 |
|
| 22248 |
//#endregion |
| 22249 |
//#region node_modules/micromark-util-decode-string/index.js |
| 22250 |
/** |
| 22251 |
* Decode markdown strings (which occur in places such as fenced code info |
| 22252 |
* strings, destinations, labels, and titles). |
| 22253 |
* |
| 22254 |
* The “string” content type allows character escapes and -references. |
| 22255 |
* This decodes those. |
| 22256 |
* |
| 22257 |
* @param {string} value |
| 22258 |
* Value to decode. |
| 22259 |
* @returns {string} |
| 22260 |
* Decoded value. |
| 22261 |
*/ |
| 22262 |
function decodeString(value) { |
| 22263 |
return value.replace(characterEscapeOrReference, decode); |
| 22264 |
} |
| 22265 |
/** |
| 22266 |
* @param {string} $0 |
| 22267 |
* @param {string} $1 |
| 22268 |
* @param {string} $2 |
| 22269 |
* @returns {string} |
| 22270 |
*/ |
| 22271 |
function decode($0, $1, $2) { |
| 22272 |
if ($1) return $1; |
| 22273 |
if ($2.charCodeAt(0) === 35) { |
| 22274 |
const head = $2.charCodeAt(1); |
| 22275 |
const hex = head === 120 || head === 88; |
| 22276 |
return decodeNumericCharacterReference($2.slice(hex ? 2 : 1), hex ? 16 : 10); |
| 22277 |
} |
| 22278 |
return decodeNamedCharacterReference($2) || $0; |
| 22279 |
} |
| 22280 |
var characterEscapeOrReference; |
| 22281 |
var init_micromark_util_decode_string = __esmMin((() => { |
| 22282 |
init_index_dom(); |
| 22283 |
init_micromark_util_decode_numeric_character_reference(); |
| 22284 |
characterEscapeOrReference = /\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi; |
| 22285 |
})); |
| 22286 |
|
| 22287 |
//#endregion |
| 22288 |
//#region node_modules/mdast-util-from-markdown/lib/index.js |
| 22289 |
/** |
| 22290 |
* Note this compiler only understand complete buffering, not streaming. |
| 22291 |
* |
| 22292 |
* @param {Options | null | undefined} [options] |
| 22293 |
*/ |
| 22294 |
function compiler(options) { |
| 22295 |
/** @type {Config} */ |
| 22296 |
const config = { |
| 22297 |
transforms: [], |
| 22298 |
canContainEols: [ |
| 22299 |
"emphasis", |
| 22300 |
"fragment", |
| 22301 |
"heading", |
| 22302 |
"paragraph", |
| 22303 |
"strong" |
| 22304 |
], |
| 22305 |
enter: { |
| 22306 |
autolink: opener(link), |
| 22307 |
autolinkProtocol: onenterdata, |
| 22308 |
autolinkEmail: onenterdata, |
| 22309 |
atxHeading: opener(heading), |
| 22310 |
blockQuote: opener(blockQuote), |
| 22311 |
characterEscape: onenterdata, |
| 22312 |
characterReference: onenterdata, |
| 22313 |
codeFenced: opener(codeFlow), |
| 22314 |
codeFencedFenceInfo: buffer, |
| 22315 |
codeFencedFenceMeta: buffer, |
| 22316 |
codeIndented: opener(codeFlow, buffer), |
| 22317 |
codeText: opener(codeText, buffer), |
| 22318 |
codeTextData: onenterdata, |
| 22319 |
data: onenterdata, |
| 22320 |
codeFlowValue: onenterdata, |
| 22321 |
definition: opener(definition), |
| 22322 |
definitionDestinationString: buffer, |
| 22323 |
definitionLabelString: buffer, |
| 22324 |
definitionTitleString: buffer, |
| 22325 |
emphasis: opener(emphasis), |
| 22326 |
hardBreakEscape: opener(hardBreak), |
| 22327 |
hardBreakTrailing: opener(hardBreak), |
| 22328 |
htmlFlow: opener(html, buffer), |
| 22329 |
htmlFlowData: onenterdata, |
| 22330 |
htmlText: opener(html, buffer), |
| 22331 |
htmlTextData: onenterdata, |
| 22332 |
image: opener(image), |
| 22333 |
label: buffer, |
| 22334 |
link: opener(link), |
| 22335 |
listItem: opener(listItem), |
| 22336 |
listItemValue: onenterlistitemvalue, |
| 22337 |
listOrdered: opener(list, onenterlistordered), |
| 22338 |
listUnordered: opener(list), |
| 22339 |
paragraph: opener(paragraph), |
| 22340 |
reference: onenterreference, |
| 22341 |
referenceString: buffer, |
| 22342 |
resourceDestinationString: buffer, |
| 22343 |
resourceTitleString: buffer, |
| 22344 |
setextHeading: opener(heading), |
| 22345 |
strong: opener(strong), |
| 22346 |
thematicBreak: opener(thematicBreak) |
| 22347 |
}, |
| 22348 |
exit: { |
| 22349 |
atxHeading: closer(), |
| 22350 |
atxHeadingSequence: onexitatxheadingsequence, |
| 22351 |
autolink: closer(), |
| 22352 |
autolinkEmail: onexitautolinkemail, |
| 22353 |
autolinkProtocol: onexitautolinkprotocol, |
| 22354 |
blockQuote: closer(), |
| 22355 |
characterEscapeValue: onexitdata, |
| 22356 |
characterReferenceMarkerHexadecimal: onexitcharacterreferencemarker, |
| 22357 |
characterReferenceMarkerNumeric: onexitcharacterreferencemarker, |
| 22358 |
characterReferenceValue: onexitcharacterreferencevalue, |
| 22359 |
codeFenced: closer(onexitcodefenced), |
| 22360 |
codeFencedFence: onexitcodefencedfence, |
| 22361 |
codeFencedFenceInfo: onexitcodefencedfenceinfo, |
| 22362 |
codeFencedFenceMeta: onexitcodefencedfencemeta, |
| 22363 |
codeFlowValue: onexitdata, |
| 22364 |
codeIndented: closer(onexitcodeindented), |
| 22365 |
codeText: closer(onexitcodetext), |
| 22366 |
codeTextData: onexitdata, |
| 22367 |
data: onexitdata, |
| 22368 |
definition: closer(), |
| 22369 |
definitionDestinationString: onexitdefinitiondestinationstring, |
| 22370 |
definitionLabelString: onexitdefinitionlabelstring, |
| 22371 |
definitionTitleString: onexitdefinitiontitlestring, |
| 22372 |
emphasis: closer(), |
| 22373 |
hardBreakEscape: closer(onexithardbreak), |
| 22374 |
hardBreakTrailing: closer(onexithardbreak), |
| 22375 |
htmlFlow: closer(onexithtmlflow), |
| 22376 |
htmlFlowData: onexitdata, |
| 22377 |
htmlText: closer(onexithtmltext), |
| 22378 |
htmlTextData: onexitdata, |
| 22379 |
image: closer(onexitimage), |
| 22380 |
label: onexitlabel, |
| 22381 |
labelText: onexitlabeltext, |
| 22382 |
lineEnding: onexitlineending, |
| 22383 |
link: closer(onexitlink), |
| 22384 |
listItem: closer(), |
| 22385 |
listOrdered: closer(), |
| 22386 |
listUnordered: closer(), |
| 22387 |
paragraph: closer(), |
| 22388 |
referenceString: onexitreferencestring, |
| 22389 |
resourceDestinationString: onexitresourcedestinationstring, |
| 22390 |
resourceTitleString: onexitresourcetitlestring, |
| 22391 |
resource: onexitresource, |
| 22392 |
setextHeading: closer(onexitsetextheading), |
| 22393 |
setextHeadingLineSequence: onexitsetextheadinglinesequence, |
| 22394 |
setextHeadingText: onexitsetextheadingtext, |
| 22395 |
strong: closer(), |
| 22396 |
thematicBreak: closer() |
| 22397 |
} |
| 22398 |
}; |
| 22399 |
configure(config, (options || {}).mdastExtensions || []); |
| 22400 |
/** @type {CompileData} */ |
| 22401 |
const data = {}; |
| 22402 |
return compile; |
| 22403 |
/** |
| 22404 |
* Turn micromark events into an mdast tree. |
| 22405 |
* |
| 22406 |
* @param {Array<Event>} events |
| 22407 |
* Events. |
| 22408 |
* @returns {Root} |
| 22409 |
* mdast tree. |
| 22410 |
*/ |
| 22411 |
function compile(events) { |
| 22412 |
/** @type {Root} */ |
| 22413 |
let tree = { |
| 22414 |
type: "root", |
| 22415 |
children: [] |
| 22416 |
}; |
| 22417 |
/** @type {Omit<CompileContext, 'sliceSerialize'>} */ |
| 22418 |
const context = { |
| 22419 |
stack: [tree], |
| 22420 |
tokenStack: [], |
| 22421 |
config, |
| 22422 |
enter, |
| 22423 |
exit, |
| 22424 |
buffer, |
| 22425 |
resume, |
| 22426 |
setData, |
| 22427 |
getData |
| 22428 |
}; |
| 22429 |
/** @type {Array<number>} */ |
| 22430 |
const listStack = []; |
| 22431 |
let index = -1; |
| 22432 |
while (++index < events.length) if (events[index][1].type === "listOrdered" || events[index][1].type === "listUnordered") if (events[index][0] === "enter") listStack.push(index); |
| 22433 |
else index = prepareList(events, listStack.pop(), index); |
| 22434 |
index = -1; |
| 22435 |
while (++index < events.length) { |
| 22436 |
const handler = config[events[index][0]]; |
| 22437 |
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]); |
| 22438 |
} |
| 22439 |
if (context.tokenStack.length > 0) { |
| 22440 |
const tail = context.tokenStack[context.tokenStack.length - 1]; |
| 22441 |
(tail[1] || defaultOnError).call(context, void 0, tail[0]); |
| 22442 |
} |
| 22443 |
tree.position = { |
| 22444 |
start: point$1(events.length > 0 ? events[0][1].start : { |
| 22445 |
line: 1, |
| 22446 |
column: 1, |
| 22447 |
offset: 0 |
| 22448 |
}), |
| 22449 |
end: point$1(events.length > 0 ? events[events.length - 2][1].end : { |
| 22450 |
line: 1, |
| 22451 |
column: 1, |
| 22452 |
offset: 0 |
| 22453 |
}) |
| 22454 |
}; |
| 22455 |
index = -1; |
| 22456 |
while (++index < config.transforms.length) tree = config.transforms[index](tree) || tree; |
| 22457 |
return tree; |
| 22458 |
} |
| 22459 |
/** |
| 22460 |
* @param {Array<Event>} events |
| 22461 |
* @param {number} start |
| 22462 |
* @param {number} length |
| 22463 |
* @returns {number} |
| 22464 |
*/ |
| 22465 |
function prepareList(events, start, length) { |
| 22466 |
let index = start - 1; |
| 22467 |
let containerBalance = -1; |
| 22468 |
let listSpread = false; |
| 22469 |
/** @type {Token | undefined} */ |
| 22470 |
let listItem; |
| 22471 |
/** @type {number | undefined} */ |
| 22472 |
let lineIndex; |
| 22473 |
/** @type {number | undefined} */ |
| 22474 |
let firstBlankLineIndex; |
| 22475 |
/** @type {boolean | undefined} */ |
| 22476 |
let atMarker; |
| 22477 |
while (++index <= length) { |
| 22478 |
const event = events[index]; |
| 22479 |
if (event[1].type === "listUnordered" || event[1].type === "listOrdered" || event[1].type === "blockQuote") { |
| 22480 |
if (event[0] === "enter") containerBalance++; |
| 22481 |
else containerBalance--; |
| 22482 |
atMarker = void 0; |
| 22483 |
} else if (event[1].type === "lineEndingBlank") { |
| 22484 |
if (event[0] === "enter") { |
| 22485 |
if (listItem && !atMarker && !containerBalance && !firstBlankLineIndex) firstBlankLineIndex = index; |
| 22486 |
atMarker = void 0; |
| 22487 |
} |
| 22488 |
} 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; |
| 22489 |
if (!containerBalance && event[0] === "enter" && event[1].type === "listItemPrefix" || containerBalance === -1 && event[0] === "exit" && (event[1].type === "listUnordered" || event[1].type === "listOrdered")) { |
| 22490 |
if (listItem) { |
| 22491 |
let tailIndex = index; |
| 22492 |
lineIndex = void 0; |
| 22493 |
while (tailIndex--) { |
| 22494 |
const tailEvent = events[tailIndex]; |
| 22495 |
if (tailEvent[1].type === "lineEnding" || tailEvent[1].type === "lineEndingBlank") { |
| 22496 |
if (tailEvent[0] === "exit") continue; |
| 22497 |
if (lineIndex) { |
| 22498 |
events[lineIndex][1].type = "lineEndingBlank"; |
| 22499 |
listSpread = true; |
| 22500 |
} |
| 22501 |
tailEvent[1].type = "lineEnding"; |
| 22502 |
lineIndex = tailIndex; |
| 22503 |
} else if (tailEvent[1].type === "linePrefix" || tailEvent[1].type === "blockQuotePrefix" || tailEvent[1].type === "blockQuotePrefixWhitespace" || tailEvent[1].type === "blockQuoteMarker" || tailEvent[1].type === "listItemIndent") {} else break; |
| 22504 |
} |
| 22505 |
if (firstBlankLineIndex && (!lineIndex || firstBlankLineIndex < lineIndex)) listItem._spread = true; |
| 22506 |
listItem.end = Object.assign({}, lineIndex ? events[lineIndex][1].start : event[1].end); |
| 22507 |
events.splice(lineIndex || index, 0, [ |
| 22508 |
"exit", |
| 22509 |
listItem, |
| 22510 |
event[2] |
| 22511 |
]); |
| 22512 |
index++; |
| 22513 |
length++; |
| 22514 |
} |
| 22515 |
if (event[1].type === "listItemPrefix") { |
| 22516 |
listItem = { |
| 22517 |
type: "listItem", |
| 22518 |
_spread: false, |
| 22519 |
start: Object.assign({}, event[1].start), |
| 22520 |
end: void 0 |
| 22521 |
}; |
| 22522 |
events.splice(index, 0, [ |
| 22523 |
"enter", |
| 22524 |
listItem, |
| 22525 |
event[2] |
| 22526 |
]); |
| 22527 |
index++; |
| 22528 |
length++; |
| 22529 |
firstBlankLineIndex = void 0; |
| 22530 |
atMarker = true; |
| 22531 |
} |
| 22532 |
} |
| 22533 |
} |
| 22534 |
events[start][1]._spread = listSpread; |
| 22535 |
return length; |
| 22536 |
} |
| 22537 |
/** |
| 22538 |
* Set data. |
| 22539 |
* |
| 22540 |
* @template {keyof CompileData} Key |
| 22541 |
* Field type. |
| 22542 |
* @param {Key} key |
| 22543 |
* Key of field. |
| 22544 |
* @param {CompileData[Key]} [value] |
| 22545 |
* New value. |
| 22546 |
* @returns {void} |
| 22547 |
* Nothing. |
| 22548 |
*/ |
| 22549 |
function setData(key, value) { |
| 22550 |
data[key] = value; |
| 22551 |
} |
| 22552 |
/** |
| 22553 |
* Get data. |
| 22554 |
* |
| 22555 |
* @template {keyof CompileData} Key |
| 22556 |
* Field type. |
| 22557 |
* @param {Key} key |
| 22558 |
* Key of field. |
| 22559 |
* @returns {CompileData[Key]} |
| 22560 |
* Value. |
| 22561 |
*/ |
| 22562 |
function getData(key) { |
| 22563 |
return data[key]; |
| 22564 |
} |
| 22565 |
/** |
| 22566 |
* Create an opener handle. |
| 22567 |
* |
| 22568 |
* @param {(token: Token) => Node} create |
| 22569 |
* Create a node. |
| 22570 |
* @param {Handle} [and] |
| 22571 |
* Optional function to also run. |
| 22572 |
* @returns {Handle} |
| 22573 |
* Handle. |
| 22574 |
*/ |
| 22575 |
function opener(create, and) { |
| 22576 |
return open; |
| 22577 |
/** |
| 22578 |
* @this {CompileContext} |
| 22579 |
* @param {Token} token |
| 22580 |
* @returns {void} |
| 22581 |
*/ |
| 22582 |
function open(token) { |
| 22583 |
enter.call(this, create(token), token); |
| 22584 |
if (and) and.call(this, token); |
| 22585 |
} |
| 22586 |
} |
| 22587 |
/** |
| 22588 |
* @this {CompileContext} |
| 22589 |
* @returns {void} |
| 22590 |
*/ |
| 22591 |
function buffer() { |
| 22592 |
this.stack.push({ |
| 22593 |
type: "fragment", |
| 22594 |
children: [] |
| 22595 |
}); |
| 22596 |
} |
| 22597 |
/** |
| 22598 |
* @template {Node} Kind |
| 22599 |
* Node type. |
| 22600 |
* @this {CompileContext} |
| 22601 |
* Context. |
| 22602 |
* @param {Kind} node |
| 22603 |
* Node to enter. |
| 22604 |
* @param {Token} token |
| 22605 |
* Corresponding token. |
| 22606 |
* @param {OnEnterError | undefined} [errorHandler] |
| 22607 |
* Handle the case where this token is open, but it is closed by something else. |
| 22608 |
* @returns {Kind} |
| 22609 |
* The given node. |
| 22610 |
*/ |
| 22611 |
function enter(node, token, errorHandler) { |
| 22612 |
this.stack[this.stack.length - 1].children.push(node); |
| 22613 |
this.stack.push(node); |
| 22614 |
this.tokenStack.push([token, errorHandler]); |
| 22615 |
node.position = { start: point$1(token.start) }; |
| 22616 |
return node; |
| 22617 |
} |
| 22618 |
/** |
| 22619 |
* Create a closer handle. |
| 22620 |
* |
| 22621 |
* @param {Handle} [and] |
| 22622 |
* Optional function to also run. |
| 22623 |
* @returns {Handle} |
| 22624 |
* Handle. |
| 22625 |
*/ |
| 22626 |
function closer(and) { |
| 22627 |
return close; |
| 22628 |
/** |
| 22629 |
* @this {CompileContext} |
| 22630 |
* @param {Token} token |
| 22631 |
* @returns {void} |
| 22632 |
*/ |
| 22633 |
function close(token) { |
| 22634 |
if (and) and.call(this, token); |
| 22635 |
exit.call(this, token); |
| 22636 |
} |
| 22637 |
} |
| 22638 |
/** |
| 22639 |
* @this {CompileContext} |
| 22640 |
* Context. |
| 22641 |
* @param {Token} token |
| 22642 |
* Corresponding token. |
| 22643 |
* @param {OnExitError | undefined} [onExitError] |
| 22644 |
* Handle the case where another token is open. |
| 22645 |
* @returns {Node} |
| 22646 |
* The closed node. |
| 22647 |
*/ |
| 22648 |
function exit(token, onExitError) { |
| 22649 |
const node = this.stack.pop(); |
| 22650 |
const open = this.tokenStack.pop(); |
| 22651 |
if (!open) throw new Error("Cannot close `" + token.type + "` (" + stringifyPosition({ |
| 22652 |
start: token.start, |
| 22653 |
end: token.end |
| 22654 |
}) + "): it’s not open"); |
| 22655 |
else if (open[0].type !== token.type) if (onExitError) onExitError.call(this, token, open[0]); |
| 22656 |
else (open[1] || defaultOnError).call(this, token, open[0]); |
| 22657 |
node.position.end = point$1(token.end); |
| 22658 |
return node; |
| 22659 |
} |
| 22660 |
/** |
| 22661 |
* @this {CompileContext} |
| 22662 |
* @returns {string} |
| 22663 |
*/ |
| 22664 |
function resume() { |
| 22665 |
return toString(this.stack.pop()); |
| 22666 |
} |
| 22667 |
/** |
| 22668 |
* @this {CompileContext} |
| 22669 |
* @type {Handle} |
| 22670 |
*/ |
| 22671 |
function onenterlistordered() { |
| 22672 |
setData("expectingFirstListItemValue", true); |
| 22673 |
} |
| 22674 |
/** |
| 22675 |
* @this {CompileContext} |
| 22676 |
* @type {Handle} |
| 22677 |
*/ |
| 22678 |
function onenterlistitemvalue(token) { |
| 22679 |
if (getData("expectingFirstListItemValue")) { |
| 22680 |
const ancestor = this.stack[this.stack.length - 2]; |
| 22681 |
ancestor.start = Number.parseInt(this.sliceSerialize(token), 10); |
| 22682 |
setData("expectingFirstListItemValue"); |
| 22683 |
} |
| 22684 |
} |
| 22685 |
/** |
| 22686 |
* @this {CompileContext} |
| 22687 |
* @type {Handle} |
| 22688 |
*/ |
| 22689 |
function onexitcodefencedfenceinfo() { |
| 22690 |
const data = this.resume(); |
| 22691 |
const node = this.stack[this.stack.length - 1]; |
| 22692 |
node.lang = data; |
| 22693 |
} |
| 22694 |
/** |
| 22695 |
* @this {CompileContext} |
| 22696 |
* @type {Handle} |
| 22697 |
*/ |
| 22698 |
function onexitcodefencedfencemeta() { |
| 22699 |
const data = this.resume(); |
| 22700 |
const node = this.stack[this.stack.length - 1]; |
| 22701 |
node.meta = data; |
| 22702 |
} |
| 22703 |
/** |
| 22704 |
* @this {CompileContext} |
| 22705 |
* @type {Handle} |
| 22706 |
*/ |
| 22707 |
function onexitcodefencedfence() { |
| 22708 |
if (getData("flowCodeInside")) return; |
| 22709 |
this.buffer(); |
| 22710 |
setData("flowCodeInside", true); |
| 22711 |
} |
| 22712 |
/** |
| 22713 |
* @this {CompileContext} |
| 22714 |
* @type {Handle} |
| 22715 |
*/ |
| 22716 |
function onexitcodefenced() { |
| 22717 |
const data = this.resume(); |
| 22718 |
const node = this.stack[this.stack.length - 1]; |
| 22719 |
node.value = data.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g, ""); |
| 22720 |
setData("flowCodeInside"); |
| 22721 |
} |
| 22722 |
/** |
| 22723 |
* @this {CompileContext} |
| 22724 |
* @type {Handle} |
| 22725 |
*/ |
| 22726 |
function onexitcodeindented() { |
| 22727 |
const data = this.resume(); |
| 22728 |
const node = this.stack[this.stack.length - 1]; |
| 22729 |
node.value = data.replace(/(\r?\n|\r)$/g, ""); |
| 22730 |
} |
| 22731 |
/** |
| 22732 |
* @this {CompileContext} |
| 22733 |
* @type {Handle} |
| 22734 |
*/ |
| 22735 |
function onexitdefinitionlabelstring(token) { |
| 22736 |
const label = this.resume(); |
| 22737 |
const node = this.stack[this.stack.length - 1]; |
| 22738 |
node.label = label; |
| 22739 |
node.identifier = normalizeIdentifier(this.sliceSerialize(token)).toLowerCase(); |
| 22740 |
} |
| 22741 |
/** |
| 22742 |
* @this {CompileContext} |
| 22743 |
* @type {Handle} |
| 22744 |
*/ |
| 22745 |
function onexitdefinitiontitlestring() { |
| 22746 |
const data = this.resume(); |
| 22747 |
const node = this.stack[this.stack.length - 1]; |
| 22748 |
node.title = data; |
| 22749 |
} |
| 22750 |
/** |
| 22751 |
* @this {CompileContext} |
| 22752 |
* @type {Handle} |
| 22753 |
*/ |
| 22754 |
function onexitdefinitiondestinationstring() { |
| 22755 |
const data = this.resume(); |
| 22756 |
const node = this.stack[this.stack.length - 1]; |
| 22757 |
node.url = data; |
| 22758 |
} |
| 22759 |
/** |
| 22760 |
* @this {CompileContext} |
| 22761 |
* @type {Handle} |
| 22762 |
*/ |
| 22763 |
function onexitatxheadingsequence(token) { |
| 22764 |
const node = this.stack[this.stack.length - 1]; |
| 22765 |
if (!node.depth) node.depth = this.sliceSerialize(token).length; |
| 22766 |
} |
| 22767 |
/** |
| 22768 |
* @this {CompileContext} |
| 22769 |
* @type {Handle} |
| 22770 |
*/ |
| 22771 |
function onexitsetextheadingtext() { |
| 22772 |
setData("setextHeadingSlurpLineEnding", true); |
| 22773 |
} |
| 22774 |
/** |
| 22775 |
* @this {CompileContext} |
| 22776 |
* @type {Handle} |
| 22777 |
*/ |
| 22778 |
function onexitsetextheadinglinesequence(token) { |
| 22779 |
const node = this.stack[this.stack.length - 1]; |
| 22780 |
node.depth = this.sliceSerialize(token).charCodeAt(0) === 61 ? 1 : 2; |
| 22781 |
} |
| 22782 |
/** |
| 22783 |
* @this {CompileContext} |
| 22784 |
* @type {Handle} |
| 22785 |
*/ |
| 22786 |
function onexitsetextheading() { |
| 22787 |
setData("setextHeadingSlurpLineEnding"); |
| 22788 |
} |
| 22789 |
/** |
| 22790 |
* @this {CompileContext} |
| 22791 |
* @type {Handle} |
| 22792 |
*/ |
| 22793 |
function onenterdata(token) { |
| 22794 |
const node = this.stack[this.stack.length - 1]; |
| 22795 |
let tail = node.children[node.children.length - 1]; |
| 22796 |
if (!tail || tail.type !== "text") { |
| 22797 |
tail = text(); |
| 22798 |
tail.position = { start: point$1(token.start) }; |
| 22799 |
node.children.push(tail); |
| 22800 |
} |
| 22801 |
this.stack.push(tail); |
| 22802 |
} |
| 22803 |
/** |
| 22804 |
* @this {CompileContext} |
| 22805 |
* @type {Handle} |
| 22806 |
*/ |
| 22807 |
function onexitdata(token) { |
| 22808 |
const tail = this.stack.pop(); |
| 22809 |
tail.value += this.sliceSerialize(token); |
| 22810 |
tail.position.end = point$1(token.end); |
| 22811 |
} |
| 22812 |
/** |
| 22813 |
* @this {CompileContext} |
| 22814 |
* @type {Handle} |
| 22815 |
*/ |
| 22816 |
function onexitlineending(token) { |
| 22817 |
const context = this.stack[this.stack.length - 1]; |
| 22818 |
if (getData("atHardBreak")) { |
| 22819 |
const tail = context.children[context.children.length - 1]; |
| 22820 |
tail.position.end = point$1(token.end); |
| 22821 |
setData("atHardBreak"); |
| 22822 |
return; |
| 22823 |
} |
| 22824 |
if (!getData("setextHeadingSlurpLineEnding") && config.canContainEols.includes(context.type)) { |
| 22825 |
onenterdata.call(this, token); |
| 22826 |
onexitdata.call(this, token); |
| 22827 |
} |
| 22828 |
} |
| 22829 |
/** |
| 22830 |
* @this {CompileContext} |
| 22831 |
* @type {Handle} |
| 22832 |
*/ |
| 22833 |
function onexithardbreak() { |
| 22834 |
setData("atHardBreak", true); |
| 22835 |
} |
| 22836 |
/** |
| 22837 |
* @this {CompileContext} |
| 22838 |
* @type {Handle} |
| 22839 |
*/ |
| 22840 |
function onexithtmlflow() { |
| 22841 |
const data = this.resume(); |
| 22842 |
const node = this.stack[this.stack.length - 1]; |
| 22843 |
node.value = data; |
| 22844 |
} |
| 22845 |
/** |
| 22846 |
* @this {CompileContext} |
| 22847 |
* @type {Handle} |
| 22848 |
*/ |
| 22849 |
function onexithtmltext() { |
| 22850 |
const data = this.resume(); |
| 22851 |
const node = this.stack[this.stack.length - 1]; |
| 22852 |
node.value = data; |
| 22853 |
} |
| 22854 |
/** |
| 22855 |
* @this {CompileContext} |
| 22856 |
* @type {Handle} |
| 22857 |
*/ |
| 22858 |
function onexitcodetext() { |
| 22859 |
const data = this.resume(); |
| 22860 |
const node = this.stack[this.stack.length - 1]; |
| 22861 |
node.value = data; |
| 22862 |
} |
| 22863 |
/** |
| 22864 |
* @this {CompileContext} |
| 22865 |
* @type {Handle} |
| 22866 |
*/ |
| 22867 |
function onexitlink() { |
| 22868 |
const node = this.stack[this.stack.length - 1]; |
| 22869 |
if (getData("inReference")) { |
| 22870 |
/** @type {ReferenceType} */ |
| 22871 |
const referenceType = getData("referenceType") || "shortcut"; |
| 22872 |
node.type += "Reference"; |
| 22873 |
node.referenceType = referenceType; |
| 22874 |
delete node.url; |
| 22875 |
delete node.title; |
| 22876 |
} else { |
| 22877 |
delete node.identifier; |
| 22878 |
delete node.label; |
| 22879 |
} |
| 22880 |
setData("referenceType"); |
| 22881 |
} |
| 22882 |
/** |
| 22883 |
* @this {CompileContext} |
| 22884 |
* @type {Handle} |
| 22885 |
*/ |
| 22886 |
function onexitimage() { |
| 22887 |
const node = this.stack[this.stack.length - 1]; |
| 22888 |
if (getData("inReference")) { |
| 22889 |
/** @type {ReferenceType} */ |
| 22890 |
const referenceType = getData("referenceType") || "shortcut"; |
| 22891 |
node.type += "Reference"; |
| 22892 |
node.referenceType = referenceType; |
| 22893 |
delete node.url; |
| 22894 |
delete node.title; |
| 22895 |
} else { |
| 22896 |
delete node.identifier; |
| 22897 |
delete node.label; |
| 22898 |
} |
| 22899 |
setData("referenceType"); |
| 22900 |
} |
| 22901 |
/** |
| 22902 |
* @this {CompileContext} |
| 22903 |
* @type {Handle} |
| 22904 |
*/ |
| 22905 |
function onexitlabeltext(token) { |
| 22906 |
const string = this.sliceSerialize(token); |
| 22907 |
const ancestor = this.stack[this.stack.length - 2]; |
| 22908 |
ancestor.label = decodeString(string); |
| 22909 |
ancestor.identifier = normalizeIdentifier(string).toLowerCase(); |
| 22910 |
} |
| 22911 |
/** |
| 22912 |
* @this {CompileContext} |
| 22913 |
* @type {Handle} |
| 22914 |
*/ |
| 22915 |
function onexitlabel() { |
| 22916 |
const fragment = this.stack[this.stack.length - 1]; |
| 22917 |
const value = this.resume(); |
| 22918 |
const node = this.stack[this.stack.length - 1]; |
| 22919 |
setData("inReference", true); |
| 22920 |
if (node.type === "link") node.children = fragment.children; |
| 22921 |
else node.alt = value; |
| 22922 |
} |
| 22923 |
/** |
| 22924 |
* @this {CompileContext} |
| 22925 |
* @type {Handle} |
| 22926 |
*/ |
| 22927 |
function onexitresourcedestinationstring() { |
| 22928 |
const data = this.resume(); |
| 22929 |
const node = this.stack[this.stack.length - 1]; |
| 22930 |
node.url = data; |
| 22931 |
} |
| 22932 |
/** |
| 22933 |
* @this {CompileContext} |
| 22934 |
* @type {Handle} |
| 22935 |
*/ |
| 22936 |
function onexitresourcetitlestring() { |
| 22937 |
const data = this.resume(); |
| 22938 |
const node = this.stack[this.stack.length - 1]; |
| 22939 |
node.title = data; |
| 22940 |
} |
| 22941 |
/** |
| 22942 |
* @this {CompileContext} |
| 22943 |
* @type {Handle} |
| 22944 |
*/ |
| 22945 |
function onexitresource() { |
| 22946 |
setData("inReference"); |
| 22947 |
} |
| 22948 |
/** |
| 22949 |
* @this {CompileContext} |
| 22950 |
* @type {Handle} |
| 22951 |
*/ |
| 22952 |
function onenterreference() { |
| 22953 |
setData("referenceType", "collapsed"); |
| 22954 |
} |
| 22955 |
/** |
| 22956 |
* @this {CompileContext} |
| 22957 |
* @type {Handle} |
| 22958 |
*/ |
| 22959 |
function onexitreferencestring(token) { |
| 22960 |
const label = this.resume(); |
| 22961 |
const node = this.stack[this.stack.length - 1]; |
| 22962 |
node.label = label; |
| 22963 |
node.identifier = normalizeIdentifier(this.sliceSerialize(token)).toLowerCase(); |
| 22964 |
setData("referenceType", "full"); |
| 22965 |
} |
| 22966 |
/** |
| 22967 |
* @this {CompileContext} |
| 22968 |
* @type {Handle} |
| 22969 |
*/ |
| 22970 |
function onexitcharacterreferencemarker(token) { |
| 22971 |
setData("characterReferenceType", token.type); |
| 22972 |
} |
| 22973 |
/** |
| 22974 |
* @this {CompileContext} |
| 22975 |
* @type {Handle} |
| 22976 |
*/ |
| 22977 |
function onexitcharacterreferencevalue(token) { |
| 22978 |
const data = this.sliceSerialize(token); |
| 22979 |
const type = getData("characterReferenceType"); |
| 22980 |
/** @type {string} */ |
| 22981 |
let value; |
| 22982 |
if (type) { |
| 22983 |
value = decodeNumericCharacterReference(data, type === "characterReferenceMarkerNumeric" ? 10 : 16); |
| 22984 |
setData("characterReferenceType"); |
| 22985 |
} else value = decodeNamedCharacterReference(data); |
| 22986 |
const tail = this.stack.pop(); |
| 22987 |
tail.value += value; |
| 22988 |
tail.position.end = point$1(token.end); |
| 22989 |
} |
| 22990 |
/** |
| 22991 |
* @this {CompileContext} |
| 22992 |
* @type {Handle} |
| 22993 |
*/ |
| 22994 |
function onexitautolinkprotocol(token) { |
| 22995 |
onexitdata.call(this, token); |
| 22996 |
const node = this.stack[this.stack.length - 1]; |
| 22997 |
node.url = this.sliceSerialize(token); |
| 22998 |
} |
| 22999 |
/** |
| 23000 |
* @this {CompileContext} |
| 23001 |
* @type {Handle} |
| 23002 |
*/ |
| 23003 |
function onexitautolinkemail(token) { |
| 23004 |
onexitdata.call(this, token); |
| 23005 |
const node = this.stack[this.stack.length - 1]; |
| 23006 |
node.url = "mailto:" + this.sliceSerialize(token); |
| 23007 |
} |
| 23008 |
/** @returns {Blockquote} */ |
| 23009 |
function blockQuote() { |
| 23010 |
return { |
| 23011 |
type: "blockquote", |
| 23012 |
children: [] |
| 23013 |
}; |
| 23014 |
} |
| 23015 |
/** @returns {Code} */ |
| 23016 |
function codeFlow() { |
| 23017 |
return { |
| 23018 |
type: "code", |
| 23019 |
lang: null, |
| 23020 |
meta: null, |
| 23021 |
value: "" |
| 23022 |
}; |
| 23023 |
} |
| 23024 |
/** @returns {InlineCode} */ |
| 23025 |
function codeText() { |
| 23026 |
return { |
| 23027 |
type: "inlineCode", |
| 23028 |
value: "" |
| 23029 |
}; |
| 23030 |
} |
| 23031 |
/** @returns {Definition} */ |
| 23032 |
function definition() { |
| 23033 |
return { |
| 23034 |
type: "definition", |
| 23035 |
identifier: "", |
| 23036 |
label: null, |
| 23037 |
title: null, |
| 23038 |
url: "" |
| 23039 |
}; |
| 23040 |
} |
| 23041 |
/** @returns {Emphasis} */ |
| 23042 |
function emphasis() { |
| 23043 |
return { |
| 23044 |
type: "emphasis", |
| 23045 |
children: [] |
| 23046 |
}; |
| 23047 |
} |
| 23048 |
/** @returns {Heading} */ |
| 23049 |
function heading() { |
| 23050 |
return { |
| 23051 |
type: "heading", |
| 23052 |
depth: void 0, |
| 23053 |
children: [] |
| 23054 |
}; |
| 23055 |
} |
| 23056 |
/** @returns {Break} */ |
| 23057 |
function hardBreak() { |
| 23058 |
return { type: "break" }; |
| 23059 |
} |
| 23060 |
/** @returns {HTML} */ |
| 23061 |
function html() { |
| 23062 |
return { |
| 23063 |
type: "html", |
| 23064 |
value: "" |
| 23065 |
}; |
| 23066 |
} |
| 23067 |
/** @returns {Image} */ |
| 23068 |
function image() { |
| 23069 |
return { |
| 23070 |
type: "image", |
| 23071 |
title: null, |
| 23072 |
url: "", |
| 23073 |
alt: null |
| 23074 |
}; |
| 23075 |
} |
| 23076 |
/** @returns {Link} */ |
| 23077 |
function link() { |
| 23078 |
return { |
| 23079 |
type: "link", |
| 23080 |
title: null, |
| 23081 |
url: "", |
| 23082 |
children: [] |
| 23083 |
}; |
| 23084 |
} |
| 23085 |
/** |
| 23086 |
* @param {Token} token |
| 23087 |
* @returns {List} |
| 23088 |
*/ |
| 23089 |
function list(token) { |
| 23090 |
return { |
| 23091 |
type: "list", |
| 23092 |
ordered: token.type === "listOrdered", |
| 23093 |
start: null, |
| 23094 |
spread: token._spread, |
| 23095 |
children: [] |
| 23096 |
}; |
| 23097 |
} |
| 23098 |
/** |
| 23099 |
* @param {Token} token |
| 23100 |
* @returns {ListItem} |
| 23101 |
*/ |
| 23102 |
function listItem(token) { |
| 23103 |
return { |
| 23104 |
type: "listItem", |
| 23105 |
spread: token._spread, |
| 23106 |
checked: null, |
| 23107 |
children: [] |
| 23108 |
}; |
| 23109 |
} |
| 23110 |
/** @returns {Paragraph} */ |
| 23111 |
function paragraph() { |
| 23112 |
return { |
| 23113 |
type: "paragraph", |
| 23114 |
children: [] |
| 23115 |
}; |
| 23116 |
} |
| 23117 |
/** @returns {Strong} */ |
| 23118 |
function strong() { |
| 23119 |
return { |
| 23120 |
type: "strong", |
| 23121 |
children: [] |
| 23122 |
}; |
| 23123 |
} |
| 23124 |
/** @returns {Text} */ |
| 23125 |
function text() { |
| 23126 |
return { |
| 23127 |
type: "text", |
| 23128 |
value: "" |
| 23129 |
}; |
| 23130 |
} |
| 23131 |
/** @returns {ThematicBreak} */ |
| 23132 |
function thematicBreak() { |
| 23133 |
return { type: "thematicBreak" }; |
| 23134 |
} |
| 23135 |
} |
| 23136 |
/** |
| 23137 |
* Copy a point-like value. |
| 23138 |
* |
| 23139 |
* @param {Point} d |
| 23140 |
* Point-like value. |
| 23141 |
* @returns {Point} |
| 23142 |
* unist point. |
| 23143 |
*/ |
| 23144 |
function point$1(d) { |
| 23145 |
return { |
| 23146 |
line: d.line, |
| 23147 |
column: d.column, |
| 23148 |
offset: d.offset |
| 23149 |
}; |
| 23150 |
} |
| 23151 |
/** |
| 23152 |
* @param {Config} combined |
| 23153 |
* @param {Array<Extension | Array<Extension>>} extensions |
| 23154 |
* @returns {void} |
| 23155 |
*/ |
| 23156 |
function configure(combined, extensions) { |
| 23157 |
let index = -1; |
| 23158 |
while (++index < extensions.length) { |
| 23159 |
const value = extensions[index]; |
| 23160 |
if (Array.isArray(value)) configure(combined, value); |
| 23161 |
else extension(combined, value); |
| 23162 |
} |
| 23163 |
} |
| 23164 |
/** |
| 23165 |
* @param {Config} combined |
| 23166 |
* @param {Extension} extension |
| 23167 |
* @returns {void} |
| 23168 |
*/ |
| 23169 |
function extension(combined, extension) { |
| 23170 |
/** @type {keyof Extension} */ |
| 23171 |
let key; |
| 23172 |
for (key in extension) if (own$5.call(extension, key)) { |
| 23173 |
if (key === "canContainEols") { |
| 23174 |
const right = extension[key]; |
| 23175 |
if (right) combined[key].push(...right); |
| 23176 |
} else if (key === "transforms") { |
| 23177 |
const right = extension[key]; |
| 23178 |
if (right) combined[key].push(...right); |
| 23179 |
} else if (key === "enter" || key === "exit") { |
| 23180 |
const right = extension[key]; |
| 23181 |
if (right) Object.assign(combined[key], right); |
| 23182 |
} |
| 23183 |
} |
| 23184 |
} |
| 23185 |
/** @type {OnEnterError} */ |
| 23186 |
function defaultOnError(left, right) { |
| 23187 |
if (left) throw new Error("Cannot close `" + left.type + "` (" + stringifyPosition({ |
| 23188 |
start: left.start, |
| 23189 |
end: left.end |
| 23190 |
}) + "): a different token (`" + right.type + "`, " + stringifyPosition({ |
| 23191 |
start: right.start, |
| 23192 |
end: right.end |
| 23193 |
}) + ") is open"); |
| 23194 |
else throw new Error("Cannot close document, a token (`" + right.type + "`, " + stringifyPosition({ |
| 23195 |
start: right.start, |
| 23196 |
end: right.end |
| 23197 |
}) + ") is still open"); |
| 23198 |
} |
| 23199 |
var own$5, fromMarkdown; |
| 23200 |
var init_lib$9 = __esmMin((() => { |
| 23201 |
init_mdast_util_to_string(); |
| 23202 |
init_parse(); |
| 23203 |
init_preprocess(); |
| 23204 |
init_postprocess(); |
| 23205 |
init_micromark_util_decode_numeric_character_reference(); |
| 23206 |
init_micromark_util_decode_string(); |
| 23207 |
init_micromark_util_normalize_identifier(); |
| 23208 |
init_index_dom(); |
| 23209 |
init_unist_util_stringify_position(); |
| 23210 |
own$5 = {}.hasOwnProperty; |
| 23211 |
fromMarkdown = function(value, encoding, options) { |
| 23212 |
if (typeof encoding !== "string") { |
| 23213 |
options = encoding; |
| 23214 |
encoding = void 0; |
| 23215 |
} |
| 23216 |
return compiler(options)(postprocess(parse(options).document().write(preprocess()(value, encoding, true)))); |
| 23217 |
}; |
| 23218 |
__name(point$1, "point"); |
| 23219 |
})); |
| 23220 |
|
| 23221 |
//#endregion |
| 23222 |
//#region node_modules/mdast-util-from-markdown/index.js |
| 23223 |
var init_mdast_util_from_markdown = __esmMin((() => { |
| 23224 |
init_lib$9(); |
| 23225 |
})); |
| 23226 |
|
| 23227 |
//#endregion |
| 23228 |
//#region node_modules/remark-parse/lib/index.js |
| 23229 |
/** |
| 23230 |
* @this {import('unified').Processor} |
| 23231 |
* @type {import('unified').Plugin<[Options?] | void[], string, Root>} |
| 23232 |
*/ |
| 23233 |
function remarkParse(options) { |
| 23234 |
/** @type {import('unified').ParserFunction<Root>} */ |
| 23235 |
const parser = (doc) => { |
| 23236 |
const settings = this.data("settings"); |
| 23237 |
return fromMarkdown(doc, Object.assign({}, settings, options, { |
| 23238 |
extensions: this.data("micromarkExtensions") || [], |
| 23239 |
mdastExtensions: this.data("fromMarkdownExtensions") || [] |
| 23240 |
})); |
| 23241 |
}; |
| 23242 |
Object.assign(this, { Parser: parser }); |
| 23243 |
} |
| 23244 |
var init_lib$8 = __esmMin((() => { |
| 23245 |
init_mdast_util_from_markdown(); |
| 23246 |
})); |
| 23247 |
|
| 23248 |
//#endregion |
| 23249 |
//#region node_modules/remark-parse/index.js |
| 23250 |
var init_remark_parse = __esmMin((() => { |
| 23251 |
init_lib$8(); |
| 23252 |
})); |
| 23253 |
|
| 23254 |
//#endregion |
| 23255 |
//#region node_modules/mdast-util-to-hast/lib/handlers/blockquote.js |
| 23256 |
/** |
| 23257 |
* @typedef {import('hast').Element} Element |
| 23258 |
* @typedef {import('mdast').Blockquote} Blockquote |
| 23259 |
* @typedef {import('../state.js').State} State |
| 23260 |
*/ |
| 23261 |
/** |
| 23262 |
* Turn an mdast `blockquote` node into hast. |
| 23263 |
* |
| 23264 |
* @param {State} state |
| 23265 |
* Info passed around. |
| 23266 |
* @param {Blockquote} node |
| 23267 |
* mdast node. |
| 23268 |
* @returns {Element} |
| 23269 |
* hast node. |
| 23270 |
*/ |
| 23271 |
function blockquote(state, node) { |
| 23272 |
/** @type {Element} */ |
| 23273 |
const result = { |
| 23274 |
type: "element", |
| 23275 |
tagName: "blockquote", |
| 23276 |
properties: {}, |
| 23277 |
children: state.wrap(state.all(node), true) |
| 23278 |
}; |
| 23279 |
state.patch(node, result); |
| 23280 |
return state.applyData(node, result); |
| 23281 |
} |
| 23282 |
var init_blockquote = __esmMin((() => {})); |
| 23283 |
|
| 23284 |
//#endregion |
| 23285 |
//#region node_modules/mdast-util-to-hast/lib/handlers/break.js |
| 23286 |
/** |
| 23287 |
* @typedef {import('hast').Element} Element |
| 23288 |
* @typedef {import('hast').Text} Text |
| 23289 |
* @typedef {import('mdast').Break} Break |
| 23290 |
* @typedef {import('../state.js').State} State |
| 23291 |
*/ |
| 23292 |
/** |
| 23293 |
* Turn an mdast `break` node into hast. |
| 23294 |
* |
| 23295 |
* @param {State} state |
| 23296 |
* Info passed around. |
| 23297 |
* @param {Break} node |
| 23298 |
* mdast node. |
| 23299 |
* @returns {Array<Element | Text>} |
| 23300 |
* hast element content. |
| 23301 |
*/ |
| 23302 |
function hardBreak(state, node) { |
| 23303 |
/** @type {Element} */ |
| 23304 |
const result = { |
| 23305 |
type: "element", |
| 23306 |
tagName: "br", |
| 23307 |
properties: {}, |
| 23308 |
children: [] |
| 23309 |
}; |
| 23310 |
state.patch(node, result); |
| 23311 |
return [state.applyData(node, result), { |
| 23312 |
type: "text", |
| 23313 |
value: "\n" |
| 23314 |
}]; |
| 23315 |
} |
| 23316 |
var init_break = __esmMin((() => {})); |
| 23317 |
|
| 23318 |
//#endregion |
| 23319 |
//#region node_modules/mdast-util-to-hast/lib/handlers/code.js |
| 23320 |
/** |
| 23321 |
* @typedef {import('hast').Element} Element |
| 23322 |
* @typedef {import('hast').Properties} Properties |
| 23323 |
* @typedef {import('mdast').Code} Code |
| 23324 |
* @typedef {import('../state.js').State} State |
| 23325 |
|
| 23326 |
*/ |
| 23327 |
/** |
| 23328 |
* Turn an mdast `code` node into hast. |
| 23329 |
* |
| 23330 |
* @param {State} state |
| 23331 |
* Info passed around. |
| 23332 |
* @param {Code} node |
| 23333 |
* mdast node. |
| 23334 |
* @returns {Element} |
| 23335 |
* hast node. |
| 23336 |
*/ |
| 23337 |
function code(state, node) { |
| 23338 |
const value = node.value ? node.value + "\n" : ""; |
| 23339 |
const lang = node.lang ? node.lang.match(/^[^ \t]+(?=[ \t]|$)/) : null; |
| 23340 |
/** @type {Properties} */ |
| 23341 |
const properties = {}; |
| 23342 |
if (lang) properties.className = ["language-" + lang]; |
| 23343 |
/** @type {Element} */ |
| 23344 |
let result = { |
| 23345 |
type: "element", |
| 23346 |
tagName: "code", |
| 23347 |
properties, |
| 23348 |
children: [{ |
| 23349 |
type: "text", |
| 23350 |
value |
| 23351 |
}] |
| 23352 |
}; |
| 23353 |
if (node.meta) result.data = { meta: node.meta }; |
| 23354 |
state.patch(node, result); |
| 23355 |
result = state.applyData(node, result); |
| 23356 |
result = { |
| 23357 |
type: "element", |
| 23358 |
tagName: "pre", |
| 23359 |
properties: {}, |
| 23360 |
children: [result] |
| 23361 |
}; |
| 23362 |
state.patch(node, result); |
| 23363 |
return result; |
| 23364 |
} |
| 23365 |
var init_code = __esmMin((() => {})); |
| 23366 |
|
| 23367 |
//#endregion |
| 23368 |
//#region node_modules/mdast-util-to-hast/lib/handlers/delete.js |
| 23369 |
/** |
| 23370 |
* @typedef {import('hast').Element} Element |
| 23371 |
* @typedef {import('mdast').Delete} Delete |
| 23372 |
* @typedef {import('../state.js').State} State |
| 23373 |
|
| 23374 |
*/ |
| 23375 |
/** |
| 23376 |
* Turn an mdast `delete` node into hast. |
| 23377 |
* |
| 23378 |
* @param {State} state |
| 23379 |
* Info passed around. |
| 23380 |
* @param {Delete} node |
| 23381 |
* mdast node. |
| 23382 |
* @returns {Element} |
| 23383 |
* hast node. |
| 23384 |
*/ |
| 23385 |
function strikethrough(state, node) { |
| 23386 |
/** @type {Element} */ |
| 23387 |
const result = { |
| 23388 |
type: "element", |
| 23389 |
tagName: "del", |
| 23390 |
properties: {}, |
| 23391 |
children: state.all(node) |
| 23392 |
}; |
| 23393 |
state.patch(node, result); |
| 23394 |
return state.applyData(node, result); |
| 23395 |
} |
| 23396 |
var init_delete = __esmMin((() => {})); |
| 23397 |
|
| 23398 |
//#endregion |
| 23399 |
//#region node_modules/mdast-util-to-hast/lib/handlers/emphasis.js |
| 23400 |
/** |
| 23401 |
* @typedef {import('hast').Element} Element |
| 23402 |
* @typedef {import('mdast').Emphasis} Emphasis |
| 23403 |
* @typedef {import('../state.js').State} State |
| 23404 |
*/ |
| 23405 |
/** |
| 23406 |
* Turn an mdast `emphasis` node into hast. |
| 23407 |
* |
| 23408 |
* @param {State} state |
| 23409 |
* Info passed around. |
| 23410 |
* @param {Emphasis} node |
| 23411 |
* mdast node. |
| 23412 |
* @returns {Element} |
| 23413 |
* hast node. |
| 23414 |
*/ |
| 23415 |
function emphasis(state, node) { |
| 23416 |
/** @type {Element} */ |
| 23417 |
const result = { |
| 23418 |
type: "element", |
| 23419 |
tagName: "em", |
| 23420 |
properties: {}, |
| 23421 |
children: state.all(node) |
| 23422 |
}; |
| 23423 |
state.patch(node, result); |
| 23424 |
return state.applyData(node, result); |
| 23425 |
} |
| 23426 |
var init_emphasis = __esmMin((() => {})); |
| 23427 |
|
| 23428 |
//#endregion |
| 23429 |
//#region node_modules/micromark-util-sanitize-uri/index.js |
| 23430 |
/** |
| 23431 |
* Normalize a URL. |
| 23432 |
* |
| 23433 |
* Encode unsafe characters with percent-encoding, skipping already encoded |
| 23434 |
* sequences. |
| 23435 |
* |
| 23436 |
* @param {string} value |
| 23437 |
* URI to normalize. |
| 23438 |
* @returns {string} |
| 23439 |
* Normalized URI. |
| 23440 |
*/ |
| 23441 |
function normalizeUri(value) { |
| 23442 |
/** @type {Array<string>} */ |
| 23443 |
const result = []; |
| 23444 |
let index = -1; |
| 23445 |
let start = 0; |
| 23446 |
let skip = 0; |
| 23447 |
while (++index < value.length) { |
| 23448 |
const code = value.charCodeAt(index); |
| 23449 |
/** @type {string} */ |
| 23450 |
let replace = ""; |
| 23451 |
if (code === 37 && asciiAlphanumeric(value.charCodeAt(index + 1)) && asciiAlphanumeric(value.charCodeAt(index + 2))) skip = 2; |
| 23452 |
else if (code < 128) { |
| 23453 |
if (!/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(code))) replace = String.fromCharCode(code); |
| 23454 |
} else if (code > 55295 && code < 57344) { |
| 23455 |
const next = value.charCodeAt(index + 1); |
| 23456 |
if (code < 56320 && next > 56319 && next < 57344) { |
| 23457 |
replace = String.fromCharCode(code, next); |
| 23458 |
skip = 1; |
| 23459 |
} else replace = "�"; |
| 23460 |
} else replace = String.fromCharCode(code); |
| 23461 |
if (replace) { |
| 23462 |
result.push(value.slice(start, index), encodeURIComponent(replace)); |
| 23463 |
start = index + skip + 1; |
| 23464 |
replace = ""; |
| 23465 |
} |
| 23466 |
if (skip) { |
| 23467 |
index += skip; |
| 23468 |
skip = 0; |
| 23469 |
} |
| 23470 |
} |
| 23471 |
return result.join("") + value.slice(start); |
| 23472 |
} |
| 23473 |
var init_micromark_util_sanitize_uri = __esmMin((() => { |
| 23474 |
init_micromark_util_character(); |
| 23475 |
})); |
| 23476 |
|
| 23477 |
//#endregion |
| 23478 |
//#region node_modules/mdast-util-to-hast/lib/handlers/footnote-reference.js |
| 23479 |
/** |
| 23480 |
* Turn an mdast `footnoteReference` node into hast. |
| 23481 |
* |
| 23482 |
* @param {State} state |
| 23483 |
* Info passed around. |
| 23484 |
* @param {FootnoteReference} node |
| 23485 |
* mdast node. |
| 23486 |
* @returns {Element} |
| 23487 |
* hast node. |
| 23488 |
*/ |
| 23489 |
function footnoteReference(state, node) { |
| 23490 |
const id = String(node.identifier).toUpperCase(); |
| 23491 |
const safeId = normalizeUri(id.toLowerCase()); |
| 23492 |
const index = state.footnoteOrder.indexOf(id); |
| 23493 |
/** @type {number} */ |
| 23494 |
let counter; |
| 23495 |
if (index === -1) { |
| 23496 |
state.footnoteOrder.push(id); |
| 23497 |
state.footnoteCounts[id] = 1; |
| 23498 |
counter = state.footnoteOrder.length; |
| 23499 |
} else { |
| 23500 |
state.footnoteCounts[id]++; |
| 23501 |
counter = index + 1; |
| 23502 |
} |
| 23503 |
const reuseCounter = state.footnoteCounts[id]; |
| 23504 |
/** @type {Element} */ |
| 23505 |
const link = { |
| 23506 |
type: "element", |
| 23507 |
tagName: "a", |
| 23508 |
properties: { |
| 23509 |
href: "#" + state.clobberPrefix + "fn-" + safeId, |
| 23510 |
id: state.clobberPrefix + "fnref-" + safeId + (reuseCounter > 1 ? "-" + reuseCounter : ""), |
| 23511 |
dataFootnoteRef: true, |
| 23512 |
ariaDescribedBy: ["footnote-label"] |
| 23513 |
}, |
| 23514 |
children: [{ |
| 23515 |
type: "text", |
| 23516 |
value: String(counter) |
| 23517 |
}] |
| 23518 |
}; |
| 23519 |
state.patch(node, link); |
| 23520 |
/** @type {Element} */ |
| 23521 |
const sup = { |
| 23522 |
type: "element", |
| 23523 |
tagName: "sup", |
| 23524 |
properties: {}, |
| 23525 |
children: [link] |
| 23526 |
}; |
| 23527 |
state.patch(node, sup); |
| 23528 |
return state.applyData(node, sup); |
| 23529 |
} |
| 23530 |
var init_footnote_reference = __esmMin((() => { |
| 23531 |
init_micromark_util_sanitize_uri(); |
| 23532 |
})); |
| 23533 |
|
| 23534 |
//#endregion |
| 23535 |
//#region node_modules/mdast-util-to-hast/lib/handlers/footnote.js |
| 23536 |
/** |
| 23537 |
* Turn an mdast `footnote` node into hast. |
| 23538 |
* |
| 23539 |
* @param {State} state |
| 23540 |
* Info passed around. |
| 23541 |
* @param {Footnote} node |
| 23542 |
* mdast node. |
| 23543 |
* @returns {Element} |
| 23544 |
* hast node. |
| 23545 |
*/ |
| 23546 |
function footnote(state, node) { |
| 23547 |
const footnoteById = state.footnoteById; |
| 23548 |
let no = 1; |
| 23549 |
while (no in footnoteById) no++; |
| 23550 |
const identifier = String(no); |
| 23551 |
footnoteById[identifier] = { |
| 23552 |
type: "footnoteDefinition", |
| 23553 |
identifier, |
| 23554 |
children: [{ |
| 23555 |
type: "paragraph", |
| 23556 |
children: node.children |
| 23557 |
}], |
| 23558 |
position: node.position |
| 23559 |
}; |
| 23560 |
return footnoteReference(state, { |
| 23561 |
type: "footnoteReference", |
| 23562 |
identifier, |
| 23563 |
position: node.position |
| 23564 |
}); |
| 23565 |
} |
| 23566 |
var init_footnote = __esmMin((() => { |
| 23567 |
init_footnote_reference(); |
| 23568 |
})); |
| 23569 |
|
| 23570 |
//#endregion |
| 23571 |
//#region node_modules/mdast-util-to-hast/lib/handlers/heading.js |
| 23572 |
/** |
| 23573 |
* @typedef {import('hast').Element} Element |
| 23574 |
* @typedef {import('mdast').Heading} Heading |
| 23575 |
* @typedef {import('../state.js').State} State |
| 23576 |
*/ |
| 23577 |
/** |
| 23578 |
* Turn an mdast `heading` node into hast. |
| 23579 |
* |
| 23580 |
* @param {State} state |
| 23581 |
* Info passed around. |
| 23582 |
* @param {Heading} node |
| 23583 |
* mdast node. |
| 23584 |
* @returns {Element} |
| 23585 |
* hast node. |
| 23586 |
*/ |
| 23587 |
function heading(state, node) { |
| 23588 |
/** @type {Element} */ |
| 23589 |
const result = { |
| 23590 |
type: "element", |
| 23591 |
tagName: "h" + node.depth, |
| 23592 |
properties: {}, |
| 23593 |
children: state.all(node) |
| 23594 |
}; |
| 23595 |
state.patch(node, result); |
| 23596 |
return state.applyData(node, result); |
| 23597 |
} |
| 23598 |
var init_heading = __esmMin((() => {})); |
| 23599 |
|
| 23600 |
//#endregion |
| 23601 |
//#region node_modules/mdast-util-to-hast/lib/handlers/html.js |
| 23602 |
/** |
| 23603 |
* @typedef {import('hast').Element} Element |
| 23604 |
* @typedef {import('mdast').HTML} Html |
| 23605 |
* @typedef {import('../state.js').State} State |
| 23606 |
* @typedef {import('../../index.js').Raw} Raw |
| 23607 |
*/ |
| 23608 |
/** |
| 23609 |
* Turn an mdast `html` node into hast (`raw` node in dangerous mode, otherwise |
| 23610 |
* nothing). |
| 23611 |
* |
| 23612 |
* @param {State} state |
| 23613 |
* Info passed around. |
| 23614 |
* @param {Html} node |
| 23615 |
* mdast node. |
| 23616 |
* @returns {Raw | Element | null} |
| 23617 |
* hast node. |
| 23618 |
*/ |
| 23619 |
function html$2(state, node) { |
| 23620 |
if (state.dangerous) { |
| 23621 |
/** @type {Raw} */ |
| 23622 |
const result = { |
| 23623 |
type: "raw", |
| 23624 |
value: node.value |
| 23625 |
}; |
| 23626 |
state.patch(node, result); |
| 23627 |
return state.applyData(node, result); |
| 23628 |
} |
| 23629 |
return null; |
| 23630 |
} |
| 23631 |
var init_html$1 = __esmMin((() => { |
| 23632 |
__name(html$2, "html"); |
| 23633 |
})); |
| 23634 |
|
| 23635 |
//#endregion |
| 23636 |
//#region node_modules/mdast-util-to-hast/lib/revert.js |
| 23637 |
/** |
| 23638 |
* @typedef {import('hast').ElementContent} ElementContent |
| 23639 |
* |
| 23640 |
* @typedef {import('mdast').Content} Content |
| 23641 |
* @typedef {import('mdast').Reference} Reference |
| 23642 |
* @typedef {import('mdast').Root} Root |
| 23643 |
* |
| 23644 |
* @typedef {import('./state.js').State} State |
| 23645 |
*/ |
| 23646 |
/** |
| 23647 |
* @typedef {Root | Content} Nodes |
| 23648 |
* @typedef {Extract<Nodes, Reference>} References |
| 23649 |
*/ |
| 23650 |
/** |
| 23651 |
* Return the content of a reference without definition as plain text. |
| 23652 |
* |
| 23653 |
* @param {State} state |
| 23654 |
* Info passed around. |
| 23655 |
* @param {References} node |
| 23656 |
* Reference node (image, link). |
| 23657 |
* @returns {ElementContent | Array<ElementContent>} |
| 23658 |
* hast content. |
| 23659 |
*/ |
| 23660 |
function revert(state, node) { |
| 23661 |
const subtype = node.referenceType; |
| 23662 |
let suffix = "]"; |
| 23663 |
if (subtype === "collapsed") suffix += "[]"; |
| 23664 |
else if (subtype === "full") suffix += "[" + (node.label || node.identifier) + "]"; |
| 23665 |
if (node.type === "imageReference") return { |
| 23666 |
type: "text", |
| 23667 |
value: "![" + node.alt + suffix |
| 23668 |
}; |
| 23669 |
const contents = state.all(node); |
| 23670 |
const head = contents[0]; |
| 23671 |
if (head && head.type === "text") head.value = "[" + head.value; |
| 23672 |
else contents.unshift({ |
| 23673 |
type: "text", |
| 23674 |
value: "[" |
| 23675 |
}); |
| 23676 |
const tail = contents[contents.length - 1]; |
| 23677 |
if (tail && tail.type === "text") tail.value += suffix; |
| 23678 |
else contents.push({ |
| 23679 |
type: "text", |
| 23680 |
value: suffix |
| 23681 |
}); |
| 23682 |
return contents; |
| 23683 |
} |
| 23684 |
var init_revert = __esmMin((() => {})); |
| 23685 |
|
| 23686 |
//#endregion |
| 23687 |
//#region node_modules/mdast-util-to-hast/lib/handlers/image-reference.js |
| 23688 |
/** |
| 23689 |
* Turn an mdast `imageReference` node into hast. |
| 23690 |
* |
| 23691 |
* @param {State} state |
| 23692 |
* Info passed around. |
| 23693 |
* @param {ImageReference} node |
| 23694 |
* mdast node. |
| 23695 |
* @returns {ElementContent | Array<ElementContent>} |
| 23696 |
* hast node. |
| 23697 |
*/ |
| 23698 |
function imageReference(state, node) { |
| 23699 |
const def = state.definition(node.identifier); |
| 23700 |
if (!def) return revert(state, node); |
| 23701 |
/** @type {Properties} */ |
| 23702 |
const properties = { |
| 23703 |
src: normalizeUri(def.url || ""), |
| 23704 |
alt: node.alt |
| 23705 |
}; |
| 23706 |
if (def.title !== null && def.title !== void 0) properties.title = def.title; |
| 23707 |
/** @type {Element} */ |
| 23708 |
const result = { |
| 23709 |
type: "element", |
| 23710 |
tagName: "img", |
| 23711 |
properties, |
| 23712 |
children: [] |
| 23713 |
}; |
| 23714 |
state.patch(node, result); |
| 23715 |
return state.applyData(node, result); |
| 23716 |
} |
| 23717 |
var init_image_reference = __esmMin((() => { |
| 23718 |
init_micromark_util_sanitize_uri(); |
| 23719 |
init_revert(); |
| 23720 |
})); |
| 23721 |
|
| 23722 |
//#endregion |
| 23723 |
//#region node_modules/mdast-util-to-hast/lib/handlers/image.js |
| 23724 |
/** |
| 23725 |
* Turn an mdast `image` node into hast. |
| 23726 |
* |
| 23727 |
* @param {State} state |
| 23728 |
* Info passed around. |
| 23729 |
* @param {Image} node |
| 23730 |
* mdast node. |
| 23731 |
* @returns {Element} |
| 23732 |
* hast node. |
| 23733 |
*/ |
| 23734 |
function image(state, node) { |
| 23735 |
/** @type {Properties} */ |
| 23736 |
const properties = { src: normalizeUri(node.url) }; |
| 23737 |
if (node.alt !== null && node.alt !== void 0) properties.alt = node.alt; |
| 23738 |
if (node.title !== null && node.title !== void 0) properties.title = node.title; |
| 23739 |
/** @type {Element} */ |
| 23740 |
const result = { |
| 23741 |
type: "element", |
| 23742 |
tagName: "img", |
| 23743 |
properties, |
| 23744 |
children: [] |
| 23745 |
}; |
| 23746 |
state.patch(node, result); |
| 23747 |
return state.applyData(node, result); |
| 23748 |
} |
| 23749 |
var init_image = __esmMin((() => { |
| 23750 |
init_micromark_util_sanitize_uri(); |
| 23751 |
})); |
| 23752 |
|
| 23753 |
//#endregion |
| 23754 |
//#region node_modules/mdast-util-to-hast/lib/handlers/inline-code.js |
| 23755 |
/** |
| 23756 |
* @typedef {import('hast').Element} Element |
| 23757 |
* @typedef {import('hast').Text} Text |
| 23758 |
* @typedef {import('mdast').InlineCode} InlineCode |
| 23759 |
* @typedef {import('../state.js').State} State |
| 23760 |
*/ |
| 23761 |
/** |
| 23762 |
* Turn an mdast `inlineCode` node into hast. |
| 23763 |
* |
| 23764 |
* @param {State} state |
| 23765 |
* Info passed around. |
| 23766 |
* @param {InlineCode} node |
| 23767 |
* mdast node. |
| 23768 |
* @returns {Element} |
| 23769 |
* hast node. |
| 23770 |
*/ |
| 23771 |
function inlineCode(state, node) { |
| 23772 |
/** @type {Text} */ |
| 23773 |
const text = { |
| 23774 |
type: "text", |
| 23775 |
value: node.value.replace(/\r?\n|\r/g, " ") |
| 23776 |
}; |
| 23777 |
state.patch(node, text); |
| 23778 |
/** @type {Element} */ |
| 23779 |
const result = { |
| 23780 |
type: "element", |
| 23781 |
tagName: "code", |
| 23782 |
properties: {}, |
| 23783 |
children: [text] |
| 23784 |
}; |
| 23785 |
state.patch(node, result); |
| 23786 |
return state.applyData(node, result); |
| 23787 |
} |
| 23788 |
var init_inline_code = __esmMin((() => {})); |
| 23789 |
|
| 23790 |
//#endregion |
| 23791 |
//#region node_modules/mdast-util-to-hast/lib/handlers/link-reference.js |
| 23792 |
/** |
| 23793 |
* Turn an mdast `linkReference` node into hast. |
| 23794 |
* |
| 23795 |
* @param {State} state |
| 23796 |
* Info passed around. |
| 23797 |
* @param {LinkReference} node |
| 23798 |
* mdast node. |
| 23799 |
* @returns {ElementContent | Array<ElementContent>} |
| 23800 |
* hast node. |
| 23801 |
*/ |
| 23802 |
function linkReference(state, node) { |
| 23803 |
const def = state.definition(node.identifier); |
| 23804 |
if (!def) return revert(state, node); |
| 23805 |
/** @type {Properties} */ |
| 23806 |
const properties = { href: normalizeUri(def.url || "") }; |
| 23807 |
if (def.title !== null && def.title !== void 0) properties.title = def.title; |
| 23808 |
/** @type {Element} */ |
| 23809 |
const result = { |
| 23810 |
type: "element", |
| 23811 |
tagName: "a", |
| 23812 |
properties, |
| 23813 |
children: state.all(node) |
| 23814 |
}; |
| 23815 |
state.patch(node, result); |
| 23816 |
return state.applyData(node, result); |
| 23817 |
} |
| 23818 |
var init_link_reference = __esmMin((() => { |
| 23819 |
init_micromark_util_sanitize_uri(); |
| 23820 |
init_revert(); |
| 23821 |
})); |
| 23822 |
|
| 23823 |
//#endregion |
| 23824 |
//#region node_modules/mdast-util-to-hast/lib/handlers/link.js |
| 23825 |
/** |
| 23826 |
* Turn an mdast `link` node into hast. |
| 23827 |
* |
| 23828 |
* @param {State} state |
| 23829 |
* Info passed around. |
| 23830 |
* @param {Link} node |
| 23831 |
* mdast node. |
| 23832 |
* @returns {Element} |
| 23833 |
* hast node. |
| 23834 |
*/ |
| 23835 |
function link(state, node) { |
| 23836 |
/** @type {Properties} */ |
| 23837 |
const properties = { href: normalizeUri(node.url) }; |
| 23838 |
if (node.title !== null && node.title !== void 0) properties.title = node.title; |
| 23839 |
/** @type {Element} */ |
| 23840 |
const result = { |
| 23841 |
type: "element", |
| 23842 |
tagName: "a", |
| 23843 |
properties, |
| 23844 |
children: state.all(node) |
| 23845 |
}; |
| 23846 |
state.patch(node, result); |
| 23847 |
return state.applyData(node, result); |
| 23848 |
} |
| 23849 |
var init_link = __esmMin((() => { |
| 23850 |
init_micromark_util_sanitize_uri(); |
| 23851 |
})); |
| 23852 |
|
| 23853 |
//#endregion |
| 23854 |
//#region node_modules/mdast-util-to-hast/lib/handlers/list-item.js |
| 23855 |
/** |
| 23856 |
* @typedef {import('hast').Element} Element |
| 23857 |
* @typedef {import('hast').ElementContent} ElementContent |
| 23858 |
* @typedef {import('hast').Properties} Properties |
| 23859 |
* @typedef {import('mdast').Content} Content |
| 23860 |
* @typedef {import('mdast').ListItem} ListItem |
| 23861 |
* @typedef {import('mdast').Parent} Parent |
| 23862 |
* @typedef {import('mdast').Root} Root |
| 23863 |
* @typedef {import('../state.js').State} State |
| 23864 |
*/ |
| 23865 |
/** |
| 23866 |
* @typedef {Root | Content} Nodes |
| 23867 |
* @typedef {Extract<Nodes, Parent>} Parents |
| 23868 |
*/ |
| 23869 |
/** |
| 23870 |
* Turn an mdast `listItem` node into hast. |
| 23871 |
* |
| 23872 |
* @param {State} state |
| 23873 |
* Info passed around. |
| 23874 |
* @param {ListItem} node |
| 23875 |
* mdast node. |
| 23876 |
* @param {Parents | null | undefined} parent |
| 23877 |
* Parent of `node`. |
| 23878 |
* @returns {Element} |
| 23879 |
* hast node. |
| 23880 |
*/ |
| 23881 |
function listItem(state, node, parent) { |
| 23882 |
const results = state.all(node); |
| 23883 |
const loose = parent ? listLoose(parent) : listItemLoose(node); |
| 23884 |
/** @type {Properties} */ |
| 23885 |
const properties = {}; |
| 23886 |
/** @type {Array<ElementContent>} */ |
| 23887 |
const children = []; |
| 23888 |
if (typeof node.checked === "boolean") { |
| 23889 |
const head = results[0]; |
| 23890 |
/** @type {Element} */ |
| 23891 |
let paragraph; |
| 23892 |
if (head && head.type === "element" && head.tagName === "p") paragraph = head; |
| 23893 |
else { |
| 23894 |
paragraph = { |
| 23895 |
type: "element", |
| 23896 |
tagName: "p", |
| 23897 |
properties: {}, |
| 23898 |
children: [] |
| 23899 |
}; |
| 23900 |
results.unshift(paragraph); |
| 23901 |
} |
| 23902 |
if (paragraph.children.length > 0) paragraph.children.unshift({ |
| 23903 |
type: "text", |
| 23904 |
value: " " |
| 23905 |
}); |
| 23906 |
paragraph.children.unshift({ |
| 23907 |
type: "element", |
| 23908 |
tagName: "input", |
| 23909 |
properties: { |
| 23910 |
type: "checkbox", |
| 23911 |
checked: node.checked, |
| 23912 |
disabled: true |
| 23913 |
}, |
| 23914 |
children: [] |
| 23915 |
}); |
| 23916 |
properties.className = ["task-list-item"]; |
| 23917 |
} |
| 23918 |
let index = -1; |
| 23919 |
while (++index < results.length) { |
| 23920 |
const child = results[index]; |
| 23921 |
if (loose || index !== 0 || child.type !== "element" || child.tagName !== "p") children.push({ |
| 23922 |
type: "text", |
| 23923 |
value: "\n" |
| 23924 |
}); |
| 23925 |
if (child.type === "element" && child.tagName === "p" && !loose) children.push(...child.children); |
| 23926 |
else children.push(child); |
| 23927 |
} |
| 23928 |
const tail = results[results.length - 1]; |
| 23929 |
if (tail && (loose || tail.type !== "element" || tail.tagName !== "p")) children.push({ |
| 23930 |
type: "text", |
| 23931 |
value: "\n" |
| 23932 |
}); |
| 23933 |
/** @type {Element} */ |
| 23934 |
const result = { |
| 23935 |
type: "element", |
| 23936 |
tagName: "li", |
| 23937 |
properties, |
| 23938 |
children |
| 23939 |
}; |
| 23940 |
state.patch(node, result); |
| 23941 |
return state.applyData(node, result); |
| 23942 |
} |
| 23943 |
/** |
| 23944 |
* @param {Parents} node |
| 23945 |
* @return {Boolean} |
| 23946 |
*/ |
| 23947 |
function listLoose(node) { |
| 23948 |
let loose = false; |
| 23949 |
if (node.type === "list") { |
| 23950 |
loose = node.spread || false; |
| 23951 |
const children = node.children; |
| 23952 |
let index = -1; |
| 23953 |
while (!loose && ++index < children.length) loose = listItemLoose(children[index]); |
| 23954 |
} |
| 23955 |
return loose; |
| 23956 |
} |
| 23957 |
/** |
| 23958 |
* @param {ListItem} node |
| 23959 |
* @return {Boolean} |
| 23960 |
*/ |
| 23961 |
function listItemLoose(node) { |
| 23962 |
const spread = node.spread; |
| 23963 |
return spread === void 0 || spread === null ? node.children.length > 1 : spread; |
| 23964 |
} |
| 23965 |
var init_list_item = __esmMin((() => {})); |
| 23966 |
|
| 23967 |
//#endregion |
| 23968 |
//#region node_modules/mdast-util-to-hast/lib/handlers/list.js |
| 23969 |
/** |
| 23970 |
* @typedef {import('hast').Element} Element |
| 23971 |
* @typedef {import('hast').Properties} Properties |
| 23972 |
* @typedef {import('mdast').List} List |
| 23973 |
* @typedef {import('../state.js').State} State |
| 23974 |
*/ |
| 23975 |
/** |
| 23976 |
* Turn an mdast `list` node into hast. |
| 23977 |
* |
| 23978 |
* @param {State} state |
| 23979 |
* Info passed around. |
| 23980 |
* @param {List} node |
| 23981 |
* mdast node. |
| 23982 |
* @returns {Element} |
| 23983 |
* hast node. |
| 23984 |
*/ |
| 23985 |
function list(state, node) { |
| 23986 |
/** @type {Properties} */ |
| 23987 |
const properties = {}; |
| 23988 |
const results = state.all(node); |
| 23989 |
let index = -1; |
| 23990 |
if (typeof node.start === "number" && node.start !== 1) properties.start = node.start; |
| 23991 |
while (++index < results.length) { |
| 23992 |
const child = results[index]; |
| 23993 |
if (child.type === "element" && child.tagName === "li" && child.properties && Array.isArray(child.properties.className) && child.properties.className.includes("task-list-item")) { |
| 23994 |
properties.className = ["contains-task-list"]; |
| 23995 |
break; |
| 23996 |
} |
| 23997 |
} |
| 23998 |
/** @type {Element} */ |
| 23999 |
const result = { |
| 24000 |
type: "element", |
| 24001 |
tagName: node.ordered ? "ol" : "ul", |
| 24002 |
properties, |
| 24003 |
children: state.wrap(results, true) |
| 24004 |
}; |
| 24005 |
state.patch(node, result); |
| 24006 |
return state.applyData(node, result); |
| 24007 |
} |
| 24008 |
var init_list = __esmMin((() => {})); |
| 24009 |
|
| 24010 |
//#endregion |
| 24011 |
//#region node_modules/mdast-util-to-hast/lib/handlers/paragraph.js |
| 24012 |
/** |
| 24013 |
* @typedef {import('hast').Element} Element |
| 24014 |
* @typedef {import('mdast').Paragraph} Paragraph |
| 24015 |
* @typedef {import('../state.js').State} State |
| 24016 |
*/ |
| 24017 |
/** |
| 24018 |
* Turn an mdast `paragraph` node into hast. |
| 24019 |
* |
| 24020 |
* @param {State} state |
| 24021 |
* Info passed around. |
| 24022 |
* @param {Paragraph} node |
| 24023 |
* mdast node. |
| 24024 |
* @returns {Element} |
| 24025 |
* hast node. |
| 24026 |
*/ |
| 24027 |
function paragraph(state, node) { |
| 24028 |
/** @type {Element} */ |
| 24029 |
const result = { |
| 24030 |
type: "element", |
| 24031 |
tagName: "p", |
| 24032 |
properties: {}, |
| 24033 |
children: state.all(node) |
| 24034 |
}; |
| 24035 |
state.patch(node, result); |
| 24036 |
return state.applyData(node, result); |
| 24037 |
} |
| 24038 |
var init_paragraph = __esmMin((() => {})); |
| 24039 |
|
| 24040 |
//#endregion |
| 24041 |
//#region node_modules/mdast-util-to-hast/lib/handlers/root.js |
| 24042 |
/** |
| 24043 |
* @typedef {import('hast').Root} HastRoot |
| 24044 |
* @typedef {import('hast').Element} HastElement |
| 24045 |
* @typedef {import('mdast').Root} MdastRoot |
| 24046 |
* @typedef {import('../state.js').State} State |
| 24047 |
*/ |
| 24048 |
/** |
| 24049 |
* Turn an mdast `root` node into hast. |
| 24050 |
* |
| 24051 |
* @param {State} state |
| 24052 |
* Info passed around. |
| 24053 |
* @param {MdastRoot} node |
| 24054 |
* mdast node. |
| 24055 |
* @returns {HastRoot | HastElement} |
| 24056 |
* hast node. |
| 24057 |
*/ |
| 24058 |
function root(state, node) { |
| 24059 |
/** @type {HastRoot} */ |
| 24060 |
const result = { |
| 24061 |
type: "root", |
| 24062 |
children: state.wrap(state.all(node)) |
| 24063 |
}; |
| 24064 |
state.patch(node, result); |
| 24065 |
return state.applyData(node, result); |
| 24066 |
} |
| 24067 |
var init_root = __esmMin((() => {})); |
| 24068 |
|
| 24069 |
//#endregion |
| 24070 |
//#region node_modules/mdast-util-to-hast/lib/handlers/strong.js |
| 24071 |
/** |
| 24072 |
* @typedef {import('hast').Element} Element |
| 24073 |
* @typedef {import('mdast').Strong} Strong |
| 24074 |
* @typedef {import('../state.js').State} State |
| 24075 |
*/ |
| 24076 |
/** |
| 24077 |
* Turn an mdast `strong` node into hast. |
| 24078 |
* |
| 24079 |
* @param {State} state |
| 24080 |
* Info passed around. |
| 24081 |
* @param {Strong} node |
| 24082 |
* mdast node. |
| 24083 |
* @returns {Element} |
| 24084 |
* hast node. |
| 24085 |
*/ |
| 24086 |
function strong(state, node) { |
| 24087 |
/** @type {Element} */ |
| 24088 |
const result = { |
| 24089 |
type: "element", |
| 24090 |
tagName: "strong", |
| 24091 |
properties: {}, |
| 24092 |
children: state.all(node) |
| 24093 |
}; |
| 24094 |
state.patch(node, result); |
| 24095 |
return state.applyData(node, result); |
| 24096 |
} |
| 24097 |
var init_strong = __esmMin((() => {})); |
| 24098 |
|
| 24099 |
//#endregion |
| 24100 |
//#region node_modules/unist-util-position/lib/index.js |
| 24101 |
/** |
| 24102 |
* Get the positional info of `node`. |
| 24103 |
* |
| 24104 |
* @param {NodeLike | Node | null | undefined} [node] |
| 24105 |
* Node. |
| 24106 |
* @returns {Position} |
| 24107 |
* Position. |
| 24108 |
*/ |
| 24109 |
function position(node) { |
| 24110 |
return { |
| 24111 |
start: pointStart(node), |
| 24112 |
end: pointEnd(node) |
| 24113 |
}; |
| 24114 |
} |
| 24115 |
/** |
| 24116 |
* Get the positional info of `node`. |
| 24117 |
* |
| 24118 |
* @param {'start' | 'end'} type |
| 24119 |
* Side. |
| 24120 |
* @returns |
| 24121 |
* Getter. |
| 24122 |
*/ |
| 24123 |
function point(type) { |
| 24124 |
return point; |
| 24125 |
/** |
| 24126 |
* Get the point info of `node` at a bound side. |
| 24127 |
* |
| 24128 |
* @param {NodeLike | Node | null | undefined} [node] |
| 24129 |
* @returns {Point} |
| 24130 |
*/ |
| 24131 |
function point(node) { |
| 24132 |
const point = node && node.position && node.position[type] || {}; |
| 24133 |
return { |
| 24134 |
line: point.line || null, |
| 24135 |
column: point.column || null, |
| 24136 |
offset: point.offset > -1 ? point.offset : null |
| 24137 |
}; |
| 24138 |
} |
| 24139 |
} |
| 24140 |
var pointStart, pointEnd; |
| 24141 |
var init_lib$7 = __esmMin((() => { |
| 24142 |
pointStart = point("start"); |
| 24143 |
pointEnd = point("end"); |
| 24144 |
})); |
| 24145 |
|
| 24146 |
//#endregion |
| 24147 |
//#region node_modules/unist-util-position/index.js |
| 24148 |
var init_unist_util_position = __esmMin((() => { |
| 24149 |
init_lib$7(); |
| 24150 |
})); |
| 24151 |
|
| 24152 |
//#endregion |
| 24153 |
//#region node_modules/mdast-util-to-hast/lib/handlers/table.js |
| 24154 |
/** |
| 24155 |
* Turn an mdast `table` node into hast. |
| 24156 |
* |
| 24157 |
* @param {State} state |
| 24158 |
* Info passed around. |
| 24159 |
* @param {Table} node |
| 24160 |
* mdast node. |
| 24161 |
* @returns {Element} |
| 24162 |
* hast node. |
| 24163 |
*/ |
| 24164 |
function table(state, node) { |
| 24165 |
const rows = state.all(node); |
| 24166 |
const firstRow = rows.shift(); |
| 24167 |
/** @type {Array<Element>} */ |
| 24168 |
const tableContent = []; |
| 24169 |
if (firstRow) { |
| 24170 |
/** @type {Element} */ |
| 24171 |
const head = { |
| 24172 |
type: "element", |
| 24173 |
tagName: "thead", |
| 24174 |
properties: {}, |
| 24175 |
children: state.wrap([firstRow], true) |
| 24176 |
}; |
| 24177 |
state.patch(node.children[0], head); |
| 24178 |
tableContent.push(head); |
| 24179 |
} |
| 24180 |
if (rows.length > 0) { |
| 24181 |
/** @type {Element} */ |
| 24182 |
const body = { |
| 24183 |
type: "element", |
| 24184 |
tagName: "tbody", |
| 24185 |
properties: {}, |
| 24186 |
children: state.wrap(rows, true) |
| 24187 |
}; |
| 24188 |
const start = pointStart(node.children[1]); |
| 24189 |
const end = pointEnd(node.children[node.children.length - 1]); |
| 24190 |
if (start.line && end.line) body.position = { |
| 24191 |
start, |
| 24192 |
end |
| 24193 |
}; |
| 24194 |
tableContent.push(body); |
| 24195 |
} |
| 24196 |
/** @type {Element} */ |
| 24197 |
const result = { |
| 24198 |
type: "element", |
| 24199 |
tagName: "table", |
| 24200 |
properties: {}, |
| 24201 |
children: state.wrap(tableContent, true) |
| 24202 |
}; |
| 24203 |
state.patch(node, result); |
| 24204 |
return state.applyData(node, result); |
| 24205 |
} |
| 24206 |
var init_table = __esmMin((() => { |
| 24207 |
init_unist_util_position(); |
| 24208 |
})); |
| 24209 |
|
| 24210 |
//#endregion |
| 24211 |
//#region node_modules/mdast-util-to-hast/lib/handlers/table-row.js |
| 24212 |
/** |
| 24213 |
* @typedef {import('hast').Properties} Properties |
| 24214 |
* @typedef {import('hast').Element} Element |
| 24215 |
* @typedef {import('hast').ElementContent} ElementContent |
| 24216 |
* @typedef {import('mdast').Content} Content |
| 24217 |
* @typedef {import('mdast').Parent} Parent |
| 24218 |
* @typedef {import('mdast').Root} Root |
| 24219 |
* @typedef {import('mdast').TableRow} TableRow |
| 24220 |
* @typedef {import('../state.js').State} State |
| 24221 |
*/ |
| 24222 |
/** |
| 24223 |
* @typedef {Root | Content} Nodes |
| 24224 |
* @typedef {Extract<Nodes, Parent>} Parents |
| 24225 |
*/ |
| 24226 |
/** |
| 24227 |
* Turn an mdast `tableRow` node into hast. |
| 24228 |
* |
| 24229 |
* @param {State} state |
| 24230 |
* Info passed around. |
| 24231 |
* @param {TableRow} node |
| 24232 |
* mdast node. |
| 24233 |
* @param {Parents | null | undefined} parent |
| 24234 |
* Parent of `node`. |
| 24235 |
* @returns {Element} |
| 24236 |
* hast node. |
| 24237 |
*/ |
| 24238 |
function tableRow(state, node, parent) { |
| 24239 |
const siblings = parent ? parent.children : void 0; |
| 24240 |
const tagName = (siblings ? siblings.indexOf(node) : 1) === 0 ? "th" : "td"; |
| 24241 |
const align = parent && parent.type === "table" ? parent.align : void 0; |
| 24242 |
const length = align ? align.length : node.children.length; |
| 24243 |
let cellIndex = -1; |
| 24244 |
/** @type {Array<ElementContent>} */ |
| 24245 |
const cells = []; |
| 24246 |
while (++cellIndex < length) { |
| 24247 |
const cell = node.children[cellIndex]; |
| 24248 |
/** @type {Properties} */ |
| 24249 |
const properties = {}; |
| 24250 |
const alignValue = align ? align[cellIndex] : void 0; |
| 24251 |
if (alignValue) properties.align = alignValue; |
| 24252 |
/** @type {Element} */ |
| 24253 |
let result = { |
| 24254 |
type: "element", |
| 24255 |
tagName, |
| 24256 |
properties, |
| 24257 |
children: [] |
| 24258 |
}; |
| 24259 |
if (cell) { |
| 24260 |
result.children = state.all(cell); |
| 24261 |
state.patch(cell, result); |
| 24262 |
result = state.applyData(node, result); |
| 24263 |
} |
| 24264 |
cells.push(result); |
| 24265 |
} |
| 24266 |
/** @type {Element} */ |
| 24267 |
const result = { |
| 24268 |
type: "element", |
| 24269 |
tagName: "tr", |
| 24270 |
properties: {}, |
| 24271 |
children: state.wrap(cells, true) |
| 24272 |
}; |
| 24273 |
state.patch(node, result); |
| 24274 |
return state.applyData(node, result); |
| 24275 |
} |
| 24276 |
var init_table_row = __esmMin((() => {})); |
| 24277 |
|
| 24278 |
//#endregion |
| 24279 |
//#region node_modules/mdast-util-to-hast/lib/handlers/table-cell.js |
| 24280 |
/** |
| 24281 |
* @typedef {import('hast').Element} Element |
| 24282 |
* @typedef {import('mdast').TableCell} TableCell |
| 24283 |
* @typedef {import('../state.js').State} State |
| 24284 |
*/ |
| 24285 |
/** |
| 24286 |
* Turn an mdast `tableCell` node into hast. |
| 24287 |
* |
| 24288 |
* @param {State} state |
| 24289 |
* Info passed around. |
| 24290 |
* @param {TableCell} node |
| 24291 |
* mdast node. |
| 24292 |
* @returns {Element} |
| 24293 |
* hast node. |
| 24294 |
*/ |
| 24295 |
function tableCell(state, node) { |
| 24296 |
/** @type {Element} */ |
| 24297 |
const result = { |
| 24298 |
type: "element", |
| 24299 |
tagName: "td", |
| 24300 |
properties: {}, |
| 24301 |
children: state.all(node) |
| 24302 |
}; |
| 24303 |
state.patch(node, result); |
| 24304 |
return state.applyData(node, result); |
| 24305 |
} |
| 24306 |
var init_table_cell = __esmMin((() => {})); |
| 24307 |
|
| 24308 |
//#endregion |
| 24309 |
//#region node_modules/trim-lines/index.js |
| 24310 |
/** |
| 24311 |
* Remove initial and final spaces and tabs at the line breaks in `value`. |
| 24312 |
* Does not trim initial and final spaces and tabs of the value itself. |
| 24313 |
* |
| 24314 |
* @param {string} value |
| 24315 |
* Value to trim. |
| 24316 |
* @returns {string} |
| 24317 |
* Trimmed value. |
| 24318 |
*/ |
| 24319 |
function trimLines(value) { |
| 24320 |
const source = String(value); |
| 24321 |
const search = /\r?\n|\r/g; |
| 24322 |
let match = search.exec(source); |
| 24323 |
let last = 0; |
| 24324 |
/** @type {Array<string>} */ |
| 24325 |
const lines = []; |
| 24326 |
while (match) { |
| 24327 |
lines.push(trimLine(source.slice(last, match.index), last > 0, true), match[0]); |
| 24328 |
last = match.index + match[0].length; |
| 24329 |
match = search.exec(source); |
| 24330 |
} |
| 24331 |
lines.push(trimLine(source.slice(last), last > 0, false)); |
| 24332 |
return lines.join(""); |
| 24333 |
} |
| 24334 |
/** |
| 24335 |
* @param {string} value |
| 24336 |
* Line to trim. |
| 24337 |
* @param {boolean} start |
| 24338 |
* Whether to trim the start of the line. |
| 24339 |
* @param {boolean} end |
| 24340 |
* Whether to trim the end of the line. |
| 24341 |
* @returns {string} |
| 24342 |
* Trimmed line. |
| 24343 |
*/ |
| 24344 |
function trimLine(value, start, end) { |
| 24345 |
let startIndex = 0; |
| 24346 |
let endIndex = value.length; |
| 24347 |
if (start) { |
| 24348 |
let code = value.codePointAt(startIndex); |
| 24349 |
while (code === tab || code === space) { |
| 24350 |
startIndex++; |
| 24351 |
code = value.codePointAt(startIndex); |
| 24352 |
} |
| 24353 |
} |
| 24354 |
if (end) { |
| 24355 |
let code = value.codePointAt(endIndex - 1); |
| 24356 |
while (code === tab || code === space) { |
| 24357 |
endIndex--; |
| 24358 |
code = value.codePointAt(endIndex - 1); |
| 24359 |
} |
| 24360 |
} |
| 24361 |
return endIndex > startIndex ? value.slice(startIndex, endIndex) : ""; |
| 24362 |
} |
| 24363 |
var tab, space; |
| 24364 |
var init_trim_lines = __esmMin((() => { |
| 24365 |
tab = 9; |
| 24366 |
space = 32; |
| 24367 |
})); |
| 24368 |
|
| 24369 |
//#endregion |
| 24370 |
//#region node_modules/mdast-util-to-hast/lib/handlers/text.js |
| 24371 |
/** |
| 24372 |
* Turn an mdast `text` node into hast. |
| 24373 |
* |
| 24374 |
* @param {State} state |
| 24375 |
* Info passed around. |
| 24376 |
* @param {MdastText} node |
| 24377 |
* mdast node. |
| 24378 |
* @returns {HastText | HastElement} |
| 24379 |
* hast node. |
| 24380 |
*/ |
| 24381 |
function text(state, node) { |
| 24382 |
/** @type {HastText} */ |
| 24383 |
const result = { |
| 24384 |
type: "text", |
| 24385 |
value: trimLines(String(node.value)) |
| 24386 |
}; |
| 24387 |
state.patch(node, result); |
| 24388 |
return state.applyData(node, result); |
| 24389 |
} |
| 24390 |
var init_text = __esmMin((() => { |
| 24391 |
init_trim_lines(); |
| 24392 |
})); |
| 24393 |
|
| 24394 |
//#endregion |
| 24395 |
//#region node_modules/mdast-util-to-hast/lib/handlers/thematic-break.js |
| 24396 |
/** |
| 24397 |
* @typedef {import('hast').Element} Element |
| 24398 |
* @typedef {import('mdast').ThematicBreak} ThematicBreak |
| 24399 |
* @typedef {import('../state.js').State} State |
| 24400 |
*/ |
| 24401 |
/** |
| 24402 |
* Turn an mdast `thematicBreak` node into hast. |
| 24403 |
* |
| 24404 |
* @param {State} state |
| 24405 |
* Info passed around. |
| 24406 |
* @param {ThematicBreak} node |
| 24407 |
* mdast node. |
| 24408 |
* @returns {Element} |
| 24409 |
* hast node. |
| 24410 |
*/ |
| 24411 |
function thematicBreak(state, node) { |
| 24412 |
/** @type {Element} */ |
| 24413 |
const result = { |
| 24414 |
type: "element", |
| 24415 |
tagName: "hr", |
| 24416 |
properties: {}, |
| 24417 |
children: [] |
| 24418 |
}; |
| 24419 |
state.patch(node, result); |
| 24420 |
return state.applyData(node, result); |
| 24421 |
} |
| 24422 |
var init_thematic_break = __esmMin((() => {})); |
| 24423 |
|
| 24424 |
//#endregion |
| 24425 |
//#region node_modules/mdast-util-to-hast/lib/handlers/index.js |
| 24426 |
function ignore() { |
| 24427 |
return null; |
| 24428 |
} |
| 24429 |
var handlers; |
| 24430 |
var init_handlers = __esmMin((() => { |
| 24431 |
init_blockquote(); |
| 24432 |
init_break(); |
| 24433 |
init_code(); |
| 24434 |
init_delete(); |
| 24435 |
init_emphasis(); |
| 24436 |
init_footnote_reference(); |
| 24437 |
init_footnote(); |
| 24438 |
init_heading(); |
| 24439 |
init_html$1(); |
| 24440 |
init_image_reference(); |
| 24441 |
init_image(); |
| 24442 |
init_inline_code(); |
| 24443 |
init_link_reference(); |
| 24444 |
init_link(); |
| 24445 |
init_list_item(); |
| 24446 |
init_list(); |
| 24447 |
init_paragraph(); |
| 24448 |
init_root(); |
| 24449 |
init_strong(); |
| 24450 |
init_table(); |
| 24451 |
init_table_row(); |
| 24452 |
init_table_cell(); |
| 24453 |
init_text(); |
| 24454 |
init_thematic_break(); |
| 24455 |
handlers = { |
| 24456 |
blockquote, |
| 24457 |
break: hardBreak, |
| 24458 |
code, |
| 24459 |
delete: strikethrough, |
| 24460 |
emphasis, |
| 24461 |
footnoteReference, |
| 24462 |
footnote, |
| 24463 |
heading, |
| 24464 |
html: html$2, |
| 24465 |
imageReference, |
| 24466 |
image, |
| 24467 |
inlineCode, |
| 24468 |
linkReference, |
| 24469 |
link, |
| 24470 |
listItem, |
| 24471 |
list, |
| 24472 |
paragraph, |
| 24473 |
root, |
| 24474 |
strong, |
| 24475 |
table, |
| 24476 |
tableCell, |
| 24477 |
tableRow, |
| 24478 |
text, |
| 24479 |
thematicBreak, |
| 24480 |
toml: ignore, |
| 24481 |
yaml: ignore, |
| 24482 |
definition: ignore, |
| 24483 |
footnoteDefinition: ignore |
| 24484 |
}; |
| 24485 |
})); |
| 24486 |
|
| 24487 |
//#endregion |
| 24488 |
//#region node_modules/unist-util-is/lib/index.js |
| 24489 |
/** |
| 24490 |
* @param {Array<string | Props | TestFunctionAnything>} tests |
| 24491 |
* @returns {AssertAnything} |
| 24492 |
*/ |
| 24493 |
function anyFactory(tests) { |
| 24494 |
/** @type {Array<AssertAnything>} */ |
| 24495 |
const checks = []; |
| 24496 |
let index = -1; |
| 24497 |
while (++index < tests.length) checks[index] = convert(tests[index]); |
| 24498 |
return castFactory(any); |
| 24499 |
/** |
| 24500 |
* @this {unknown} |
| 24501 |
* @param {Array<unknown>} parameters |
| 24502 |
* @returns {boolean} |
| 24503 |
*/ |
| 24504 |
function any(...parameters) { |
| 24505 |
let index = -1; |
| 24506 |
while (++index < checks.length) if (checks[index].call(this, ...parameters)) return true; |
| 24507 |
return false; |
| 24508 |
} |
| 24509 |
} |
| 24510 |
/** |
| 24511 |
* Turn an object into a test for a node with a certain fields. |
| 24512 |
* |
| 24513 |
* @param {Props} check |
| 24514 |
* @returns {AssertAnything} |
| 24515 |
*/ |
| 24516 |
function propsFactory(check) { |
| 24517 |
return castFactory(all); |
| 24518 |
/** |
| 24519 |
* @param {Node} node |
| 24520 |
* @returns {boolean} |
| 24521 |
*/ |
| 24522 |
function all(node) { |
| 24523 |
/** @type {string} */ |
| 24524 |
let key; |
| 24525 |
for (key in check) if (node[key] !== check[key]) return false; |
| 24526 |
return true; |
| 24527 |
} |
| 24528 |
} |
| 24529 |
/** |
| 24530 |
* Turn a string into a test for a node with a certain type. |
| 24531 |
* |
| 24532 |
* @param {string} check |
| 24533 |
* @returns {AssertAnything} |
| 24534 |
*/ |
| 24535 |
function typeFactory(check) { |
| 24536 |
return castFactory(type); |
| 24537 |
/** |
| 24538 |
* @param {Node} node |
| 24539 |
*/ |
| 24540 |
function type(node) { |
| 24541 |
return node && node.type === check; |
| 24542 |
} |
| 24543 |
} |
| 24544 |
/** |
| 24545 |
* Turn a custom test into a test for a node that passes that test. |
| 24546 |
* |
| 24547 |
* @param {TestFunctionAnything} check |
| 24548 |
* @returns {AssertAnything} |
| 24549 |
*/ |
| 24550 |
function castFactory(check) { |
| 24551 |
return assertion; |
| 24552 |
/** |
| 24553 |
* @this {unknown} |
| 24554 |
* @param {unknown} node |
| 24555 |
* @param {Array<unknown>} parameters |
| 24556 |
* @returns {boolean} |
| 24557 |
*/ |
| 24558 |
function assertion(node, ...parameters) { |
| 24559 |
return Boolean(node && typeof node === "object" && "type" in node && Boolean(check.call(this, node, ...parameters))); |
| 24560 |
} |
| 24561 |
} |
| 24562 |
function ok() { |
| 24563 |
return true; |
| 24564 |
} |
| 24565 |
var convert; |
| 24566 |
var init_lib$6 = __esmMin((() => { |
| 24567 |
convert = ( |
| 24568 |
/** |
| 24569 |
* @param {Test} [test] |
| 24570 |
* @returns {AssertAnything} |
| 24571 |
*/ |
| 24572 |
function(test) { |
| 24573 |
if (test === void 0 || test === null) return ok; |
| 24574 |
if (typeof test === "string") return typeFactory(test); |
| 24575 |
if (typeof test === "object") return Array.isArray(test) ? anyFactory(test) : propsFactory(test); |
| 24576 |
if (typeof test === "function") return castFactory(test); |
| 24577 |
throw new Error("Expected function, string, or object as test"); |
| 24578 |
}); |
| 24579 |
})); |
| 24580 |
|
| 24581 |
//#endregion |
| 24582 |
//#region node_modules/unist-util-is/index.js |
| 24583 |
var init_unist_util_is = __esmMin((() => { |
| 24584 |
init_lib$6(); |
| 24585 |
})); |
| 24586 |
|
| 24587 |
//#endregion |
| 24588 |
//#region node_modules/unist-util-visit-parents/lib/color.browser.js |
| 24589 |
/** |
| 24590 |
* @param {string} d |
| 24591 |
* @returns {string} |
| 24592 |
*/ |
| 24593 |
function color(d) { |
| 24594 |
return d; |
| 24595 |
} |
| 24596 |
var init_color_browser = __esmMin((() => {})); |
| 24597 |
|
| 24598 |
//#endregion |
| 24599 |
//#region node_modules/unist-util-visit-parents/lib/index.js |
| 24600 |
/** |
| 24601 |
* Turn a return value into a clean result. |
| 24602 |
* |
| 24603 |
* @param {VisitorResult} value |
| 24604 |
* Valid return values from visitors. |
| 24605 |
* @returns {ActionTuple} |
| 24606 |
* Clean result. |
| 24607 |
*/ |
| 24608 |
function toResult(value) { |
| 24609 |
if (Array.isArray(value)) return value; |
| 24610 |
if (typeof value === "number") return [true, value]; |
| 24611 |
return [value]; |
| 24612 |
} |
| 24613 |
var CONTINUE, EXIT, SKIP, visitParents; |
| 24614 |
var init_lib$5 = __esmMin((() => { |
| 24615 |
init_unist_util_is(); |
| 24616 |
init_color_browser(); |
| 24617 |
CONTINUE = true; |
| 24618 |
EXIT = false; |
| 24619 |
SKIP = "skip"; |
| 24620 |
visitParents = ( |
| 24621 |
/** |
| 24622 |
* @param {Node} tree |
| 24623 |
* @param {Test} test |
| 24624 |
* @param {Visitor<Node>} visitor |
| 24625 |
* @param {boolean | null | undefined} [reverse] |
| 24626 |
* @returns {void} |
| 24627 |
*/ |
| 24628 |
function(tree, test, visitor, reverse) { |
| 24629 |
if (typeof test === "function" && typeof visitor !== "function") { |
| 24630 |
reverse = visitor; |
| 24631 |
visitor = test; |
| 24632 |
test = null; |
| 24633 |
} |
| 24634 |
const is = convert(test); |
| 24635 |
const step = reverse ? -1 : 1; |
| 24636 |
factory(tree, void 0, [])(); |
| 24637 |
/** |
| 24638 |
* @param {Node} node |
| 24639 |
* @param {number | undefined} index |
| 24640 |
* @param {Array<Parent>} parents |
| 24641 |
*/ |
| 24642 |
function factory(node, index, parents) { |
| 24643 |
/** @type {Record<string, unknown>} */ |
| 24644 |
const value = node && typeof node === "object" ? node : {}; |
| 24645 |
if (typeof value.type === "string") { |
| 24646 |
const name = typeof value.tagName === "string" ? value.tagName : typeof value.name === "string" ? value.name : void 0; |
| 24647 |
Object.defineProperty(visit, "name", { value: "node (" + color(node.type + (name ? "<" + name + ">" : "")) + ")" }); |
| 24648 |
} |
| 24649 |
return visit; |
| 24650 |
function visit() { |
| 24651 |
/** @type {ActionTuple} */ |
| 24652 |
let result = []; |
| 24653 |
/** @type {ActionTuple} */ |
| 24654 |
let subresult; |
| 24655 |
/** @type {number} */ |
| 24656 |
let offset; |
| 24657 |
/** @type {Array<Parent>} */ |
| 24658 |
let grandparents; |
| 24659 |
if (!test || is(node, index, parents[parents.length - 1] || null)) { |
| 24660 |
result = toResult(visitor(node, parents)); |
| 24661 |
if (result[0] === false) return result; |
| 24662 |
} |
| 24663 |
if (node.children && result[0] !== "skip") { |
| 24664 |
offset = (reverse ? node.children.length : -1) + step; |
| 24665 |
grandparents = parents.concat(node); |
| 24666 |
while (offset > -1 && offset < node.children.length) { |
| 24667 |
subresult = factory(node.children[offset], offset, grandparents)(); |
| 24668 |
if (subresult[0] === false) return subresult; |
| 24669 |
offset = typeof subresult[1] === "number" ? subresult[1] : offset + step; |
| 24670 |
} |
| 24671 |
} |
| 24672 |
return result; |
| 24673 |
} |
| 24674 |
} |
| 24675 |
}); |
| 24676 |
})); |
| 24677 |
|
| 24678 |
//#endregion |
| 24679 |
//#region node_modules/unist-util-visit-parents/index.js |
| 24680 |
var init_unist_util_visit_parents = __esmMin((() => { |
| 24681 |
init_lib$5(); |
| 24682 |
})); |
| 24683 |
|
| 24684 |
//#endregion |
| 24685 |
//#region node_modules/unist-util-visit/lib/index.js |
| 24686 |
var visit; |
| 24687 |
var init_lib$4 = __esmMin((() => { |
| 24688 |
init_unist_util_visit_parents(); |
| 24689 |
visit = ( |
| 24690 |
/** |
| 24691 |
* @param {Node} tree |
| 24692 |
* @param {Test} test |
| 24693 |
* @param {Visitor} visitor |
| 24694 |
* @param {boolean | null | undefined} [reverse] |
| 24695 |
* @returns {void} |
| 24696 |
*/ |
| 24697 |
function(tree, test, visitor, reverse) { |
| 24698 |
if (typeof test === "function" && typeof visitor !== "function") { |
| 24699 |
reverse = visitor; |
| 24700 |
visitor = test; |
| 24701 |
test = null; |
| 24702 |
} |
| 24703 |
visitParents(tree, test, overload, reverse); |
| 24704 |
/** |
| 24705 |
* @param {Node} node |
| 24706 |
* @param {Array<Parent>} parents |
| 24707 |
*/ |
| 24708 |
function overload(node, parents) { |
| 24709 |
const parent = parents[parents.length - 1]; |
| 24710 |
return visitor(node, parent ? parent.children.indexOf(node) : null, parent); |
| 24711 |
} |
| 24712 |
}); |
| 24713 |
})); |
| 24714 |
|
| 24715 |
//#endregion |
| 24716 |
//#region node_modules/unist-util-visit/index.js |
| 24717 |
var init_unist_util_visit = __esmMin((() => { |
| 24718 |
init_lib$4(); |
| 24719 |
})); |
| 24720 |
|
| 24721 |
//#endregion |
| 24722 |
//#region node_modules/unist-util-generated/lib/index.js |
| 24723 |
/** |
| 24724 |
* @typedef PointLike |
| 24725 |
* @property {number | null | undefined} [line] |
| 24726 |
* @property {number | null | undefined} [column] |
| 24727 |
* @property {number | null | undefined} [offset] |
| 24728 |
* |
| 24729 |
* @typedef PositionLike |
| 24730 |
* @property {PointLike | null | undefined} [start] |
| 24731 |
* @property {PointLike | null | undefined} [end] |
| 24732 |
* |
| 24733 |
* @typedef NodeLike |
| 24734 |
* @property {PositionLike | null | undefined} [position] |
| 24735 |
*/ |
| 24736 |
/** |
| 24737 |
* Check if `node` is generated. |
| 24738 |
* |
| 24739 |
* @param {NodeLike | null | undefined} [node] |
| 24740 |
* Node to check. |
| 24741 |
* @returns {boolean} |
| 24742 |
* Whether `node` is generated (does not have positional info). |
| 24743 |
*/ |
| 24744 |
function generated(node) { |
| 24745 |
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; |
| 24746 |
} |
| 24747 |
var init_lib$3 = __esmMin((() => {})); |
| 24748 |
|
| 24749 |
//#endregion |
| 24750 |
//#region node_modules/unist-util-generated/index.js |
| 24751 |
var init_unist_util_generated = __esmMin((() => { |
| 24752 |
init_lib$3(); |
| 24753 |
})); |
| 24754 |
|
| 24755 |
//#endregion |
| 24756 |
//#region node_modules/mdast-util-definitions/lib/index.js |
| 24757 |
/** |
| 24758 |
* Find definitions in `tree`. |
| 24759 |
* |
| 24760 |
* Uses CommonMark precedence, which means that earlier definitions are |
| 24761 |
* preferred over duplicate later definitions. |
| 24762 |
* |
| 24763 |
* @param {Node} tree |
| 24764 |
* Tree to check. |
| 24765 |
* @returns {GetDefinition} |
| 24766 |
* Getter. |
| 24767 |
*/ |
| 24768 |
function definitions(tree) { |
| 24769 |
/** @type {Record<string, Definition>} */ |
| 24770 |
const cache = Object.create(null); |
| 24771 |
if (!tree || !tree.type) throw new Error("mdast-util-definitions expected node"); |
| 24772 |
visit(tree, "definition", (definition) => { |
| 24773 |
const id = clean(definition.identifier); |
| 24774 |
if (id && !own$4.call(cache, id)) cache[id] = definition; |
| 24775 |
}); |
| 24776 |
return definition; |
| 24777 |
/** @type {GetDefinition} */ |
| 24778 |
function definition(identifier) { |
| 24779 |
const id = clean(identifier); |
| 24780 |
return id && own$4.call(cache, id) ? cache[id] : null; |
| 24781 |
} |
| 24782 |
} |
| 24783 |
/** |
| 24784 |
* @param {string | null | undefined} [value] |
| 24785 |
* @returns {string} |
| 24786 |
*/ |
| 24787 |
function clean(value) { |
| 24788 |
return String(value || "").toUpperCase(); |
| 24789 |
} |
| 24790 |
var own$4; |
| 24791 |
var init_lib$2 = __esmMin((() => { |
| 24792 |
init_unist_util_visit(); |
| 24793 |
own$4 = {}.hasOwnProperty; |
| 24794 |
})); |
| 24795 |
|
| 24796 |
//#endregion |
| 24797 |
//#region node_modules/mdast-util-definitions/index.js |
| 24798 |
var init_mdast_util_definitions = __esmMin((() => { |
| 24799 |
init_lib$2(); |
| 24800 |
})); |
| 24801 |
|
| 24802 |
//#endregion |
| 24803 |
//#region node_modules/mdast-util-to-hast/lib/state.js |
| 24804 |
/** |
| 24805 |
* Create `state` from an mdast tree. |
| 24806 |
* |
| 24807 |
* @param {MdastNodes} tree |
| 24808 |
* mdast node to transform. |
| 24809 |
* @param {Options | null | undefined} [options] |
| 24810 |
* Configuration. |
| 24811 |
* @returns {State} |
| 24812 |
* `state` function. |
| 24813 |
*/ |
| 24814 |
function createState(tree, options) { |
| 24815 |
const settings = options || {}; |
| 24816 |
const dangerous = settings.allowDangerousHtml || false; |
| 24817 |
/** @type {Record<string, MdastFootnoteDefinition>} */ |
| 24818 |
const footnoteById = {}; |
| 24819 |
state.dangerous = dangerous; |
| 24820 |
state.clobberPrefix = settings.clobberPrefix === void 0 || settings.clobberPrefix === null ? "user-content-" : settings.clobberPrefix; |
| 24821 |
state.footnoteLabel = settings.footnoteLabel || "Footnotes"; |
| 24822 |
state.footnoteLabelTagName = settings.footnoteLabelTagName || "h2"; |
| 24823 |
state.footnoteLabelProperties = settings.footnoteLabelProperties || { className: ["sr-only"] }; |
| 24824 |
state.footnoteBackLabel = settings.footnoteBackLabel || "Back to content"; |
| 24825 |
state.unknownHandler = settings.unknownHandler; |
| 24826 |
state.passThrough = settings.passThrough; |
| 24827 |
state.handlers = _objectSpread2(_objectSpread2({}, handlers), settings.handlers); |
| 24828 |
state.definition = definitions(tree); |
| 24829 |
state.footnoteById = footnoteById; |
| 24830 |
/** @type {Array<string>} */ |
| 24831 |
state.footnoteOrder = []; |
| 24832 |
/** @type {Record<string, number>} */ |
| 24833 |
state.footnoteCounts = {}; |
| 24834 |
state.patch = patch; |
| 24835 |
state.applyData = applyData; |
| 24836 |
state.one = oneBound; |
| 24837 |
state.all = allBound; |
| 24838 |
state.wrap = wrap; |
| 24839 |
state.augment = augment; |
| 24840 |
visit(tree, "footnoteDefinition", (definition) => { |
| 24841 |
const id = String(definition.identifier).toUpperCase(); |
| 24842 |
if (!own$3.call(footnoteById, id)) footnoteById[id] = definition; |
| 24843 |
}); |
| 24844 |
return state; |
| 24845 |
/** |
| 24846 |
* Finalise the created `right`, a hast node, from `left`, an mdast node. |
| 24847 |
* |
| 24848 |
* @param {MdastNodeWithData | PositionLike | null | undefined} left |
| 24849 |
* @param {HastElementContent} right |
| 24850 |
* @returns {HastElementContent} |
| 24851 |
*/ |
| 24852 |
/* c8 ignore start */ |
| 24853 |
function augment(left, right) { |
| 24854 |
if (left && "data" in left && left.data) { |
| 24855 |
/** @type {MdastData} */ |
| 24856 |
const data = left.data; |
| 24857 |
if (data.hName) { |
| 24858 |
if (right.type !== "element") right = { |
| 24859 |
type: "element", |
| 24860 |
tagName: "", |
| 24861 |
properties: {}, |
| 24862 |
children: [] |
| 24863 |
}; |
| 24864 |
right.tagName = data.hName; |
| 24865 |
} |
| 24866 |
if (right.type === "element" && data.hProperties) right.properties = _objectSpread2(_objectSpread2({}, right.properties), data.hProperties); |
| 24867 |
if ("children" in right && right.children && data.hChildren) right.children = data.hChildren; |
| 24868 |
} |
| 24869 |
if (left) { |
| 24870 |
const ctx = "type" in left ? left : { position: left }; |
| 24871 |
if (!generated(ctx)) right.position = { |
| 24872 |
start: pointStart(ctx), |
| 24873 |
end: pointEnd(ctx) |
| 24874 |
}; |
| 24875 |
} |
| 24876 |
return right; |
| 24877 |
} |
| 24878 |
/* c8 ignore stop */ |
| 24879 |
/** |
| 24880 |
* Create an element for `node`. |
| 24881 |
* |
| 24882 |
* @type {HFunctionProps} |
| 24883 |
*/ |
| 24884 |
/* c8 ignore start */ |
| 24885 |
function state(node, tagName, props, children) { |
| 24886 |
if (Array.isArray(props)) { |
| 24887 |
children = props; |
| 24888 |
props = {}; |
| 24889 |
} |
| 24890 |
return augment(node, { |
| 24891 |
type: "element", |
| 24892 |
tagName, |
| 24893 |
properties: props || {}, |
| 24894 |
children: children || [] |
| 24895 |
}); |
| 24896 |
} |
| 24897 |
/* c8 ignore stop */ |
| 24898 |
/** |
| 24899 |
* Transform an mdast node into a hast node. |
| 24900 |
* |
| 24901 |
* @param {MdastNodes} node |
| 24902 |
* mdast node. |
| 24903 |
* @param {MdastParents | null | undefined} [parent] |
| 24904 |
* Parent of `node`. |
| 24905 |
* @returns {HastElementContent | Array<HastElementContent> | null | undefined} |
| 24906 |
* Resulting hast node. |
| 24907 |
*/ |
| 24908 |
function oneBound(node, parent) { |
| 24909 |
return one(state, node, parent); |
| 24910 |
} |
| 24911 |
/** |
| 24912 |
* Transform the children of an mdast node into hast nodes. |
| 24913 |
* |
| 24914 |
* @param {MdastNodes} parent |
| 24915 |
* mdast node to compile |
| 24916 |
* @returns {Array<HastElementContent>} |
| 24917 |
* Resulting hast nodes. |
| 24918 |
*/ |
| 24919 |
function allBound(parent) { |
| 24920 |
return all(state, parent); |
| 24921 |
} |
| 24922 |
} |
| 24923 |
/** |
| 24924 |
* Copy a node’s positional info. |
| 24925 |
* |
| 24926 |
* @param {MdastNodes} from |
| 24927 |
* mdast node to copy from. |
| 24928 |
* @param {HastNodes} to |
| 24929 |
* hast node to copy into. |
| 24930 |
* @returns {void} |
| 24931 |
* Nothing. |
| 24932 |
*/ |
| 24933 |
function patch(from, to) { |
| 24934 |
if (from.position) to.position = position(from); |
| 24935 |
} |
| 24936 |
/** |
| 24937 |
* Honor the `data` of `from` and maybe generate an element instead of `to`. |
| 24938 |
* |
| 24939 |
* @template {HastNodes} Type |
| 24940 |
* Node type. |
| 24941 |
* @param {MdastNodes} from |
| 24942 |
* mdast node to use data from. |
| 24943 |
* @param {Type} to |
| 24944 |
* hast node to change. |
| 24945 |
* @returns {Type | HastElement} |
| 24946 |
* Nothing. |
| 24947 |
*/ |
| 24948 |
function applyData(from, to) { |
| 24949 |
/** @type {Type | HastElement} */ |
| 24950 |
let result = to; |
| 24951 |
if (from && from.data) { |
| 24952 |
const hName = from.data.hName; |
| 24953 |
const hChildren = from.data.hChildren; |
| 24954 |
const hProperties = from.data.hProperties; |
| 24955 |
if (typeof hName === "string") if (result.type === "element") result.tagName = hName; |
| 24956 |
else result = { |
| 24957 |
type: "element", |
| 24958 |
tagName: hName, |
| 24959 |
properties: {}, |
| 24960 |
children: [] |
| 24961 |
}; |
| 24962 |
if (result.type === "element" && hProperties) result.properties = _objectSpread2(_objectSpread2({}, result.properties), hProperties); |
| 24963 |
if ("children" in result && result.children && hChildren !== null && hChildren !== void 0) result.children = hChildren; |
| 24964 |
} |
| 24965 |
return result; |
| 24966 |
} |
| 24967 |
/** |
| 24968 |
* Transform an mdast node into a hast node. |
| 24969 |
* |
| 24970 |
* @param {State} state |
| 24971 |
* Info passed around. |
| 24972 |
* @param {MdastNodes} node |
| 24973 |
* mdast node. |
| 24974 |
* @param {MdastParents | null | undefined} [parent] |
| 24975 |
* Parent of `node`. |
| 24976 |
* @returns {HastElementContent | Array<HastElementContent> | null | undefined} |
| 24977 |
* Resulting hast node. |
| 24978 |
*/ |
| 24979 |
function one(state, node, parent) { |
| 24980 |
const type = node && node.type; |
| 24981 |
if (!type) throw new Error("Expected node, got `" + node + "`"); |
| 24982 |
if (own$3.call(state.handlers, type)) return state.handlers[type](state, node, parent); |
| 24983 |
if (state.passThrough && state.passThrough.includes(type)) return "children" in node ? _objectSpread2(_objectSpread2({}, node), {}, { children: all(state, node) }) : node; |
| 24984 |
if (state.unknownHandler) return state.unknownHandler(state, node, parent); |
| 24985 |
return defaultUnknownHandler(state, node); |
| 24986 |
} |
| 24987 |
/** |
| 24988 |
* Transform the children of an mdast node into hast nodes. |
| 24989 |
* |
| 24990 |
* @param {State} state |
| 24991 |
* Info passed around. |
| 24992 |
* @param {MdastNodes} parent |
| 24993 |
* mdast node to compile |
| 24994 |
* @returns {Array<HastElementContent>} |
| 24995 |
* Resulting hast nodes. |
| 24996 |
*/ |
| 24997 |
function all(state, parent) { |
| 24998 |
/** @type {Array<HastElementContent>} */ |
| 24999 |
const values = []; |
| 25000 |
if ("children" in parent) { |
| 25001 |
const nodes = parent.children; |
| 25002 |
let index = -1; |
| 25003 |
while (++index < nodes.length) { |
| 25004 |
const result = one(state, nodes[index], parent); |
| 25005 |
if (result) { |
| 25006 |
if (index && nodes[index - 1].type === "break") { |
| 25007 |
if (!Array.isArray(result) && result.type === "text") result.value = result.value.replace(/^\s+/, ""); |
| 25008 |
if (!Array.isArray(result) && result.type === "element") { |
| 25009 |
const head = result.children[0]; |
| 25010 |
if (head && head.type === "text") head.value = head.value.replace(/^\s+/, ""); |
| 25011 |
} |
| 25012 |
} |
| 25013 |
if (Array.isArray(result)) values.push(...result); |
| 25014 |
else values.push(result); |
| 25015 |
} |
| 25016 |
} |
| 25017 |
} |
| 25018 |
return values; |
| 25019 |
} |
| 25020 |
/** |
| 25021 |
* Transform an unknown node. |
| 25022 |
* |
| 25023 |
* @param {State} state |
| 25024 |
* Info passed around. |
| 25025 |
* @param {MdastNodes} node |
| 25026 |
* Unknown mdast node. |
| 25027 |
* @returns {HastText | HastElement} |
| 25028 |
* Resulting hast node. |
| 25029 |
*/ |
| 25030 |
function defaultUnknownHandler(state, node) { |
| 25031 |
const data = node.data || {}; |
| 25032 |
/** @type {HastText | HastElement} */ |
| 25033 |
const result = "value" in node && !(own$3.call(data, "hProperties") || own$3.call(data, "hChildren")) ? { |
| 25034 |
type: "text", |
| 25035 |
value: node.value |
| 25036 |
} : { |
| 25037 |
type: "element", |
| 25038 |
tagName: "div", |
| 25039 |
properties: {}, |
| 25040 |
children: all(state, node) |
| 25041 |
}; |
| 25042 |
state.patch(node, result); |
| 25043 |
return state.applyData(node, result); |
| 25044 |
} |
| 25045 |
/** |
| 25046 |
* Wrap `nodes` with line endings between each node. |
| 25047 |
* |
| 25048 |
* @template {HastContent} Type |
| 25049 |
* Node type. |
| 25050 |
* @param {Array<Type>} nodes |
| 25051 |
* List of nodes to wrap. |
| 25052 |
* @param {boolean | null | undefined} [loose=false] |
| 25053 |
* Whether to add line endings at start and end. |
| 25054 |
* @returns {Array<Type | HastText>} |
| 25055 |
* Wrapped nodes. |
| 25056 |
*/ |
| 25057 |
function wrap(nodes, loose) { |
| 25058 |
/** @type {Array<Type | HastText>} */ |
| 25059 |
const result = []; |
| 25060 |
let index = -1; |
| 25061 |
if (loose) result.push({ |
| 25062 |
type: "text", |
| 25063 |
value: "\n" |
| 25064 |
}); |
| 25065 |
while (++index < nodes.length) { |
| 25066 |
if (index) result.push({ |
| 25067 |
type: "text", |
| 25068 |
value: "\n" |
| 25069 |
}); |
| 25070 |
result.push(nodes[index]); |
| 25071 |
} |
| 25072 |
if (loose && nodes.length > 0) result.push({ |
| 25073 |
type: "text", |
| 25074 |
value: "\n" |
| 25075 |
}); |
| 25076 |
return result; |
| 25077 |
} |
| 25078 |
var own$3; |
| 25079 |
var init_state = __esmMin((() => { |
| 25080 |
init_unist_util_visit(); |
| 25081 |
init_unist_util_position(); |
| 25082 |
init_unist_util_generated(); |
| 25083 |
init_mdast_util_definitions(); |
| 25084 |
init_handlers(); |
| 25085 |
init_objectSpread2(); |
| 25086 |
own$3 = {}.hasOwnProperty; |
| 25087 |
})); |
| 25088 |
|
| 25089 |
//#endregion |
| 25090 |
//#region node_modules/mdast-util-to-hast/lib/footer.js |
| 25091 |
/** |
| 25092 |
* Generate a hast footer for called footnote definitions. |
| 25093 |
* |
| 25094 |
* @param {State} state |
| 25095 |
* Info passed around. |
| 25096 |
* @returns {Element | undefined} |
| 25097 |
* `section` element or `undefined`. |
| 25098 |
*/ |
| 25099 |
function footer(state) { |
| 25100 |
/** @type {Array<ElementContent>} */ |
| 25101 |
const listItems = []; |
| 25102 |
let index = -1; |
| 25103 |
while (++index < state.footnoteOrder.length) { |
| 25104 |
const def = state.footnoteById[state.footnoteOrder[index]]; |
| 25105 |
if (!def) continue; |
| 25106 |
const content = state.all(def); |
| 25107 |
const id = String(def.identifier).toUpperCase(); |
| 25108 |
const safeId = normalizeUri(id.toLowerCase()); |
| 25109 |
let referenceIndex = 0; |
| 25110 |
/** @type {Array<ElementContent>} */ |
| 25111 |
const backReferences = []; |
| 25112 |
while (++referenceIndex <= state.footnoteCounts[id]) { |
| 25113 |
/** @type {Element} */ |
| 25114 |
const backReference = { |
| 25115 |
type: "element", |
| 25116 |
tagName: "a", |
| 25117 |
properties: { |
| 25118 |
href: "#" + state.clobberPrefix + "fnref-" + safeId + (referenceIndex > 1 ? "-" + referenceIndex : ""), |
| 25119 |
dataFootnoteBackref: true, |
| 25120 |
className: ["data-footnote-backref"], |
| 25121 |
ariaLabel: state.footnoteBackLabel |
| 25122 |
}, |
| 25123 |
children: [{ |
| 25124 |
type: "text", |
| 25125 |
value: "↩" |
| 25126 |
}] |
| 25127 |
}; |
| 25128 |
if (referenceIndex > 1) backReference.children.push({ |
| 25129 |
type: "element", |
| 25130 |
tagName: "sup", |
| 25131 |
children: [{ |
| 25132 |
type: "text", |
| 25133 |
value: String(referenceIndex) |
| 25134 |
}] |
| 25135 |
}); |
| 25136 |
if (backReferences.length > 0) backReferences.push({ |
| 25137 |
type: "text", |
| 25138 |
value: " " |
| 25139 |
}); |
| 25140 |
backReferences.push(backReference); |
| 25141 |
} |
| 25142 |
const tail = content[content.length - 1]; |
| 25143 |
if (tail && tail.type === "element" && tail.tagName === "p") { |
| 25144 |
const tailTail = tail.children[tail.children.length - 1]; |
| 25145 |
if (tailTail && tailTail.type === "text") tailTail.value += " "; |
| 25146 |
else tail.children.push({ |
| 25147 |
type: "text", |
| 25148 |
value: " " |
| 25149 |
}); |
| 25150 |
tail.children.push(...backReferences); |
| 25151 |
} else content.push(...backReferences); |
| 25152 |
/** @type {Element} */ |
| 25153 |
const listItem = { |
| 25154 |
type: "element", |
| 25155 |
tagName: "li", |
| 25156 |
properties: { id: state.clobberPrefix + "fn-" + safeId }, |
| 25157 |
children: state.wrap(content, true) |
| 25158 |
}; |
| 25159 |
state.patch(def, listItem); |
| 25160 |
listItems.push(listItem); |
| 25161 |
} |
| 25162 |
if (listItems.length === 0) return; |
| 25163 |
return { |
| 25164 |
type: "element", |
| 25165 |
tagName: "section", |
| 25166 |
properties: { |
| 25167 |
dataFootnotes: true, |
| 25168 |
className: ["footnotes"] |
| 25169 |
}, |
| 25170 |
children: [ |
| 25171 |
{ |
| 25172 |
type: "element", |
| 25173 |
tagName: state.footnoteLabelTagName, |
| 25174 |
properties: _objectSpread2(_objectSpread2({}, JSON.parse(JSON.stringify(state.footnoteLabelProperties))), {}, { id: "footnote-label" }), |
| 25175 |
children: [{ |
| 25176 |
type: "text", |
| 25177 |
value: state.footnoteLabel |
| 25178 |
}] |
| 25179 |
}, |
| 25180 |
{ |
| 25181 |
type: "text", |
| 25182 |
value: "\n" |
| 25183 |
}, |
| 25184 |
{ |
| 25185 |
type: "element", |
| 25186 |
tagName: "ol", |
| 25187 |
properties: {}, |
| 25188 |
children: state.wrap(listItems, true) |
| 25189 |
}, |
| 25190 |
{ |
| 25191 |
type: "text", |
| 25192 |
value: "\n" |
| 25193 |
} |
| 25194 |
] |
| 25195 |
}; |
| 25196 |
} |
| 25197 |
var init_footer = __esmMin((() => { |
| 25198 |
init_micromark_util_sanitize_uri(); |
| 25199 |
init_objectSpread2(); |
| 25200 |
})); |
| 25201 |
|
| 25202 |
//#endregion |
| 25203 |
//#region node_modules/mdast-util-to-hast/lib/index.js |
| 25204 |
/** |
| 25205 |
* Transform mdast to hast. |
| 25206 |
* |
| 25207 |
* ##### Notes |
| 25208 |
* |
| 25209 |
* ###### HTML |
| 25210 |
* |
| 25211 |
* Raw HTML is available in mdast as `html` nodes and can be embedded in hast |
| 25212 |
* as semistandard `raw` nodes. |
| 25213 |
* Most utilities ignore `raw` nodes but two notable ones don’t: |
| 25214 |
* |
| 25215 |
* * `hast-util-to-html` also has an option `allowDangerousHtml` which will |
| 25216 |
* output the raw HTML. |
| 25217 |
* This is typically discouraged as noted by the option name but is useful |
| 25218 |
* if you completely trust authors |
| 25219 |
* * `hast-util-raw` can handle the raw embedded HTML strings by parsing them |
| 25220 |
* into standard hast nodes (`element`, `text`, etc). |
| 25221 |
* This is a heavy task as it needs a full HTML parser, but it is the only |
| 25222 |
* way to support untrusted content |
| 25223 |
* |
| 25224 |
* ###### Footnotes |
| 25225 |
* |
| 25226 |
* Many options supported here relate to footnotes. |
| 25227 |
* Footnotes are not specified by CommonMark, which we follow by default. |
| 25228 |
* They are supported by GitHub, so footnotes can be enabled in markdown with |
| 25229 |
* `mdast-util-gfm`. |
| 25230 |
* |
| 25231 |
* The options `footnoteBackLabel` and `footnoteLabel` define natural language |
| 25232 |
* that explains footnotes, which is hidden for sighted users but shown to |
| 25233 |
* assistive technology. |
| 25234 |
* When your page is not in English, you must define translated values. |
| 25235 |
* |
| 25236 |
* Back references use ARIA attributes, but the section label itself uses a |
| 25237 |
* heading that is hidden with an `sr-only` class. |
| 25238 |
* To show it to sighted users, define different attributes in |
| 25239 |
* `footnoteLabelProperties`. |
| 25240 |
* |
| 25241 |
* ###### Clobbering |
| 25242 |
* |
| 25243 |
* Footnotes introduces a problem, as it links footnote calls to footnote |
| 25244 |
* definitions on the page through `id` attributes generated from user content, |
| 25245 |
* which results in DOM clobbering. |
| 25246 |
* |
| 25247 |
* DOM clobbering is this: |
| 25248 |
* |
| 25249 |
* ```html |
| 25250 |
* <p id=x></p> |
| 25251 |
* <script>alert(x) // `x` now refers to the DOM `p#x` element<\/script> |
| 25252 |
* ``` |
| 25253 |
* |
| 25254 |
* Elements by their ID are made available by browsers on the `window` object, |
| 25255 |
* which is a security risk. |
| 25256 |
* Using a prefix solves this problem. |
| 25257 |
* |
| 25258 |
* More information on how to handle clobbering and the prefix is explained in |
| 25259 |
* Example: headings (DOM clobbering) in `rehype-sanitize`. |
| 25260 |
* |
| 25261 |
* ###### Unknown nodes |
| 25262 |
* |
| 25263 |
* Unknown nodes are nodes with a type that isn’t in `handlers` or `passThrough`. |
| 25264 |
* The default behavior for unknown nodes is: |
| 25265 |
* |
| 25266 |
* * when the node has a `value` (and doesn’t have `data.hName`, |
| 25267 |
* `data.hProperties`, or `data.hChildren`, see later), create a hast `text` |
| 25268 |
* node |
| 25269 |
* * otherwise, create a `<div>` element (which could be changed with |
| 25270 |
* `data.hName`), with its children mapped from mdast to hast as well |
| 25271 |
* |
| 25272 |
* This behavior can be changed by passing an `unknownHandler`. |
| 25273 |
* |
| 25274 |
* @param {MdastNodes} tree |
| 25275 |
* mdast tree. |
| 25276 |
* @param {Options | null | undefined} [options] |
| 25277 |
* Configuration. |
| 25278 |
* @returns {HastNodes | null | undefined} |
| 25279 |
* hast tree. |
| 25280 |
*/ |
| 25281 |
function toHast(tree, options) { |
| 25282 |
const state = createState(tree, options); |
| 25283 |
const node = state.one(tree, null); |
| 25284 |
const foot = footer(state); |
| 25285 |
if (foot) node.children.push({ |
| 25286 |
type: "text", |
| 25287 |
value: "\n" |
| 25288 |
}, foot); |
| 25289 |
return Array.isArray(node) ? { |
| 25290 |
type: "root", |
| 25291 |
children: node |
| 25292 |
} : node; |
| 25293 |
} |
| 25294 |
var init_lib$1 = __esmMin((() => { |
| 25295 |
init_footer(); |
| 25296 |
init_state(); |
| 25297 |
})); |
| 25298 |
|
| 25299 |
//#endregion |
| 25300 |
//#region node_modules/mdast-util-to-hast/index.js |
| 25301 |
var init_mdast_util_to_hast = __esmMin((() => { |
| 25302 |
init_handlers(); |
| 25303 |
init_state(); |
| 25304 |
init_lib$1(); |
| 25305 |
})); |
| 25306 |
|
| 25307 |
//#endregion |
| 25308 |
//#region node_modules/remark-rehype/lib/index.js |
| 25309 |
/** |
| 25310 |
* Bridge-mode. |
| 25311 |
* Runs the destination with the new hast tree. |
| 25312 |
* |
| 25313 |
* @type {import('unified').Plugin<[Processor, Options?], MdastRoot>} |
| 25314 |
*/ |
| 25315 |
function bridge(destination, options) { |
| 25316 |
return (node, file, next) => { |
| 25317 |
destination.run(toHast(node, options), file, (error) => { |
| 25318 |
next(error); |
| 25319 |
}); |
| 25320 |
}; |
| 25321 |
} |
| 25322 |
/** |
| 25323 |
* Mutate-mode. |
| 25324 |
* Further plugins run on the hast tree. |
| 25325 |
* |
| 25326 |
* @type {import('unified').Plugin<[Options?]|void[], MdastRoot, HastRoot>} |
| 25327 |
*/ |
| 25328 |
function mutate(options) { |
| 25329 |
return (node) => toHast(node, options); |
| 25330 |
} |
| 25331 |
var remarkRehype; |
| 25332 |
var init_lib = __esmMin((() => { |
| 25333 |
init_mdast_util_to_hast(); |
| 25334 |
remarkRehype = (function(destination, options) { |
| 25335 |
return destination && "run" in destination ? bridge(destination, options) : mutate(destination || options); |
| 25336 |
}); |
| 25337 |
})); |
| 25338 |
|
| 25339 |
//#endregion |
| 25340 |
//#region node_modules/remark-rehype/index.js |
| 25341 |
var init_remark_rehype = __esmMin((() => { |
| 25342 |
init_mdast_util_to_hast(); |
| 25343 |
init_lib(); |
| 25344 |
})); |
| 25345 |
|
| 25346 |
//#endregion |
| 25347 |
//#region node_modules/property-information/lib/util/schema.js |
| 25348 |
var Schema; |
| 25349 |
var init_schema = __esmMin((() => { |
| 25350 |
Schema = class { |
| 25351 |
/** |
| 25352 |
* @constructor |
| 25353 |
* @param {Properties} property |
| 25354 |
* @param {Normal} normal |
| 25355 |
* @param {string} [space] |
| 25356 |
*/ |
| 25357 |
constructor(property, normal, space) { |
| 25358 |
this.property = property; |
| 25359 |
this.normal = normal; |
| 25360 |
if (space) this.space = space; |
| 25361 |
} |
| 25362 |
}; |
| 25363 |
/** @type {Properties} */ |
| 25364 |
Schema.prototype.property = {}; |
| 25365 |
/** @type {Normal} */ |
| 25366 |
Schema.prototype.normal = {}; |
| 25367 |
/** @type {string|null} */ |
| 25368 |
Schema.prototype.space = null; |
| 25369 |
})); |
| 25370 |
|
| 25371 |
//#endregion |
| 25372 |
//#region node_modules/property-information/lib/util/merge.js |
| 25373 |
/** |
| 25374 |
* @param {Schema[]} definitions |
| 25375 |
* @param {string} [space] |
| 25376 |
* @returns {Schema} |
| 25377 |
*/ |
| 25378 |
function merge(definitions, space) { |
| 25379 |
/** @type {Properties} */ |
| 25380 |
const property = {}; |
| 25381 |
/** @type {Normal} */ |
| 25382 |
const normal = {}; |
| 25383 |
let index = -1; |
| 25384 |
while (++index < definitions.length) { |
| 25385 |
Object.assign(property, definitions[index].property); |
| 25386 |
Object.assign(normal, definitions[index].normal); |
| 25387 |
} |
| 25388 |
return new Schema(property, normal, space); |
| 25389 |
} |
| 25390 |
var init_merge = __esmMin((() => { |
| 25391 |
init_schema(); |
| 25392 |
})); |
| 25393 |
|
| 25394 |
//#endregion |
| 25395 |
//#region node_modules/property-information/lib/normalize.js |
| 25396 |
/** |
| 25397 |
* @param {string} value |
| 25398 |
* @returns {string} |
| 25399 |
*/ |
| 25400 |
function normalize(value) { |
| 25401 |
return value.toLowerCase(); |
| 25402 |
} |
| 25403 |
var init_normalize = __esmMin((() => {})); |
| 25404 |
|
| 25405 |
//#endregion |
| 25406 |
//#region node_modules/property-information/lib/util/info.js |
| 25407 |
var Info; |
| 25408 |
var init_info = __esmMin((() => { |
| 25409 |
Info = class { |
| 25410 |
/** |
| 25411 |
* @constructor |
| 25412 |
* @param {string} property |
| 25413 |
* @param {string} attribute |
| 25414 |
*/ |
| 25415 |
constructor(property, attribute) { |
| 25416 |
/** @type {string} */ |
| 25417 |
this.property = property; |
| 25418 |
/** @type {string} */ |
| 25419 |
this.attribute = attribute; |
| 25420 |
} |
| 25421 |
}; |
| 25422 |
/** @type {string|null} */ |
| 25423 |
Info.prototype.space = null; |
| 25424 |
Info.prototype.boolean = false; |
| 25425 |
Info.prototype.booleanish = false; |
| 25426 |
Info.prototype.overloadedBoolean = false; |
| 25427 |
Info.prototype.number = false; |
| 25428 |
Info.prototype.commaSeparated = false; |
| 25429 |
Info.prototype.spaceSeparated = false; |
| 25430 |
Info.prototype.commaOrSpaceSeparated = false; |
| 25431 |
Info.prototype.mustUseProperty = false; |
| 25432 |
Info.prototype.defined = false; |
| 25433 |
})); |
| 25434 |
|
| 25435 |
//#endregion |
| 25436 |
//#region node_modules/property-information/lib/util/types.js |
| 25437 |
var types_exports = /* @__PURE__ */ __exportAll({ |
| 25438 |
boolean: () => boolean, |
| 25439 |
booleanish: () => booleanish, |
| 25440 |
commaOrSpaceSeparated: () => commaOrSpaceSeparated, |
| 25441 |
commaSeparated: () => commaSeparated, |
| 25442 |
number: () => number, |
| 25443 |
overloadedBoolean: () => overloadedBoolean, |
| 25444 |
spaceSeparated: () => spaceSeparated |
| 25445 |
}); |
| 25446 |
function increment() { |
| 25447 |
return Math.pow(2, ++powers); |
| 25448 |
} |
| 25449 |
var powers, boolean, booleanish, overloadedBoolean, number, spaceSeparated, commaSeparated, commaOrSpaceSeparated; |
| 25450 |
var init_types = __esmMin((() => { |
| 25451 |
powers = 0; |
| 25452 |
boolean = increment(); |
| 25453 |
booleanish = increment(); |
| 25454 |
overloadedBoolean = increment(); |
| 25455 |
number = increment(); |
| 25456 |
spaceSeparated = increment(); |
| 25457 |
commaSeparated = increment(); |
| 25458 |
commaOrSpaceSeparated = increment(); |
| 25459 |
})); |
| 25460 |
|
| 25461 |
//#endregion |
| 25462 |
//#region node_modules/property-information/lib/util/defined-info.js |
| 25463 |
/** |
| 25464 |
* @param {DefinedInfo} values |
| 25465 |
* @param {string} key |
| 25466 |
* @param {unknown} value |
| 25467 |
*/ |
| 25468 |
function mark(values, key, value) { |
| 25469 |
if (value) values[key] = value; |
| 25470 |
} |
| 25471 |
var checks, DefinedInfo; |
| 25472 |
var init_defined_info = __esmMin((() => { |
| 25473 |
init_info(); |
| 25474 |
init_types(); |
| 25475 |
checks = Object.keys(types_exports); |
| 25476 |
DefinedInfo = class extends Info { |
| 25477 |
/** |
| 25478 |
* @constructor |
| 25479 |
* @param {string} property |
| 25480 |
* @param {string} attribute |
| 25481 |
* @param {number|null} [mask] |
| 25482 |
* @param {string} [space] |
| 25483 |
*/ |
| 25484 |
constructor(property, attribute, mask, space) { |
| 25485 |
let index = -1; |
| 25486 |
super(property, attribute); |
| 25487 |
mark(this, "space", space); |
| 25488 |
if (typeof mask === "number") while (++index < checks.length) { |
| 25489 |
const check = checks[index]; |
| 25490 |
mark(this, checks[index], (mask & types_exports[check]) === types_exports[check]); |
| 25491 |
} |
| 25492 |
} |
| 25493 |
}; |
| 25494 |
DefinedInfo.prototype.defined = true; |
| 25495 |
})); |
| 25496 |
|
| 25497 |
//#endregion |
| 25498 |
//#region node_modules/property-information/lib/util/create.js |
| 25499 |
/** |
| 25500 |
* @param {Definition} definition |
| 25501 |
* @returns {Schema} |
| 25502 |
*/ |
| 25503 |
function create(definition) { |
| 25504 |
/** @type {Properties} */ |
| 25505 |
const property = {}; |
| 25506 |
/** @type {Normal} */ |
| 25507 |
const normal = {}; |
| 25508 |
/** @type {string} */ |
| 25509 |
let prop; |
| 25510 |
for (prop in definition.properties) if (own$2.call(definition.properties, prop)) { |
| 25511 |
const value = definition.properties[prop]; |
| 25512 |
const info = new DefinedInfo(prop, definition.transform(definition.attributes || {}, prop), value, definition.space); |
| 25513 |
if (definition.mustUseProperty && definition.mustUseProperty.includes(prop)) info.mustUseProperty = true; |
| 25514 |
property[prop] = info; |
| 25515 |
normal[normalize(prop)] = prop; |
| 25516 |
normal[normalize(info.attribute)] = prop; |
| 25517 |
} |
| 25518 |
return new Schema(property, normal, definition.space); |
| 25519 |
} |
| 25520 |
var own$2; |
| 25521 |
var init_create = __esmMin((() => { |
| 25522 |
init_normalize(); |
| 25523 |
init_schema(); |
| 25524 |
init_defined_info(); |
| 25525 |
own$2 = {}.hasOwnProperty; |
| 25526 |
})); |
| 25527 |
|
| 25528 |
//#endregion |
| 25529 |
//#region node_modules/property-information/lib/xlink.js |
| 25530 |
var xlink; |
| 25531 |
var init_xlink = __esmMin((() => { |
| 25532 |
init_create(); |
| 25533 |
xlink = create({ |
| 25534 |
space: "xlink", |
| 25535 |
transform(_, prop) { |
| 25536 |
return "xlink:" + prop.slice(5).toLowerCase(); |
| 25537 |
}, |
| 25538 |
properties: { |
| 25539 |
xLinkActuate: null, |
| 25540 |
xLinkArcRole: null, |
| 25541 |
xLinkHref: null, |
| 25542 |
xLinkRole: null, |
| 25543 |
xLinkShow: null, |
| 25544 |
xLinkTitle: null, |
| 25545 |
xLinkType: null |
| 25546 |
} |
| 25547 |
}); |
| 25548 |
})); |
| 25549 |
|
| 25550 |
//#endregion |
| 25551 |
//#region node_modules/property-information/lib/xml.js |
| 25552 |
var xml; |
| 25553 |
var init_xml = __esmMin((() => { |
| 25554 |
init_create(); |
| 25555 |
xml = create({ |
| 25556 |
space: "xml", |
| 25557 |
transform(_, prop) { |
| 25558 |
return "xml:" + prop.slice(3).toLowerCase(); |
| 25559 |
}, |
| 25560 |
properties: { |
| 25561 |
xmlLang: null, |
| 25562 |
xmlBase: null, |
| 25563 |
xmlSpace: null |
| 25564 |
} |
| 25565 |
}); |
| 25566 |
})); |
| 25567 |
|
| 25568 |
//#endregion |
| 25569 |
//#region node_modules/property-information/lib/util/case-sensitive-transform.js |
| 25570 |
/** |
| 25571 |
* @param {Record<string, string>} attributes |
| 25572 |
* @param {string} attribute |
| 25573 |
* @returns {string} |
| 25574 |
*/ |
| 25575 |
function caseSensitiveTransform(attributes, attribute) { |
| 25576 |
return attribute in attributes ? attributes[attribute] : attribute; |
| 25577 |
} |
| 25578 |
var init_case_sensitive_transform = __esmMin((() => {})); |
| 25579 |
|
| 25580 |
//#endregion |
| 25581 |
//#region node_modules/property-information/lib/util/case-insensitive-transform.js |
| 25582 |
/** |
| 25583 |
* @param {Record<string, string>} attributes |
| 25584 |
* @param {string} property |
| 25585 |
* @returns {string} |
| 25586 |
*/ |
| 25587 |
function caseInsensitiveTransform(attributes, property) { |
| 25588 |
return caseSensitiveTransform(attributes, property.toLowerCase()); |
| 25589 |
} |
| 25590 |
var init_case_insensitive_transform = __esmMin((() => { |
| 25591 |
init_case_sensitive_transform(); |
| 25592 |
})); |
| 25593 |
|
| 25594 |
//#endregion |
| 25595 |
//#region node_modules/property-information/lib/xmlns.js |
| 25596 |
var xmlns; |
| 25597 |
var init_xmlns = __esmMin((() => { |
| 25598 |
init_create(); |
| 25599 |
init_case_insensitive_transform(); |
| 25600 |
xmlns = create({ |
| 25601 |
space: "xmlns", |
| 25602 |
attributes: { xmlnsxlink: "xmlns:xlink" }, |
| 25603 |
transform: caseInsensitiveTransform, |
| 25604 |
properties: { |
| 25605 |
xmlns: null, |
| 25606 |
xmlnsXLink: null |
| 25607 |
} |
| 25608 |
}); |
| 25609 |
})); |
| 25610 |
|
| 25611 |
//#endregion |
| 25612 |
//#region node_modules/property-information/lib/aria.js |
| 25613 |
var aria; |
| 25614 |
var init_aria = __esmMin((() => { |
| 25615 |
init_types(); |
| 25616 |
init_create(); |
| 25617 |
aria = create({ |
| 25618 |
transform(_, prop) { |
| 25619 |
return prop === "role" ? prop : "aria-" + prop.slice(4).toLowerCase(); |
| 25620 |
}, |
| 25621 |
properties: { |
| 25622 |
ariaActiveDescendant: null, |
| 25623 |
ariaAtomic: booleanish, |
| 25624 |
ariaAutoComplete: null, |
| 25625 |
ariaBusy: booleanish, |
| 25626 |
ariaChecked: booleanish, |
| 25627 |
ariaColCount: number, |
| 25628 |
ariaColIndex: number, |
| 25629 |
ariaColSpan: number, |
| 25630 |
ariaControls: spaceSeparated, |
| 25631 |
ariaCurrent: null, |
| 25632 |
ariaDescribedBy: spaceSeparated, |
| 25633 |
ariaDetails: null, |
| 25634 |
ariaDisabled: booleanish, |
| 25635 |
ariaDropEffect: spaceSeparated, |
| 25636 |
ariaErrorMessage: null, |
| 25637 |
ariaExpanded: booleanish, |
| 25638 |
ariaFlowTo: spaceSeparated, |
| 25639 |
ariaGrabbed: booleanish, |
| 25640 |
ariaHasPopup: null, |
| 25641 |
ariaHidden: booleanish, |
| 25642 |
ariaInvalid: null, |
| 25643 |
ariaKeyShortcuts: null, |
| 25644 |
ariaLabel: null, |
| 25645 |
ariaLabelledBy: spaceSeparated, |
| 25646 |
ariaLevel: number, |
| 25647 |
ariaLive: null, |
| 25648 |
ariaModal: booleanish, |
| 25649 |
ariaMultiLine: booleanish, |
| 25650 |
ariaMultiSelectable: booleanish, |
| 25651 |
ariaOrientation: null, |
| 25652 |
ariaOwns: spaceSeparated, |
| 25653 |
ariaPlaceholder: null, |
| 25654 |
ariaPosInSet: number, |
| 25655 |
ariaPressed: booleanish, |
| 25656 |
ariaReadOnly: booleanish, |
| 25657 |
ariaRelevant: null, |
| 25658 |
ariaRequired: booleanish, |
| 25659 |
ariaRoleDescription: spaceSeparated, |
| 25660 |
ariaRowCount: number, |
| 25661 |
ariaRowIndex: number, |
| 25662 |
ariaRowSpan: number, |
| 25663 |
ariaSelected: booleanish, |
| 25664 |
ariaSetSize: number, |
| 25665 |
ariaSort: null, |
| 25666 |
ariaValueMax: number, |
| 25667 |
ariaValueMin: number, |
| 25668 |
ariaValueNow: number, |
| 25669 |
ariaValueText: null, |
| 25670 |
role: null |
| 25671 |
} |
| 25672 |
}); |
| 25673 |
})); |
| 25674 |
|
| 25675 |
//#endregion |
| 25676 |
//#region node_modules/property-information/lib/html.js |
| 25677 |
var html$1; |
| 25678 |
var init_html = __esmMin((() => { |
| 25679 |
init_types(); |
| 25680 |
init_create(); |
| 25681 |
init_case_insensitive_transform(); |
| 25682 |
html$1 = create({ |
| 25683 |
space: "html", |
| 25684 |
attributes: { |
| 25685 |
acceptcharset: "accept-charset", |
| 25686 |
classname: "class", |
| 25687 |
htmlfor: "for", |
| 25688 |
httpequiv: "http-equiv" |
| 25689 |
}, |
| 25690 |
transform: caseInsensitiveTransform, |
| 25691 |
mustUseProperty: [ |
| 25692 |
"checked", |
| 25693 |
"multiple", |
| 25694 |
"muted", |
| 25695 |
"selected" |
| 25696 |
], |
| 25697 |
properties: { |
| 25698 |
abbr: null, |
| 25699 |
accept: commaSeparated, |
| 25700 |
acceptCharset: spaceSeparated, |
| 25701 |
accessKey: spaceSeparated, |
| 25702 |
action: null, |
| 25703 |
allow: null, |
| 25704 |
allowFullScreen: boolean, |
| 25705 |
allowPaymentRequest: boolean, |
| 25706 |
allowUserMedia: boolean, |
| 25707 |
alt: null, |
| 25708 |
as: null, |
| 25709 |
async: boolean, |
| 25710 |
autoCapitalize: null, |
| 25711 |
autoComplete: spaceSeparated, |
| 25712 |
autoFocus: boolean, |
| 25713 |
autoPlay: boolean, |
| 25714 |
blocking: spaceSeparated, |
| 25715 |
capture: null, |
| 25716 |
charSet: null, |
| 25717 |
checked: boolean, |
| 25718 |
cite: null, |
| 25719 |
className: spaceSeparated, |
| 25720 |
cols: number, |
| 25721 |
colSpan: null, |
| 25722 |
content: null, |
| 25723 |
contentEditable: booleanish, |
| 25724 |
controls: boolean, |
| 25725 |
controlsList: spaceSeparated, |
| 25726 |
coords: number | commaSeparated, |
| 25727 |
crossOrigin: null, |
| 25728 |
data: null, |
| 25729 |
dateTime: null, |
| 25730 |
decoding: null, |
| 25731 |
default: boolean, |
| 25732 |
defer: boolean, |
| 25733 |
dir: null, |
| 25734 |
dirName: null, |
| 25735 |
disabled: boolean, |
| 25736 |
download: overloadedBoolean, |
| 25737 |
draggable: booleanish, |
| 25738 |
encType: null, |
| 25739 |
enterKeyHint: null, |
| 25740 |
fetchPriority: null, |
| 25741 |
form: null, |
| 25742 |
formAction: null, |
| 25743 |
formEncType: null, |
| 25744 |
formMethod: null, |
| 25745 |
formNoValidate: boolean, |
| 25746 |
formTarget: null, |
| 25747 |
headers: spaceSeparated, |
| 25748 |
height: number, |
| 25749 |
hidden: boolean, |
| 25750 |
high: number, |
| 25751 |
href: null, |
| 25752 |
hrefLang: null, |
| 25753 |
htmlFor: spaceSeparated, |
| 25754 |
httpEquiv: spaceSeparated, |
| 25755 |
id: null, |
| 25756 |
imageSizes: null, |
| 25757 |
imageSrcSet: null, |
| 25758 |
inert: boolean, |
| 25759 |
inputMode: null, |
| 25760 |
integrity: null, |
| 25761 |
is: null, |
| 25762 |
isMap: boolean, |
| 25763 |
itemId: null, |
| 25764 |
itemProp: spaceSeparated, |
| 25765 |
itemRef: spaceSeparated, |
| 25766 |
itemScope: boolean, |
| 25767 |
itemType: spaceSeparated, |
| 25768 |
kind: null, |
| 25769 |
label: null, |
| 25770 |
lang: null, |
| 25771 |
language: null, |
| 25772 |
list: null, |
| 25773 |
loading: null, |
| 25774 |
loop: boolean, |
| 25775 |
low: number, |
| 25776 |
manifest: null, |
| 25777 |
max: null, |
| 25778 |
maxLength: number, |
| 25779 |
media: null, |
| 25780 |
method: null, |
| 25781 |
min: null, |
| 25782 |
minLength: number, |
| 25783 |
multiple: boolean, |
| 25784 |
muted: boolean, |
| 25785 |
name: null, |
| 25786 |
nonce: null, |
| 25787 |
noModule: boolean, |
| 25788 |
noValidate: boolean, |
| 25789 |
onAbort: null, |
| 25790 |
onAfterPrint: null, |
| 25791 |
onAuxClick: null, |
| 25792 |
onBeforeMatch: null, |
| 25793 |
onBeforePrint: null, |
| 25794 |
onBeforeToggle: null, |
| 25795 |
onBeforeUnload: null, |
| 25796 |
onBlur: null, |
| 25797 |
onCancel: null, |
| 25798 |
onCanPlay: null, |
| 25799 |
onCanPlayThrough: null, |
| 25800 |
onChange: null, |
| 25801 |
onClick: null, |
| 25802 |
onClose: null, |
| 25803 |
onContextLost: null, |
| 25804 |
onContextMenu: null, |
| 25805 |
onContextRestored: null, |
| 25806 |
onCopy: null, |
| 25807 |
onCueChange: null, |
| 25808 |
onCut: null, |
| 25809 |
onDblClick: null, |
| 25810 |
onDrag: null, |
| 25811 |
onDragEnd: null, |
| 25812 |
onDragEnter: null, |
| 25813 |
onDragExit: null, |
| 25814 |
onDragLeave: null, |
| 25815 |
onDragOver: null, |
| 25816 |
onDragStart: null, |
| 25817 |
onDrop: null, |
| 25818 |
onDurationChange: null, |
| 25819 |
onEmptied: null, |
| 25820 |
onEnded: null, |
| 25821 |
onError: null, |
| 25822 |
onFocus: null, |
| 25823 |
onFormData: null, |
| 25824 |
onHashChange: null, |
| 25825 |
onInput: null, |
| 25826 |
onInvalid: null, |
| 25827 |
onKeyDown: null, |
| 25828 |
onKeyPress: null, |
| 25829 |
onKeyUp: null, |
| 25830 |
onLanguageChange: null, |
| 25831 |
onLoad: null, |
| 25832 |
onLoadedData: null, |
| 25833 |
onLoadedMetadata: null, |
| 25834 |
onLoadEnd: null, |
| 25835 |
onLoadStart: null, |
| 25836 |
onMessage: null, |
| 25837 |
onMessageError: null, |
| 25838 |
onMouseDown: null, |
| 25839 |
onMouseEnter: null, |
| 25840 |
onMouseLeave: null, |
| 25841 |
onMouseMove: null, |
| 25842 |
onMouseOut: null, |
| 25843 |
onMouseOver: null, |
| 25844 |
onMouseUp: null, |
| 25845 |
onOffline: null, |
| 25846 |
onOnline: null, |
| 25847 |
onPageHide: null, |
| 25848 |
onPageShow: null, |
| 25849 |
onPaste: null, |
| 25850 |
onPause: null, |
| 25851 |
onPlay: null, |
| 25852 |
onPlaying: null, |
| 25853 |
onPopState: null, |
| 25854 |
onProgress: null, |
| 25855 |
onRateChange: null, |
| 25856 |
onRejectionHandled: null, |
| 25857 |
onReset: null, |
| 25858 |
onResize: null, |
| 25859 |
onScroll: null, |
| 25860 |
onScrollEnd: null, |
| 25861 |
onSecurityPolicyViolation: null, |
| 25862 |
onSeeked: null, |
| 25863 |
onSeeking: null, |
| 25864 |
onSelect: null, |
| 25865 |
onSlotChange: null, |
| 25866 |
onStalled: null, |
| 25867 |
onStorage: null, |
| 25868 |
onSubmit: null, |
| 25869 |
onSuspend: null, |
| 25870 |
onTimeUpdate: null, |
| 25871 |
onToggle: null, |
| 25872 |
onUnhandledRejection: null, |
| 25873 |
onUnload: null, |
| 25874 |
onVolumeChange: null, |
| 25875 |
onWaiting: null, |
| 25876 |
onWheel: null, |
| 25877 |
open: boolean, |
| 25878 |
optimum: number, |
| 25879 |
pattern: null, |
| 25880 |
ping: spaceSeparated, |
| 25881 |
placeholder: null, |
| 25882 |
playsInline: boolean, |
| 25883 |
popover: null, |
| 25884 |
popoverTarget: null, |
| 25885 |
popoverTargetAction: null, |
| 25886 |
poster: null, |
| 25887 |
preload: null, |
| 25888 |
readOnly: boolean, |
| 25889 |
referrerPolicy: null, |
| 25890 |
rel: spaceSeparated, |
| 25891 |
required: boolean, |
| 25892 |
reversed: boolean, |
| 25893 |
rows: number, |
| 25894 |
rowSpan: number, |
| 25895 |
sandbox: spaceSeparated, |
| 25896 |
scope: null, |
| 25897 |
scoped: boolean, |
| 25898 |
seamless: boolean, |
| 25899 |
selected: boolean, |
| 25900 |
shadowRootClonable: boolean, |
| 25901 |
shadowRootDelegatesFocus: boolean, |
| 25902 |
shadowRootMode: null, |
| 25903 |
shape: null, |
| 25904 |
size: number, |
| 25905 |
sizes: null, |
| 25906 |
slot: null, |
| 25907 |
span: number, |
| 25908 |
spellCheck: booleanish, |
| 25909 |
src: null, |
| 25910 |
srcDoc: null, |
| 25911 |
srcLang: null, |
| 25912 |
srcSet: null, |
| 25913 |
start: number, |
| 25914 |
step: null, |
| 25915 |
style: null, |
| 25916 |
tabIndex: number, |
| 25917 |
target: null, |
| 25918 |
title: null, |
| 25919 |
translate: null, |
| 25920 |
type: null, |
| 25921 |
typeMustMatch: boolean, |
| 25922 |
useMap: null, |
| 25923 |
value: booleanish, |
| 25924 |
width: number, |
| 25925 |
wrap: null, |
| 25926 |
writingSuggestions: null, |
| 25927 |
align: null, |
| 25928 |
aLink: null, |
| 25929 |
archive: spaceSeparated, |
| 25930 |
axis: null, |
| 25931 |
background: null, |
| 25932 |
bgColor: null, |
| 25933 |
border: number, |
| 25934 |
borderColor: null, |
| 25935 |
bottomMargin: number, |
| 25936 |
cellPadding: null, |
| 25937 |
cellSpacing: null, |
| 25938 |
char: null, |
| 25939 |
charOff: null, |
| 25940 |
classId: null, |
| 25941 |
clear: null, |
| 25942 |
code: null, |
| 25943 |
codeBase: null, |
| 25944 |
codeType: null, |
| 25945 |
color: null, |
| 25946 |
compact: boolean, |
| 25947 |
declare: boolean, |
| 25948 |
event: null, |
| 25949 |
face: null, |
| 25950 |
frame: null, |
| 25951 |
frameBorder: null, |
| 25952 |
hSpace: number, |
| 25953 |
leftMargin: number, |
| 25954 |
link: null, |
| 25955 |
longDesc: null, |
| 25956 |
lowSrc: null, |
| 25957 |
marginHeight: number, |
| 25958 |
marginWidth: number, |
| 25959 |
noResize: boolean, |
| 25960 |
noHref: boolean, |
| 25961 |
noShade: boolean, |
| 25962 |
noWrap: boolean, |
| 25963 |
object: null, |
| 25964 |
profile: null, |
| 25965 |
prompt: null, |
| 25966 |
rev: null, |
| 25967 |
rightMargin: number, |
| 25968 |
rules: null, |
| 25969 |
scheme: null, |
| 25970 |
scrolling: booleanish, |
| 25971 |
standby: null, |
| 25972 |
summary: null, |
| 25973 |
text: null, |
| 25974 |
topMargin: number, |
| 25975 |
valueType: null, |
| 25976 |
version: null, |
| 25977 |
vAlign: null, |
| 25978 |
vLink: null, |
| 25979 |
vSpace: number, |
| 25980 |
allowTransparency: null, |
| 25981 |
autoCorrect: null, |
| 25982 |
autoSave: null, |
| 25983 |
disablePictureInPicture: boolean, |
| 25984 |
disableRemotePlayback: boolean, |
| 25985 |
prefix: null, |
| 25986 |
property: null, |
| 25987 |
results: number, |
| 25988 |
security: null, |
| 25989 |
unselectable: null |
| 25990 |
} |
| 25991 |
}); |
| 25992 |
})); |
| 25993 |
|
| 25994 |
//#endregion |
| 25995 |
//#region node_modules/property-information/lib/svg.js |
| 25996 |
var svg$1; |
| 25997 |
var init_svg = __esmMin((() => { |
| 25998 |
init_types(); |
| 25999 |
init_create(); |
| 26000 |
init_case_sensitive_transform(); |
| 26001 |
svg$1 = create({ |
| 26002 |
space: "svg", |
| 26003 |
attributes: { |
| 26004 |
accentHeight: "accent-height", |
| 26005 |
alignmentBaseline: "alignment-baseline", |
| 26006 |
arabicForm: "arabic-form", |
| 26007 |
baselineShift: "baseline-shift", |
| 26008 |
capHeight: "cap-height", |
| 26009 |
className: "class", |
| 26010 |
clipPath: "clip-path", |
| 26011 |
clipRule: "clip-rule", |
| 26012 |
colorInterpolation: "color-interpolation", |
| 26013 |
colorInterpolationFilters: "color-interpolation-filters", |
| 26014 |
colorProfile: "color-profile", |
| 26015 |
colorRendering: "color-rendering", |
| 26016 |
crossOrigin: "crossorigin", |
| 26017 |
dataType: "datatype", |
| 26018 |
dominantBaseline: "dominant-baseline", |
| 26019 |
enableBackground: "enable-background", |
| 26020 |
fillOpacity: "fill-opacity", |
| 26021 |
fillRule: "fill-rule", |
| 26022 |
floodColor: "flood-color", |
| 26023 |
floodOpacity: "flood-opacity", |
| 26024 |
fontFamily: "font-family", |
| 26025 |
fontSize: "font-size", |
| 26026 |
fontSizeAdjust: "font-size-adjust", |
| 26027 |
fontStretch: "font-stretch", |
| 26028 |
fontStyle: "font-style", |
| 26029 |
fontVariant: "font-variant", |
| 26030 |
fontWeight: "font-weight", |
| 26031 |
glyphName: "glyph-name", |
| 26032 |
glyphOrientationHorizontal: "glyph-orientation-horizontal", |
| 26033 |
glyphOrientationVertical: "glyph-orientation-vertical", |
| 26034 |
hrefLang: "hreflang", |
| 26035 |
horizAdvX: "horiz-adv-x", |
| 26036 |
horizOriginX: "horiz-origin-x", |
| 26037 |
horizOriginY: "horiz-origin-y", |
| 26038 |
imageRendering: "image-rendering", |
| 26039 |
letterSpacing: "letter-spacing", |
| 26040 |
lightingColor: "lighting-color", |
| 26041 |
markerEnd: "marker-end", |
| 26042 |
markerMid: "marker-mid", |
| 26043 |
markerStart: "marker-start", |
| 26044 |
navDown: "nav-down", |
| 26045 |
navDownLeft: "nav-down-left", |
| 26046 |
navDownRight: "nav-down-right", |
| 26047 |
navLeft: "nav-left", |
| 26048 |
navNext: "nav-next", |
| 26049 |
navPrev: "nav-prev", |
| 26050 |
navRight: "nav-right", |
| 26051 |
navUp: "nav-up", |
| 26052 |
navUpLeft: "nav-up-left", |
| 26053 |
navUpRight: "nav-up-right", |
| 26054 |
onAbort: "onabort", |
| 26055 |
onActivate: "onactivate", |
| 26056 |
onAfterPrint: "onafterprint", |
| 26057 |
onBeforePrint: "onbeforeprint", |
| 26058 |
onBegin: "onbegin", |
| 26059 |
onCancel: "oncancel", |
| 26060 |
onCanPlay: "oncanplay", |
| 26061 |
onCanPlayThrough: "oncanplaythrough", |
| 26062 |
onChange: "onchange", |
| 26063 |
onClick: "onclick", |
| 26064 |
onClose: "onclose", |
| 26065 |
onCopy: "oncopy", |
| 26066 |
onCueChange: "oncuechange", |
| 26067 |
onCut: "oncut", |
| 26068 |
onDblClick: "ondblclick", |
| 26069 |
onDrag: "ondrag", |
| 26070 |
onDragEnd: "ondragend", |
| 26071 |
onDragEnter: "ondragenter", |
| 26072 |
onDragExit: "ondragexit", |
| 26073 |
onDragLeave: "ondragleave", |
| 26074 |
onDragOver: "ondragover", |
| 26075 |
onDragStart: "ondragstart", |
| 26076 |
onDrop: "ondrop", |
| 26077 |
onDurationChange: "ondurationchange", |
| 26078 |
onEmptied: "onemptied", |
| 26079 |
onEnd: "onend", |
| 26080 |
onEnded: "onended", |
| 26081 |
onError: "onerror", |
| 26082 |
onFocus: "onfocus", |
| 26083 |
onFocusIn: "onfocusin", |
| 26084 |
onFocusOut: "onfocusout", |
| 26085 |
onHashChange: "onhashchange", |
| 26086 |
onInput: "oninput", |
| 26087 |
onInvalid: "oninvalid", |
| 26088 |
onKeyDown: "onkeydown", |
| 26089 |
onKeyPress: "onkeypress", |
| 26090 |
onKeyUp: "onkeyup", |
| 26091 |
onLoad: "onload", |
| 26092 |
onLoadedData: "onloadeddata", |
| 26093 |
onLoadedMetadata: "onloadedmetadata", |
| 26094 |
onLoadStart: "onloadstart", |
| 26095 |
onMessage: "onmessage", |
| 26096 |
onMouseDown: "onmousedown", |
| 26097 |
onMouseEnter: "onmouseenter", |
| 26098 |
onMouseLeave: "onmouseleave", |
| 26099 |
onMouseMove: "onmousemove", |
| 26100 |
onMouseOut: "onmouseout", |
| 26101 |
onMouseOver: "onmouseover", |
| 26102 |
onMouseUp: "onmouseup", |
| 26103 |
onMouseWheel: "onmousewheel", |
| 26104 |
onOffline: "onoffline", |
| 26105 |
onOnline: "ononline", |
| 26106 |
onPageHide: "onpagehide", |
| 26107 |
onPageShow: "onpageshow", |
| 26108 |
onPaste: "onpaste", |
| 26109 |
onPause: "onpause", |
| 26110 |
onPlay: "onplay", |
| 26111 |
onPlaying: "onplaying", |
| 26112 |
onPopState: "onpopstate", |
| 26113 |
onProgress: "onprogress", |
| 26114 |
onRateChange: "onratechange", |
| 26115 |
onRepeat: "onrepeat", |
| 26116 |
onReset: "onreset", |
| 26117 |
onResize: "onresize", |
| 26118 |
onScroll: "onscroll", |
| 26119 |
onSeeked: "onseeked", |
| 26120 |
onSeeking: "onseeking", |
| 26121 |
onSelect: "onselect", |
| 26122 |
onShow: "onshow", |
| 26123 |
onStalled: "onstalled", |
| 26124 |
onStorage: "onstorage", |
| 26125 |
onSubmit: "onsubmit", |
| 26126 |
onSuspend: "onsuspend", |
| 26127 |
onTimeUpdate: "ontimeupdate", |
| 26128 |
onToggle: "ontoggle", |
| 26129 |
onUnload: "onunload", |
| 26130 |
onVolumeChange: "onvolumechange", |
| 26131 |
onWaiting: "onwaiting", |
| 26132 |
onZoom: "onzoom", |
| 26133 |
overlinePosition: "overline-position", |
| 26134 |
overlineThickness: "overline-thickness", |
| 26135 |
paintOrder: "paint-order", |
| 26136 |
panose1: "panose-1", |
| 26137 |
pointerEvents: "pointer-events", |
| 26138 |
referrerPolicy: "referrerpolicy", |
| 26139 |
renderingIntent: "rendering-intent", |
| 26140 |
shapeRendering: "shape-rendering", |
| 26141 |
stopColor: "stop-color", |
| 26142 |
stopOpacity: "stop-opacity", |
| 26143 |
strikethroughPosition: "strikethrough-position", |
| 26144 |
strikethroughThickness: "strikethrough-thickness", |
| 26145 |
strokeDashArray: "stroke-dasharray", |
| 26146 |
strokeDashOffset: "stroke-dashoffset", |
| 26147 |
strokeLineCap: "stroke-linecap", |
| 26148 |
strokeLineJoin: "stroke-linejoin", |
| 26149 |
strokeMiterLimit: "stroke-miterlimit", |
| 26150 |
strokeOpacity: "stroke-opacity", |
| 26151 |
strokeWidth: "stroke-width", |
| 26152 |
tabIndex: "tabindex", |
| 26153 |
textAnchor: "text-anchor", |
| 26154 |
textDecoration: "text-decoration", |
| 26155 |
textRendering: "text-rendering", |
| 26156 |
transformOrigin: "transform-origin", |
| 26157 |
typeOf: "typeof", |
| 26158 |
underlinePosition: "underline-position", |
| 26159 |
underlineThickness: "underline-thickness", |
| 26160 |
unicodeBidi: "unicode-bidi", |
| 26161 |
unicodeRange: "unicode-range", |
| 26162 |
unitsPerEm: "units-per-em", |
| 26163 |
vAlphabetic: "v-alphabetic", |
| 26164 |
vHanging: "v-hanging", |
| 26165 |
vIdeographic: "v-ideographic", |
| 26166 |
vMathematical: "v-mathematical", |
| 26167 |
vectorEffect: "vector-effect", |
| 26168 |
vertAdvY: "vert-adv-y", |
| 26169 |
vertOriginX: "vert-origin-x", |
| 26170 |
vertOriginY: "vert-origin-y", |
| 26171 |
wordSpacing: "word-spacing", |
| 26172 |
writingMode: "writing-mode", |
| 26173 |
xHeight: "x-height", |
| 26174 |
playbackOrder: "playbackorder", |
| 26175 |
timelineBegin: "timelinebegin" |
| 26176 |
}, |
| 26177 |
transform: caseSensitiveTransform, |
| 26178 |
properties: { |
| 26179 |
about: commaOrSpaceSeparated, |
| 26180 |
accentHeight: number, |
| 26181 |
accumulate: null, |
| 26182 |
additive: null, |
| 26183 |
alignmentBaseline: null, |
| 26184 |
alphabetic: number, |
| 26185 |
amplitude: number, |
| 26186 |
arabicForm: null, |
| 26187 |
ascent: number, |
| 26188 |
attributeName: null, |
| 26189 |
attributeType: null, |
| 26190 |
azimuth: number, |
| 26191 |
bandwidth: null, |
| 26192 |
baselineShift: null, |
| 26193 |
baseFrequency: null, |
| 26194 |
baseProfile: null, |
| 26195 |
bbox: null, |
| 26196 |
begin: null, |
| 26197 |
bias: number, |
| 26198 |
by: null, |
| 26199 |
calcMode: null, |
| 26200 |
capHeight: number, |
| 26201 |
className: spaceSeparated, |
| 26202 |
clip: null, |
| 26203 |
clipPath: null, |
| 26204 |
clipPathUnits: null, |
| 26205 |
clipRule: null, |
| 26206 |
color: null, |
| 26207 |
colorInterpolation: null, |
| 26208 |
colorInterpolationFilters: null, |
| 26209 |
colorProfile: null, |
| 26210 |
colorRendering: null, |
| 26211 |
content: null, |
| 26212 |
contentScriptType: null, |
| 26213 |
contentStyleType: null, |
| 26214 |
crossOrigin: null, |
| 26215 |
cursor: null, |
| 26216 |
cx: null, |
| 26217 |
cy: null, |
| 26218 |
d: null, |
| 26219 |
dataType: null, |
| 26220 |
defaultAction: null, |
| 26221 |
descent: number, |
| 26222 |
diffuseConstant: number, |
| 26223 |
direction: null, |
| 26224 |
display: null, |
| 26225 |
dur: null, |
| 26226 |
divisor: number, |
| 26227 |
dominantBaseline: null, |
| 26228 |
download: boolean, |
| 26229 |
dx: null, |
| 26230 |
dy: null, |
| 26231 |
edgeMode: null, |
| 26232 |
editable: null, |
| 26233 |
elevation: number, |
| 26234 |
enableBackground: null, |
| 26235 |
end: null, |
| 26236 |
event: null, |
| 26237 |
exponent: number, |
| 26238 |
externalResourcesRequired: null, |
| 26239 |
fill: null, |
| 26240 |
fillOpacity: number, |
| 26241 |
fillRule: null, |
| 26242 |
filter: null, |
| 26243 |
filterRes: null, |
| 26244 |
filterUnits: null, |
| 26245 |
floodColor: null, |
| 26246 |
floodOpacity: null, |
| 26247 |
focusable: null, |
| 26248 |
focusHighlight: null, |
| 26249 |
fontFamily: null, |
| 26250 |
fontSize: null, |
| 26251 |
fontSizeAdjust: null, |
| 26252 |
fontStretch: null, |
| 26253 |
fontStyle: null, |
| 26254 |
fontVariant: null, |
| 26255 |
fontWeight: null, |
| 26256 |
format: null, |
| 26257 |
fr: null, |
| 26258 |
from: null, |
| 26259 |
fx: null, |
| 26260 |
fy: null, |
| 26261 |
g1: commaSeparated, |
| 26262 |
g2: commaSeparated, |
| 26263 |
glyphName: commaSeparated, |
| 26264 |
glyphOrientationHorizontal: null, |
| 26265 |
glyphOrientationVertical: null, |
| 26266 |
glyphRef: null, |
| 26267 |
gradientTransform: null, |
| 26268 |
gradientUnits: null, |
| 26269 |
handler: null, |
| 26270 |
hanging: number, |
| 26271 |
hatchContentUnits: null, |
| 26272 |
hatchUnits: null, |
| 26273 |
height: null, |
| 26274 |
href: null, |
| 26275 |
hrefLang: null, |
| 26276 |
horizAdvX: number, |
| 26277 |
horizOriginX: number, |
| 26278 |
horizOriginY: number, |
| 26279 |
id: null, |
| 26280 |
ideographic: number, |
| 26281 |
imageRendering: null, |
| 26282 |
initialVisibility: null, |
| 26283 |
in: null, |
| 26284 |
in2: null, |
| 26285 |
intercept: number, |
| 26286 |
k: number, |
| 26287 |
k1: number, |
| 26288 |
k2: number, |
| 26289 |
k3: number, |
| 26290 |
k4: number, |
| 26291 |
kernelMatrix: commaOrSpaceSeparated, |
| 26292 |
kernelUnitLength: null, |
| 26293 |
keyPoints: null, |
| 26294 |
keySplines: null, |
| 26295 |
keyTimes: null, |
| 26296 |
kerning: null, |
| 26297 |
lang: null, |
| 26298 |
lengthAdjust: null, |
| 26299 |
letterSpacing: null, |
| 26300 |
lightingColor: null, |
| 26301 |
limitingConeAngle: number, |
| 26302 |
local: null, |
| 26303 |
markerEnd: null, |
| 26304 |
markerMid: null, |
| 26305 |
markerStart: null, |
| 26306 |
markerHeight: null, |
| 26307 |
markerUnits: null, |
| 26308 |
markerWidth: null, |
| 26309 |
mask: null, |
| 26310 |
maskContentUnits: null, |
| 26311 |
maskUnits: null, |
| 26312 |
mathematical: null, |
| 26313 |
max: null, |
| 26314 |
media: null, |
| 26315 |
mediaCharacterEncoding: null, |
| 26316 |
mediaContentEncodings: null, |
| 26317 |
mediaSize: number, |
| 26318 |
mediaTime: null, |
| 26319 |
method: null, |
| 26320 |
min: null, |
| 26321 |
mode: null, |
| 26322 |
name: null, |
| 26323 |
navDown: null, |
| 26324 |
navDownLeft: null, |
| 26325 |
navDownRight: null, |
| 26326 |
navLeft: null, |
| 26327 |
navNext: null, |
| 26328 |
navPrev: null, |
| 26329 |
navRight: null, |
| 26330 |
navUp: null, |
| 26331 |
navUpLeft: null, |
| 26332 |
navUpRight: null, |
| 26333 |
numOctaves: null, |
| 26334 |
observer: null, |
| 26335 |
offset: null, |
| 26336 |
onAbort: null, |
| 26337 |
onActivate: null, |
| 26338 |
onAfterPrint: null, |
| 26339 |
onBeforePrint: null, |
| 26340 |
onBegin: null, |
| 26341 |
onCancel: null, |
| 26342 |
onCanPlay: null, |
| 26343 |
onCanPlayThrough: null, |
| 26344 |
onChange: null, |
| 26345 |
onClick: null, |
| 26346 |
onClose: null, |
| 26347 |
onCopy: null, |
| 26348 |
onCueChange: null, |
| 26349 |
onCut: null, |
| 26350 |
onDblClick: null, |
| 26351 |
onDrag: null, |
| 26352 |
onDragEnd: null, |
| 26353 |
onDragEnter: null, |
| 26354 |
onDragExit: null, |
| 26355 |
onDragLeave: null, |
| 26356 |
onDragOver: null, |
| 26357 |
onDragStart: null, |
| 26358 |
onDrop: null, |
| 26359 |
onDurationChange: null, |
| 26360 |
onEmptied: null, |
| 26361 |
onEnd: null, |
| 26362 |
onEnded: null, |
| 26363 |
onError: null, |
| 26364 |
onFocus: null, |
| 26365 |
onFocusIn: null, |
| 26366 |
onFocusOut: null, |
| 26367 |
onHashChange: null, |
| 26368 |
onInput: null, |
| 26369 |
onInvalid: null, |
| 26370 |
onKeyDown: null, |
| 26371 |
onKeyPress: null, |
| 26372 |
onKeyUp: null, |
| 26373 |
onLoad: null, |
| 26374 |
onLoadedData: null, |
| 26375 |
onLoadedMetadata: null, |
| 26376 |
onLoadStart: null, |
| 26377 |
onMessage: null, |
| 26378 |
onMouseDown: null, |
| 26379 |
onMouseEnter: null, |
| 26380 |
onMouseLeave: null, |
| 26381 |
onMouseMove: null, |
| 26382 |
onMouseOut: null, |
| 26383 |
onMouseOver: null, |
| 26384 |
onMouseUp: null, |
| 26385 |
onMouseWheel: null, |
| 26386 |
onOffline: null, |
| 26387 |
onOnline: null, |
| 26388 |
onPageHide: null, |
| 26389 |
onPageShow: null, |
| 26390 |
onPaste: null, |
| 26391 |
onPause: null, |
| 26392 |
onPlay: null, |
| 26393 |
onPlaying: null, |
| 26394 |
onPopState: null, |
| 26395 |
onProgress: null, |
| 26396 |
onRateChange: null, |
| 26397 |
onRepeat: null, |
| 26398 |
onReset: null, |
| 26399 |
onResize: null, |
| 26400 |
onScroll: null, |
| 26401 |
onSeeked: null, |
| 26402 |
onSeeking: null, |
| 26403 |
onSelect: null, |
| 26404 |
onShow: null, |
| 26405 |
onStalled: null, |
| 26406 |
onStorage: null, |
| 26407 |
onSubmit: null, |
| 26408 |
onSuspend: null, |
| 26409 |
onTimeUpdate: null, |
| 26410 |
onToggle: null, |
| 26411 |
onUnload: null, |
| 26412 |
onVolumeChange: null, |
| 26413 |
onWaiting: null, |
| 26414 |
onZoom: null, |
| 26415 |
opacity: null, |
| 26416 |
operator: null, |
| 26417 |
order: null, |
| 26418 |
orient: null, |
| 26419 |
orientation: null, |
| 26420 |
origin: null, |
| 26421 |
overflow: null, |
| 26422 |
overlay: null, |
| 26423 |
overlinePosition: number, |
| 26424 |
overlineThickness: number, |
| 26425 |
paintOrder: null, |
| 26426 |
panose1: null, |
| 26427 |
path: null, |
| 26428 |
pathLength: number, |
| 26429 |
patternContentUnits: null, |
| 26430 |
patternTransform: null, |
| 26431 |
patternUnits: null, |
| 26432 |
phase: null, |
| 26433 |
ping: spaceSeparated, |
| 26434 |
pitch: null, |
| 26435 |
playbackOrder: null, |
| 26436 |
pointerEvents: null, |
| 26437 |
points: null, |
| 26438 |
pointsAtX: number, |
| 26439 |
pointsAtY: number, |
| 26440 |
pointsAtZ: number, |
| 26441 |
preserveAlpha: null, |
| 26442 |
preserveAspectRatio: null, |
| 26443 |
primitiveUnits: null, |
| 26444 |
propagate: null, |
| 26445 |
property: commaOrSpaceSeparated, |
| 26446 |
r: null, |
| 26447 |
radius: null, |
| 26448 |
referrerPolicy: null, |
| 26449 |
refX: null, |
| 26450 |
refY: null, |
| 26451 |
rel: commaOrSpaceSeparated, |
| 26452 |
rev: commaOrSpaceSeparated, |
| 26453 |
renderingIntent: null, |
| 26454 |
repeatCount: null, |
| 26455 |
repeatDur: null, |
| 26456 |
requiredExtensions: commaOrSpaceSeparated, |
| 26457 |
requiredFeatures: commaOrSpaceSeparated, |
| 26458 |
requiredFonts: commaOrSpaceSeparated, |
| 26459 |
requiredFormats: commaOrSpaceSeparated, |
| 26460 |
resource: null, |
| 26461 |
restart: null, |
| 26462 |
result: null, |
| 26463 |
rotate: null, |
| 26464 |
rx: null, |
| 26465 |
ry: null, |
| 26466 |
scale: null, |
| 26467 |
seed: null, |
| 26468 |
shapeRendering: null, |
| 26469 |
side: null, |
| 26470 |
slope: null, |
| 26471 |
snapshotTime: null, |
| 26472 |
specularConstant: number, |
| 26473 |
specularExponent: number, |
| 26474 |
spreadMethod: null, |
| 26475 |
spacing: null, |
| 26476 |
startOffset: null, |
| 26477 |
stdDeviation: null, |
| 26478 |
stemh: null, |
| 26479 |
stemv: null, |
| 26480 |
stitchTiles: null, |
| 26481 |
stopColor: null, |
| 26482 |
stopOpacity: null, |
| 26483 |
strikethroughPosition: number, |
| 26484 |
strikethroughThickness: number, |
| 26485 |
string: null, |
| 26486 |
stroke: null, |
| 26487 |
strokeDashArray: commaOrSpaceSeparated, |
| 26488 |
strokeDashOffset: null, |
| 26489 |
strokeLineCap: null, |
| 26490 |
strokeLineJoin: null, |
| 26491 |
strokeMiterLimit: number, |
| 26492 |
strokeOpacity: number, |
| 26493 |
strokeWidth: null, |
| 26494 |
style: null, |
| 26495 |
surfaceScale: number, |
| 26496 |
syncBehavior: null, |
| 26497 |
syncBehaviorDefault: null, |
| 26498 |
syncMaster: null, |
| 26499 |
syncTolerance: null, |
| 26500 |
syncToleranceDefault: null, |
| 26501 |
systemLanguage: commaOrSpaceSeparated, |
| 26502 |
tabIndex: number, |
| 26503 |
tableValues: null, |
| 26504 |
target: null, |
| 26505 |
targetX: number, |
| 26506 |
targetY: number, |
| 26507 |
textAnchor: null, |
| 26508 |
textDecoration: null, |
| 26509 |
textRendering: null, |
| 26510 |
textLength: null, |
| 26511 |
timelineBegin: null, |
| 26512 |
title: null, |
| 26513 |
transformBehavior: null, |
| 26514 |
type: null, |
| 26515 |
typeOf: commaOrSpaceSeparated, |
| 26516 |
to: null, |
| 26517 |
transform: null, |
| 26518 |
transformOrigin: null, |
| 26519 |
u1: null, |
| 26520 |
u2: null, |
| 26521 |
underlinePosition: number, |
| 26522 |
underlineThickness: number, |
| 26523 |
unicode: null, |
| 26524 |
unicodeBidi: null, |
| 26525 |
unicodeRange: null, |
| 26526 |
unitsPerEm: number, |
| 26527 |
values: null, |
| 26528 |
vAlphabetic: number, |
| 26529 |
vMathematical: number, |
| 26530 |
vectorEffect: null, |
| 26531 |
vHanging: number, |
| 26532 |
vIdeographic: number, |
| 26533 |
version: null, |
| 26534 |
vertAdvY: number, |
| 26535 |
vertOriginX: number, |
| 26536 |
vertOriginY: number, |
| 26537 |
viewBox: null, |
| 26538 |
viewTarget: null, |
| 26539 |
visibility: null, |
| 26540 |
width: null, |
| 26541 |
widths: null, |
| 26542 |
wordSpacing: null, |
| 26543 |
writingMode: null, |
| 26544 |
x: null, |
| 26545 |
x1: null, |
| 26546 |
x2: null, |
| 26547 |
xChannelSelector: null, |
| 26548 |
xHeight: number, |
| 26549 |
y: null, |
| 26550 |
y1: null, |
| 26551 |
y2: null, |
| 26552 |
yChannelSelector: null, |
| 26553 |
z: null, |
| 26554 |
zoomAndPan: null |
| 26555 |
} |
| 26556 |
}); |
| 26557 |
})); |
| 26558 |
|
| 26559 |
//#endregion |
| 26560 |
//#region node_modules/property-information/lib/find.js |
| 26561 |
/** |
| 26562 |
* @param {Schema} schema |
| 26563 |
* @param {string} value |
| 26564 |
* @returns {Info} |
| 26565 |
*/ |
| 26566 |
function find(schema, value) { |
| 26567 |
const normal = normalize(value); |
| 26568 |
let prop = value; |
| 26569 |
let Type = Info; |
| 26570 |
if (normal in schema.normal) return schema.property[schema.normal[normal]]; |
| 26571 |
if (normal.length > 4 && normal.slice(0, 4) === "data" && valid.test(value)) { |
| 26572 |
if (value.charAt(4) === "-") { |
| 26573 |
const rest = value.slice(5).replace(dash, camelcase); |
| 26574 |
prop = "data" + rest.charAt(0).toUpperCase() + rest.slice(1); |
| 26575 |
} else { |
| 26576 |
const rest = value.slice(4); |
| 26577 |
if (!dash.test(rest)) { |
| 26578 |
let dashes = rest.replace(cap, kebab); |
| 26579 |
if (dashes.charAt(0) !== "-") dashes = "-" + dashes; |
| 26580 |
value = "data" + dashes; |
| 26581 |
} |
| 26582 |
} |
| 26583 |
Type = DefinedInfo; |
| 26584 |
} |
| 26585 |
return new Type(prop, value); |
| 26586 |
} |
| 26587 |
/** |
| 26588 |
* @param {string} $0 |
| 26589 |
* @returns {string} |
| 26590 |
*/ |
| 26591 |
function kebab($0) { |
| 26592 |
return "-" + $0.toLowerCase(); |
| 26593 |
} |
| 26594 |
/** |
| 26595 |
* @param {string} $0 |
| 26596 |
* @returns {string} |
| 26597 |
*/ |
| 26598 |
function camelcase($0) { |
| 26599 |
return $0.charAt(1).toUpperCase(); |
| 26600 |
} |
| 26601 |
var valid, dash, cap; |
| 26602 |
var init_find = __esmMin((() => { |
| 26603 |
init_normalize(); |
| 26604 |
init_defined_info(); |
| 26605 |
init_info(); |
| 26606 |
valid = /^data[-\w.:]+$/i; |
| 26607 |
dash = /-[a-z]/g; |
| 26608 |
cap = /[A-Z]/g; |
| 26609 |
})); |
| 26610 |
|
| 26611 |
//#endregion |
| 26612 |
//#region node_modules/property-information/lib/hast-to-react.js |
| 26613 |
var hastToReact; |
| 26614 |
var init_hast_to_react = __esmMin((() => { |
| 26615 |
hastToReact = { |
| 26616 |
classId: "classID", |
| 26617 |
dataType: "datatype", |
| 26618 |
itemId: "itemID", |
| 26619 |
strokeDashArray: "strokeDasharray", |
| 26620 |
strokeDashOffset: "strokeDashoffset", |
| 26621 |
strokeLineCap: "strokeLinecap", |
| 26622 |
strokeLineJoin: "strokeLinejoin", |
| 26623 |
strokeMiterLimit: "strokeMiterlimit", |
| 26624 |
typeOf: "typeof", |
| 26625 |
xLinkActuate: "xlinkActuate", |
| 26626 |
xLinkArcRole: "xlinkArcrole", |
| 26627 |
xLinkHref: "xlinkHref", |
| 26628 |
xLinkRole: "xlinkRole", |
| 26629 |
xLinkShow: "xlinkShow", |
| 26630 |
xLinkTitle: "xlinkTitle", |
| 26631 |
xLinkType: "xlinkType", |
| 26632 |
xmlnsXLink: "xmlnsXlink" |
| 26633 |
}; |
| 26634 |
})); |
| 26635 |
|
| 26636 |
//#endregion |
| 26637 |
//#region node_modules/property-information/index.js |
| 26638 |
var html, svg; |
| 26639 |
var init_property_information = __esmMin((() => { |
| 26640 |
init_merge(); |
| 26641 |
init_xlink(); |
| 26642 |
init_xml(); |
| 26643 |
init_xmlns(); |
| 26644 |
init_aria(); |
| 26645 |
init_html(); |
| 26646 |
init_svg(); |
| 26647 |
init_find(); |
| 26648 |
init_hast_to_react(); |
| 26649 |
init_normalize(); |
| 26650 |
html = merge([ |
| 26651 |
xml, |
| 26652 |
xlink, |
| 26653 |
xmlns, |
| 26654 |
aria, |
| 26655 |
html$1 |
| 26656 |
], "html"); |
| 26657 |
svg = merge([ |
| 26658 |
xml, |
| 26659 |
xlink, |
| 26660 |
xmlns, |
| 26661 |
aria, |
| 26662 |
svg$1 |
| 26663 |
], "svg"); |
| 26664 |
})); |
| 26665 |
|
| 26666 |
//#endregion |
| 26667 |
//#region node_modules/react-markdown/lib/rehype-filter.js |
| 26668 |
/** |
| 26669 |
* @typedef {import('unist').Node} Node |
| 26670 |
* @typedef {import('hast').Root} Root |
| 26671 |
* @typedef {import('hast').Element} Element |
| 26672 |
* |
| 26673 |
* @callback AllowElement |
| 26674 |
* @param {Element} element |
| 26675 |
* @param {number} index |
| 26676 |
* @param {Element|Root} parent |
| 26677 |
* @returns {boolean|undefined} |
| 26678 |
* |
| 26679 |
* @typedef Options |
| 26680 |
* @property {Array<string>} [allowedElements] |
| 26681 |
* @property {Array<string>} [disallowedElements=[]] |
| 26682 |
* @property {AllowElement} [allowElement] |
| 26683 |
* @property {boolean} [unwrapDisallowed=false] |
| 26684 |
*/ |
| 26685 |
/** |
| 26686 |
* @type {import('unified').Plugin<[Options], Root>} |
| 26687 |
*/ |
| 26688 |
function rehypeFilter(options) { |
| 26689 |
if (options.allowedElements && options.disallowedElements) throw new TypeError("Only one of `allowedElements` and `disallowedElements` should be defined"); |
| 26690 |
if (options.allowedElements || options.disallowedElements || options.allowElement) return (tree) => { |
| 26691 |
visit(tree, "element", (node, index, parent_) => { |
| 26692 |
const parent = parent_; |
| 26693 |
/** @type {boolean|undefined} */ |
| 26694 |
let remove; |
| 26695 |
if (options.allowedElements) remove = !options.allowedElements.includes(node.tagName); |
| 26696 |
else if (options.disallowedElements) remove = options.disallowedElements.includes(node.tagName); |
| 26697 |
if (!remove && options.allowElement && typeof index === "number") remove = !options.allowElement(node, index, parent); |
| 26698 |
if (remove && typeof index === "number") { |
| 26699 |
if (options.unwrapDisallowed && node.children) parent.children.splice(index, 1, ...node.children); |
| 26700 |
else parent.children.splice(index, 1); |
| 26701 |
return index; |
| 26702 |
} |
| 26703 |
}); |
| 26704 |
}; |
| 26705 |
} |
| 26706 |
var init_rehype_filter = __esmMin((() => { |
| 26707 |
init_unist_util_visit(); |
| 26708 |
})); |
| 26709 |
|
| 26710 |
//#endregion |
| 26711 |
//#region node_modules/react-is/cjs/react-is.development.js |
| 26712 |
/** |
| 26713 |
* @license React |
| 26714 |
* react-is.development.js |
| 26715 |
* |
| 26716 |
* Copyright (c) Facebook, Inc. and its affiliates. |
| 26717 |
* |
| 26718 |
* This source code is licensed under the MIT license found in the |
| 26719 |
* LICENSE file in the root directory of this source tree. |
| 26720 |
*/ |
| 26721 |
var require_react_is_development = /* @__PURE__ */ __commonJSMin(((exports) => { |
| 26722 |
(function() { |
| 26723 |
"use strict"; |
| 26724 |
var REACT_ELEMENT_TYPE = Symbol.for("react.element"); |
| 26725 |
var REACT_PORTAL_TYPE = Symbol.for("react.portal"); |
| 26726 |
var REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"); |
| 26727 |
var REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"); |
| 26728 |
var REACT_PROFILER_TYPE = Symbol.for("react.profiler"); |
| 26729 |
var REACT_PROVIDER_TYPE = Symbol.for("react.provider"); |
| 26730 |
var REACT_CONTEXT_TYPE = Symbol.for("react.context"); |
| 26731 |
var REACT_SERVER_CONTEXT_TYPE = Symbol.for("react.server_context"); |
| 26732 |
var REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"); |
| 26733 |
var REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"); |
| 26734 |
var REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"); |
| 26735 |
var REACT_MEMO_TYPE = Symbol.for("react.memo"); |
| 26736 |
var REACT_LAZY_TYPE = Symbol.for("react.lazy"); |
| 26737 |
var REACT_OFFSCREEN_TYPE = Symbol.for("react.offscreen"); |
| 26738 |
var enableScopeAPI = false; |
| 26739 |
var enableCacheElement = false; |
| 26740 |
var enableTransitionTracing = false; |
| 26741 |
var enableLegacyHidden = false; |
| 26742 |
var enableDebugTracing = false; |
| 26743 |
var REACT_MODULE_REFERENCE = Symbol.for("react.module.reference"); |
| 26744 |
function isValidElementType(type) { |
| 26745 |
if (typeof type === "string" || typeof type === "function") return true; |
| 26746 |
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; |
| 26747 |
if (typeof type === "object" && type !== null) { |
| 26748 |
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; |
| 26749 |
} |
| 26750 |
return false; |
| 26751 |
} |
| 26752 |
function typeOf(object) { |
| 26753 |
if (typeof object === "object" && object !== null) { |
| 26754 |
var $$typeof = object.$$typeof; |
| 26755 |
switch ($$typeof) { |
| 26756 |
case REACT_ELEMENT_TYPE: |
| 26757 |
var type = object.type; |
| 26758 |
switch (type) { |
| 26759 |
case REACT_FRAGMENT_TYPE: |
| 26760 |
case REACT_PROFILER_TYPE: |
| 26761 |
case REACT_STRICT_MODE_TYPE: |
| 26762 |
case REACT_SUSPENSE_TYPE: |
| 26763 |
case REACT_SUSPENSE_LIST_TYPE: return type; |
| 26764 |
default: |
| 26765 |
var $$typeofType = type && type.$$typeof; |
| 26766 |
switch ($$typeofType) { |
| 26767 |
case REACT_SERVER_CONTEXT_TYPE: |
| 26768 |
case REACT_CONTEXT_TYPE: |
| 26769 |
case REACT_FORWARD_REF_TYPE: |
| 26770 |
case REACT_LAZY_TYPE: |
| 26771 |
case REACT_MEMO_TYPE: |
| 26772 |
case REACT_PROVIDER_TYPE: return $$typeofType; |
| 26773 |
default: return $$typeof; |
| 26774 |
} |
| 26775 |
} |
| 26776 |
case REACT_PORTAL_TYPE: return $$typeof; |
| 26777 |
} |
| 26778 |
} |
| 26779 |
} |
| 26780 |
var ContextConsumer = REACT_CONTEXT_TYPE; |
| 26781 |
var ContextProvider = REACT_PROVIDER_TYPE; |
| 26782 |
var Element = REACT_ELEMENT_TYPE; |
| 26783 |
var ForwardRef = REACT_FORWARD_REF_TYPE; |
| 26784 |
var Fragment = REACT_FRAGMENT_TYPE; |
| 26785 |
var Lazy = REACT_LAZY_TYPE; |
| 26786 |
var Memo = REACT_MEMO_TYPE; |
| 26787 |
var Portal = REACT_PORTAL_TYPE; |
| 26788 |
var Profiler = REACT_PROFILER_TYPE; |
| 26789 |
var StrictMode = REACT_STRICT_MODE_TYPE; |
| 26790 |
var Suspense = REACT_SUSPENSE_TYPE; |
| 26791 |
var SuspenseList = REACT_SUSPENSE_LIST_TYPE; |
| 26792 |
var hasWarnedAboutDeprecatedIsAsyncMode = false; |
| 26793 |
var hasWarnedAboutDeprecatedIsConcurrentMode = false; |
| 26794 |
function isAsyncMode(object) { |
| 26795 |
if (!hasWarnedAboutDeprecatedIsAsyncMode) { |
| 26796 |
hasWarnedAboutDeprecatedIsAsyncMode = true; |
| 26797 |
console["warn"]("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+."); |
| 26798 |
} |
| 26799 |
return false; |
| 26800 |
} |
| 26801 |
function isConcurrentMode(object) { |
| 26802 |
if (!hasWarnedAboutDeprecatedIsConcurrentMode) { |
| 26803 |
hasWarnedAboutDeprecatedIsConcurrentMode = true; |
| 26804 |
console["warn"]("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+."); |
| 26805 |
} |
| 26806 |
return false; |
| 26807 |
} |
| 26808 |
function isContextConsumer(object) { |
| 26809 |
return typeOf(object) === REACT_CONTEXT_TYPE; |
| 26810 |
} |
| 26811 |
function isContextProvider(object) { |
| 26812 |
return typeOf(object) === REACT_PROVIDER_TYPE; |
| 26813 |
} |
| 26814 |
function isElement(object) { |
| 26815 |
return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; |
| 26816 |
} |
| 26817 |
function isForwardRef(object) { |
| 26818 |
return typeOf(object) === REACT_FORWARD_REF_TYPE; |
| 26819 |
} |
| 26820 |
function isFragment(object) { |
| 26821 |
return typeOf(object) === REACT_FRAGMENT_TYPE; |
| 26822 |
} |
| 26823 |
function isLazy(object) { |
| 26824 |
return typeOf(object) === REACT_LAZY_TYPE; |
| 26825 |
} |
| 26826 |
function isMemo(object) { |
| 26827 |
return typeOf(object) === REACT_MEMO_TYPE; |
| 26828 |
} |
| 26829 |
function isPortal(object) { |
| 26830 |
return typeOf(object) === REACT_PORTAL_TYPE; |
| 26831 |
} |
| 26832 |
function isProfiler(object) { |
| 26833 |
return typeOf(object) === REACT_PROFILER_TYPE; |
| 26834 |
} |
| 26835 |
function isStrictMode(object) { |
| 26836 |
return typeOf(object) === REACT_STRICT_MODE_TYPE; |
| 26837 |
} |
| 26838 |
function isSuspense(object) { |
| 26839 |
return typeOf(object) === REACT_SUSPENSE_TYPE; |
| 26840 |
} |
| 26841 |
function isSuspenseList(object) { |
| 26842 |
return typeOf(object) === REACT_SUSPENSE_LIST_TYPE; |
| 26843 |
} |
| 26844 |
exports.ContextConsumer = ContextConsumer; |
| 26845 |
exports.ContextProvider = ContextProvider; |
| 26846 |
exports.Element = Element; |
| 26847 |
exports.ForwardRef = ForwardRef; |
| 26848 |
exports.Fragment = Fragment; |
| 26849 |
exports.Lazy = Lazy; |
| 26850 |
exports.Memo = Memo; |
| 26851 |
exports.Portal = Portal; |
| 26852 |
exports.Profiler = Profiler; |
| 26853 |
exports.StrictMode = StrictMode; |
| 26854 |
exports.Suspense = Suspense; |
| 26855 |
exports.SuspenseList = SuspenseList; |
| 26856 |
exports.isAsyncMode = isAsyncMode; |
| 26857 |
exports.isConcurrentMode = isConcurrentMode; |
| 26858 |
exports.isContextConsumer = isContextConsumer; |
| 26859 |
exports.isContextProvider = isContextProvider; |
| 26860 |
exports.isElement = isElement; |
| 26861 |
exports.isForwardRef = isForwardRef; |
| 26862 |
exports.isFragment = isFragment; |
| 26863 |
exports.isLazy = isLazy; |
| 26864 |
exports.isMemo = isMemo; |
| 26865 |
exports.isPortal = isPortal; |
| 26866 |
exports.isProfiler = isProfiler; |
| 26867 |
exports.isStrictMode = isStrictMode; |
| 26868 |
exports.isSuspense = isSuspense; |
| 26869 |
exports.isSuspenseList = isSuspenseList; |
| 26870 |
exports.isValidElementType = isValidElementType; |
| 26871 |
exports.typeOf = typeOf; |
| 26872 |
})(); |
| 26873 |
})); |
| 26874 |
|
| 26875 |
//#endregion |
| 26876 |
//#region node_modules/react-is/index.js |
| 26877 |
var require_react_is = /* @__PURE__ */ __commonJSMin(((exports, module) => { |
| 26878 |
module.exports = require_react_is_development(); |
| 26879 |
})); |
| 26880 |
|
| 26881 |
//#endregion |
| 26882 |
//#region node_modules/hast-util-whitespace/index.js |
| 26883 |
/** |
| 26884 |
* Check if the given value is *inter-element whitespace*. |
| 26885 |
* |
| 26886 |
* @param {unknown} thing |
| 26887 |
* Thing to check (typically `Node` or `string`). |
| 26888 |
* @returns {boolean} |
| 26889 |
* Whether the `value` is inter-element whitespace (`boolean`): consisting of |
| 26890 |
* zero or more of space, tab (`\t`), line feed (`\n`), carriage return |
| 26891 |
* (`\r`), or form feed (`\f`). |
| 26892 |
* If a node is passed it must be a `Text` node, whose `value` field is |
| 26893 |
* checked. |
| 26894 |
*/ |
| 26895 |
function whitespace(thing) { |
| 26896 |
/** @type {string} */ |
| 26897 |
const value = thing && typeof thing === "object" && thing.type === "text" ? thing.value || "" : thing; |
| 26898 |
return typeof value === "string" && value.replace(/[ \t\n\f\r]/g, "") === ""; |
| 26899 |
} |
| 26900 |
var init_hast_util_whitespace = __esmMin((() => {})); |
| 26901 |
|
| 26902 |
//#endregion |
| 26903 |
//#region node_modules/space-separated-tokens/index.js |
| 26904 |
/** |
| 26905 |
* Serialize an array of strings as space separated-tokens. |
| 26906 |
* |
| 26907 |
* @param {Array<string|number>} values |
| 26908 |
* List of tokens. |
| 26909 |
* @returns {string} |
| 26910 |
* Space-separated tokens. |
| 26911 |
*/ |
| 26912 |
function stringify$1(values) { |
| 26913 |
return values.join(" ").trim(); |
| 26914 |
} |
| 26915 |
var init_space_separated_tokens = __esmMin((() => { |
| 26916 |
__name(stringify$1, "stringify"); |
| 26917 |
})); |
| 26918 |
|
| 26919 |
//#endregion |
| 26920 |
//#region node_modules/comma-separated-tokens/index.js |
| 26921 |
/** |
| 26922 |
* Serialize an array of strings or numbers to comma-separated tokens. |
| 26923 |
* |
| 26924 |
* @param {Array<string|number>} values |
| 26925 |
* List of tokens. |
| 26926 |
* @param {Options} [options] |
| 26927 |
* Configuration for `stringify` (optional). |
| 26928 |
* @returns {string} |
| 26929 |
* Comma-separated tokens. |
| 26930 |
*/ |
| 26931 |
function stringify(values, options) { |
| 26932 |
const settings = options || {}; |
| 26933 |
return (values[values.length - 1] === "" ? [...values, ""] : values).join((settings.padRight ? " " : "") + "," + (settings.padLeft === false ? "" : " ")).trim(); |
| 26934 |
} |
| 26935 |
var init_comma_separated_tokens = __esmMin((() => {})); |
| 26936 |
|
| 26937 |
//#endregion |
| 26938 |
//#region node_modules/inline-style-parser/index.js |
| 26939 |
var require_inline_style_parser = /* @__PURE__ */ __commonJSMin(((exports, module) => { |
| 26940 |
var COMMENT_REGEX = /\/\*[^*]*\*+([^/*][^*]*\*+)*\//g; |
| 26941 |
var NEWLINE_REGEX = /\n/g; |
| 26942 |
var WHITESPACE_REGEX = /^\s*/; |
| 26943 |
var PROPERTY_REGEX = /^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/; |
| 26944 |
var COLON_REGEX = /^:\s*/; |
| 26945 |
var VALUE_REGEX = /^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/; |
| 26946 |
var SEMICOLON_REGEX = /^[;\s]*/; |
| 26947 |
var TRIM_REGEX = /^\s+|\s+$/g; |
| 26948 |
var NEWLINE = "\n"; |
| 26949 |
var FORWARD_SLASH = "/"; |
| 26950 |
var ASTERISK = "*"; |
| 26951 |
var EMPTY_STRING = ""; |
| 26952 |
var TYPE_COMMENT = "comment"; |
| 26953 |
var TYPE_DECLARATION = "declaration"; |
| 26954 |
/** |
| 26955 |
* @param {String} style |
| 26956 |
* @param {Object} [options] |
| 26957 |
* @return {Object[]} |
| 26958 |
* @throws {TypeError} |
| 26959 |
* @throws {Error} |
| 26960 |
*/ |
| 26961 |
module.exports = function(style, options) { |
| 26962 |
if (typeof style !== "string") throw new TypeError("First argument must be a string"); |
| 26963 |
if (!style) return []; |
| 26964 |
options = options || {}; |
| 26965 |
/** |
| 26966 |
* Positional. |
| 26967 |
*/ |
| 26968 |
var lineno = 1; |
| 26969 |
var column = 1; |
| 26970 |
/** |
| 26971 |
* Update lineno and column based on `str`. |
| 26972 |
* |
| 26973 |
* @param {String} str |
| 26974 |
*/ |
| 26975 |
function updatePosition(str) { |
| 26976 |
var lines = str.match(NEWLINE_REGEX); |
| 26977 |
if (lines) lineno += lines.length; |
| 26978 |
var i = str.lastIndexOf(NEWLINE); |
| 26979 |
column = ~i ? str.length - i : column + str.length; |
| 26980 |
} |
| 26981 |
/** |
| 26982 |
* Mark position and patch `node.position`. |
| 26983 |
* |
| 26984 |
* @return {Function} |
| 26985 |
*/ |
| 26986 |
function position() { |
| 26987 |
var start = { |
| 26988 |
line: lineno, |
| 26989 |
column |
| 26990 |
}; |
| 26991 |
return function(node) { |
| 26992 |
node.position = new Position(start); |
| 26993 |
whitespace(); |
| 26994 |
return node; |
| 26995 |
}; |
| 26996 |
} |
| 26997 |
/** |
| 26998 |
* Store position information for a node. |
| 26999 |
* |
| 27000 |
* @constructor |
| 27001 |
* @property {Object} start |
| 27002 |
* @property {Object} end |
| 27003 |
* @property {undefined|String} source |
| 27004 |
*/ |
| 27005 |
function Position(start) { |
| 27006 |
this.start = start; |
| 27007 |
this.end = { |
| 27008 |
line: lineno, |
| 27009 |
column |
| 27010 |
}; |
| 27011 |
this.source = options.source; |
| 27012 |
} |
| 27013 |
/** |
| 27014 |
* Non-enumerable source string. |
| 27015 |
*/ |
| 27016 |
Position.prototype.content = style; |
| 27017 |
var errorsList = []; |
| 27018 |
/** |
| 27019 |
* Error `msg`. |
| 27020 |
* |
| 27021 |
* @param {String} msg |
| 27022 |
* @throws {Error} |
| 27023 |
*/ |
| 27024 |
function error(msg) { |
| 27025 |
var err = /* @__PURE__ */ new Error(options.source + ":" + lineno + ":" + column + ": " + msg); |
| 27026 |
err.reason = msg; |
| 27027 |
err.filename = options.source; |
| 27028 |
err.line = lineno; |
| 27029 |
err.column = column; |
| 27030 |
err.source = style; |
| 27031 |
if (options.silent) errorsList.push(err); |
| 27032 |
else throw err; |
| 27033 |
} |
| 27034 |
/** |
| 27035 |
* Match `re` and return captures. |
| 27036 |
* |
| 27037 |
* @param {RegExp} re |
| 27038 |
* @return {undefined|Array} |
| 27039 |
*/ |
| 27040 |
function match(re) { |
| 27041 |
var m = re.exec(style); |
| 27042 |
if (!m) return; |
| 27043 |
var str = m[0]; |
| 27044 |
updatePosition(str); |
| 27045 |
style = style.slice(str.length); |
| 27046 |
return m; |
| 27047 |
} |
| 27048 |
/** |
| 27049 |
* Parse whitespace. |
| 27050 |
*/ |
| 27051 |
function whitespace() { |
| 27052 |
match(WHITESPACE_REGEX); |
| 27053 |
} |
| 27054 |
/** |
| 27055 |
* Parse comments. |
| 27056 |
* |
| 27057 |
* @param {Object[]} [rules] |
| 27058 |
* @return {Object[]} |
| 27059 |
*/ |
| 27060 |
function comments(rules) { |
| 27061 |
var c; |
| 27062 |
rules = rules || []; |
| 27063 |
while (c = comment()) if (c !== false) rules.push(c); |
| 27064 |
return rules; |
| 27065 |
} |
| 27066 |
/** |
| 27067 |
* Parse comment. |
| 27068 |
* |
| 27069 |
* @return {Object} |
| 27070 |
* @throws {Error} |
| 27071 |
*/ |
| 27072 |
function comment() { |
| 27073 |
var pos = position(); |
| 27074 |
if (FORWARD_SLASH != style.charAt(0) || ASTERISK != style.charAt(1)) return; |
| 27075 |
var i = 2; |
| 27076 |
while (EMPTY_STRING != style.charAt(i) && (ASTERISK != style.charAt(i) || FORWARD_SLASH != style.charAt(i + 1))) ++i; |
| 27077 |
i += 2; |
| 27078 |
if (EMPTY_STRING === style.charAt(i - 1)) return error("End of comment missing"); |
| 27079 |
var str = style.slice(2, i - 2); |
| 27080 |
column += 2; |
| 27081 |
updatePosition(str); |
| 27082 |
style = style.slice(i); |
| 27083 |
column += 2; |
| 27084 |
return pos({ |
| 27085 |
type: TYPE_COMMENT, |
| 27086 |
comment: str |
| 27087 |
}); |
| 27088 |
} |
| 27089 |
/** |
| 27090 |
* Parse declaration. |
| 27091 |
* |
| 27092 |
* @return {Object} |
| 27093 |
* @throws {Error} |
| 27094 |
*/ |
| 27095 |
function declaration() { |
| 27096 |
var pos = position(); |
| 27097 |
var prop = match(PROPERTY_REGEX); |
| 27098 |
if (!prop) return; |
| 27099 |
comment(); |
| 27100 |
if (!match(COLON_REGEX)) return error("property missing ':'"); |
| 27101 |
var val = match(VALUE_REGEX); |
| 27102 |
var ret = pos({ |
| 27103 |
type: TYPE_DECLARATION, |
| 27104 |
property: trim(prop[0].replace(COMMENT_REGEX, EMPTY_STRING)), |
| 27105 |
value: val ? trim(val[0].replace(COMMENT_REGEX, EMPTY_STRING)) : EMPTY_STRING |
| 27106 |
}); |
| 27107 |
match(SEMICOLON_REGEX); |
| 27108 |
return ret; |
| 27109 |
} |
| 27110 |
/** |
| 27111 |
* Parse declarations. |
| 27112 |
* |
| 27113 |
* @return {Object[]} |
| 27114 |
*/ |
| 27115 |
function declarations() { |
| 27116 |
var decls = []; |
| 27117 |
comments(decls); |
| 27118 |
var decl; |
| 27119 |
while (decl = declaration()) if (decl !== false) { |
| 27120 |
decls.push(decl); |
| 27121 |
comments(decls); |
| 27122 |
} |
| 27123 |
return decls; |
| 27124 |
} |
| 27125 |
whitespace(); |
| 27126 |
return declarations(); |
| 27127 |
}; |
| 27128 |
/** |
| 27129 |
* Trim `str`. |
| 27130 |
* |
| 27131 |
* @param {String} str |
| 27132 |
* @return {String} |
| 27133 |
*/ |
| 27134 |
function trim(str) { |
| 27135 |
return str ? str.replace(TRIM_REGEX, EMPTY_STRING) : EMPTY_STRING; |
| 27136 |
} |
| 27137 |
})); |
| 27138 |
|
| 27139 |
//#endregion |
| 27140 |
//#region node_modules/style-to-object/index.js |
| 27141 |
var require_style_to_object = /* @__PURE__ */ __commonJSMin(((exports, module) => { |
| 27142 |
var parse = require_inline_style_parser(); |
| 27143 |
/** |
| 27144 |
* Parses inline style to object. |
| 27145 |
* |
| 27146 |
* @example |
| 27147 |
* // returns { 'line-height': '42' } |
| 27148 |
* StyleToObject('line-height: 42;'); |
| 27149 |
* |
| 27150 |
* @param {String} style - The inline style. |
| 27151 |
* @param {Function} [iterator] - The iterator function. |
| 27152 |
* @return {null|Object} |
| 27153 |
*/ |
| 27154 |
function StyleToObject(style, iterator) { |
| 27155 |
var output = null; |
| 27156 |
if (!style || typeof style !== "string") return output; |
| 27157 |
var declaration; |
| 27158 |
var declarations = parse(style); |
| 27159 |
var hasIterator = typeof iterator === "function"; |
| 27160 |
var property; |
| 27161 |
var value; |
| 27162 |
for (var i = 0, len = declarations.length; i < len; i++) { |
| 27163 |
declaration = declarations[i]; |
| 27164 |
property = declaration.property; |
| 27165 |
value = declaration.value; |
| 27166 |
if (hasIterator) iterator(property, value, declaration); |
| 27167 |
else if (value) { |
| 27168 |
output || (output = {}); |
| 27169 |
output[property] = value; |
| 27170 |
} |
| 27171 |
} |
| 27172 |
return output; |
| 27173 |
} |
| 27174 |
module.exports = StyleToObject; |
| 27175 |
module.exports.default = StyleToObject; |
| 27176 |
})); |
| 27177 |
|
| 27178 |
//#endregion |
| 27179 |
//#region node_modules/style-to-object/index.mjs |
| 27180 |
var import_style_to_object, style_to_object_default; |
| 27181 |
var init_style_to_object = __esmMin((() => { |
| 27182 |
import_style_to_object = /* @__PURE__ */ __toESM(require_style_to_object(), 1); |
| 27183 |
style_to_object_default = import_style_to_object.default; |
| 27184 |
})); |
| 27185 |
|
| 27186 |
//#endregion |
| 27187 |
//#region node_modules/react-markdown/lib/ast-to-react.js |
| 27188 |
/** |
| 27189 |
* @template T |
| 27190 |
* @typedef {Promise.resolve(React).ComponentType<T>} ComponentType<T> |
| 27191 |
*/ |
| 27192 |
/** |
| 27193 |
* @template {Promise.resolve(React).ElementType} T |
| 27194 |
* @typedef {Promise.resolve(React).ComponentPropsWithoutRef<T>} ComponentPropsWithoutRef<T> |
| 27195 |
*/ |
| 27196 |
/** |
| 27197 |
* @typedef {Promise.resolve(React).ReactNode} ReactNode |
| 27198 |
* @typedef {import('unist').Position} Position |
| 27199 |
* @typedef {import('hast').Element} Element |
| 27200 |
* @typedef {import('hast').ElementContent} ElementContent |
| 27201 |
* @typedef {import('hast').Root} Root |
| 27202 |
* @typedef {import('hast').Text} Text |
| 27203 |
* @typedef {import('hast').Comment} Comment |
| 27204 |
* @typedef {import('hast').DocType} Doctype |
| 27205 |
* @typedef {import('property-information').Info} Info |
| 27206 |
* @typedef {import('property-information').Schema} Schema |
| 27207 |
* @typedef {import('./complex-types.js').ReactMarkdownProps} ReactMarkdownProps |
| 27208 |
* |
| 27209 |
* @typedef Raw |
| 27210 |
* @property {'raw'} type |
| 27211 |
* @property {string} value |
| 27212 |
* |
| 27213 |
* @typedef Context |
| 27214 |
* @property {Options} options |
| 27215 |
* @property {Schema} schema |
| 27216 |
* @property {number} listDepth |
| 27217 |
* |
| 27218 |
* @callback TransformLink |
| 27219 |
* @param {string} href |
| 27220 |
* @param {Array<ElementContent>} children |
| 27221 |
* @param {string?} title |
| 27222 |
* @returns {string} |
| 27223 |
* |
| 27224 |
* @callback TransformImage |
| 27225 |
* @param {string} src |
| 27226 |
* @param {string} alt |
| 27227 |
* @param {string?} title |
| 27228 |
* @returns {string} |
| 27229 |
* |
| 27230 |
* @typedef {Promise.resolve(React).HTMLAttributeAnchorTarget} TransformLinkTargetType |
| 27231 |
* |
| 27232 |
* @callback TransformLinkTarget |
| 27233 |
* @param {string} href |
| 27234 |
* @param {Array<ElementContent>} children |
| 27235 |
* @param {string?} title |
| 27236 |
* @returns {TransformLinkTargetType|undefined} |
| 27237 |
* |
| 27238 |
* @typedef {keyof JSX.IntrinsicElements} ReactMarkdownNames |
| 27239 |
* |
| 27240 |
* To do: is `data-sourcepos` typeable? |
| 27241 |
* |
| 27242 |
* @typedef {ComponentPropsWithoutRef<'code'> & ReactMarkdownProps & {inline?: boolean}} CodeProps |
| 27243 |
* @typedef {ComponentPropsWithoutRef<'h1'> & ReactMarkdownProps & {level: number}} HeadingProps |
| 27244 |
* @typedef {ComponentPropsWithoutRef<'li'> & ReactMarkdownProps & {checked: boolean|null, index: number, ordered: boolean}} LiProps |
| 27245 |
* @typedef {ComponentPropsWithoutRef<'ol'> & ReactMarkdownProps & {depth: number, ordered: true}} OrderedListProps |
| 27246 |
* @typedef {ComponentPropsWithoutRef<'td'> & ReactMarkdownProps & {style?: Record<string, unknown>, isHeader: false}} TableDataCellProps |
| 27247 |
* @typedef {ComponentPropsWithoutRef<'th'> & ReactMarkdownProps & {style?: Record<string, unknown>, isHeader: true}} TableHeaderCellProps |
| 27248 |
* @typedef {ComponentPropsWithoutRef<'tr'> & ReactMarkdownProps & {isHeader: boolean}} TableRowProps |
| 27249 |
* @typedef {ComponentPropsWithoutRef<'ul'> & ReactMarkdownProps & {depth: number, ordered: false}} UnorderedListProps |
| 27250 |
* |
| 27251 |
* @typedef {ComponentType<CodeProps>} CodeComponent |
| 27252 |
* @typedef {ComponentType<HeadingProps>} HeadingComponent |
| 27253 |
* @typedef {ComponentType<LiProps>} LiComponent |
| 27254 |
* @typedef {ComponentType<OrderedListProps>} OrderedListComponent |
| 27255 |
* @typedef {ComponentType<TableDataCellProps>} TableDataCellComponent |
| 27256 |
* @typedef {ComponentType<TableHeaderCellProps>} TableHeaderCellComponent |
| 27257 |
* @typedef {ComponentType<TableRowProps>} TableRowComponent |
| 27258 |
* @typedef {ComponentType<UnorderedListProps>} UnorderedListComponent |
| 27259 |
* |
| 27260 |
* @typedef SpecialComponents |
| 27261 |
* @property {CodeComponent|ReactMarkdownNames} code |
| 27262 |
* @property {HeadingComponent|ReactMarkdownNames} h1 |
| 27263 |
* @property {HeadingComponent|ReactMarkdownNames} h2 |
| 27264 |
* @property {HeadingComponent|ReactMarkdownNames} h3 |
| 27265 |
* @property {HeadingComponent|ReactMarkdownNames} h4 |
| 27266 |
* @property {HeadingComponent|ReactMarkdownNames} h5 |
| 27267 |
* @property {HeadingComponent|ReactMarkdownNames} h6 |
| 27268 |
* @property {LiComponent|ReactMarkdownNames} li |
| 27269 |
* @property {OrderedListComponent|ReactMarkdownNames} ol |
| 27270 |
* @property {TableDataCellComponent|ReactMarkdownNames} td |
| 27271 |
* @property {TableHeaderCellComponent|ReactMarkdownNames} th |
| 27272 |
* @property {TableRowComponent|ReactMarkdownNames} tr |
| 27273 |
* @property {UnorderedListComponent|ReactMarkdownNames} ul |
| 27274 |
* |
| 27275 |
* @typedef {Partial<Omit<import('./complex-types.js').NormalComponents, keyof SpecialComponents> & SpecialComponents>} Components |
| 27276 |
* |
| 27277 |
* @typedef Options |
| 27278 |
* @property {boolean} [sourcePos=false] |
| 27279 |
* @property {boolean} [rawSourcePos=false] |
| 27280 |
* @property {boolean} [skipHtml=false] |
| 27281 |
* @property {boolean} [includeElementIndex=false] |
| 27282 |
* @property {null|false|TransformLink} [transformLinkUri] |
| 27283 |
* @property {TransformImage} [transformImageUri] |
| 27284 |
* @property {TransformLinkTargetType|TransformLinkTarget} [linkTarget] |
| 27285 |
* @property {Components} [components] |
| 27286 |
*/ |
| 27287 |
/** |
| 27288 |
* @param {Context} context |
| 27289 |
* @param {Element|Root} node |
| 27290 |
*/ |
| 27291 |
function childrenToReact(context, node) { |
| 27292 |
/** @type {Array<ReactNode>} */ |
| 27293 |
const children = []; |
| 27294 |
let childIndex = -1; |
| 27295 |
/** @type {Comment|Doctype|Element|Raw|Text} */ |
| 27296 |
let child; |
| 27297 |
while (++childIndex < node.children.length) { |
| 27298 |
child = node.children[childIndex]; |
| 27299 |
if (child.type === "element") children.push(toReact(context, child, childIndex, node)); |
| 27300 |
else if (child.type === "text") { |
| 27301 |
if (node.type !== "element" || !tableElements.has(node.tagName) || !whitespace(child)) children.push(child.value); |
| 27302 |
} else if (child.type === "raw" && !context.options.skipHtml) children.push(child.value); |
| 27303 |
} |
| 27304 |
return children; |
| 27305 |
} |
| 27306 |
/** |
| 27307 |
* @param {Context} context |
| 27308 |
* @param {Element} node |
| 27309 |
* @param {number} index |
| 27310 |
* @param {Element|Root} parent |
| 27311 |
*/ |
| 27312 |
function toReact(context, node, index, parent) { |
| 27313 |
const options = context.options; |
| 27314 |
const transform = options.transformLinkUri === void 0 ? uriTransformer : options.transformLinkUri; |
| 27315 |
const parentSchema = context.schema; |
| 27316 |
/** @type {ReactMarkdownNames} */ |
| 27317 |
const name = node.tagName; |
| 27318 |
/** @type {Record<string, unknown>} */ |
| 27319 |
const properties = {}; |
| 27320 |
let schema = parentSchema; |
| 27321 |
/** @type {string} */ |
| 27322 |
let property; |
| 27323 |
if (parentSchema.space === "html" && name === "svg") { |
| 27324 |
schema = svg; |
| 27325 |
context.schema = schema; |
| 27326 |
} |
| 27327 |
if (node.properties) { |
| 27328 |
for (property in node.properties) if (own$1.call(node.properties, property)) addProperty(properties, property, node.properties[property], context); |
| 27329 |
} |
| 27330 |
if (name === "ol" || name === "ul") context.listDepth++; |
| 27331 |
const children = childrenToReact(context, node); |
| 27332 |
if (name === "ol" || name === "ul") context.listDepth--; |
| 27333 |
context.schema = parentSchema; |
| 27334 |
const position = node.position || { |
| 27335 |
start: { |
| 27336 |
line: null, |
| 27337 |
column: null, |
| 27338 |
offset: null |
| 27339 |
}, |
| 27340 |
end: { |
| 27341 |
line: null, |
| 27342 |
column: null, |
| 27343 |
offset: null |
| 27344 |
} |
| 27345 |
}; |
| 27346 |
const component = options.components && own$1.call(options.components, name) ? options.components[name] : name; |
| 27347 |
const basic = typeof component === "string" || component === react$1.default.Fragment; |
| 27348 |
if (!import_react_is.isValidElementType(component)) throw new TypeError(`Component for name \`${name}\` not defined or is not renderable`); |
| 27349 |
properties.key = index; |
| 27350 |
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; |
| 27351 |
if (name === "a" && transform) properties.href = transform(String(properties.href || ""), node.children, typeof properties.title === "string" ? properties.title : null); |
| 27352 |
if (!basic && name === "code" && parent.type === "element" && parent.tagName !== "pre") properties.inline = true; |
| 27353 |
if (!basic && (name === "h1" || name === "h2" || name === "h3" || name === "h4" || name === "h5" || name === "h6")) properties.level = Number.parseInt(name.charAt(1), 10); |
| 27354 |
if (name === "img" && options.transformImageUri) properties.src = options.transformImageUri(String(properties.src || ""), String(properties.alt || ""), typeof properties.title === "string" ? properties.title : null); |
| 27355 |
if (!basic && name === "li" && parent.type === "element") { |
| 27356 |
const input = getInputElement(node); |
| 27357 |
properties.checked = input && input.properties ? Boolean(input.properties.checked) : null; |
| 27358 |
properties.index = getElementsBeforeCount(parent, node); |
| 27359 |
properties.ordered = parent.tagName === "ol"; |
| 27360 |
} |
| 27361 |
if (!basic && (name === "ol" || name === "ul")) { |
| 27362 |
properties.ordered = name === "ol"; |
| 27363 |
properties.depth = context.listDepth; |
| 27364 |
} |
| 27365 |
if (name === "td" || name === "th") { |
| 27366 |
if (properties.align) { |
| 27367 |
if (!properties.style) properties.style = {}; |
| 27368 |
properties.style.textAlign = properties.align; |
| 27369 |
delete properties.align; |
| 27370 |
} |
| 27371 |
if (!basic) properties.isHeader = name === "th"; |
| 27372 |
} |
| 27373 |
if (!basic && name === "tr" && parent.type === "element") properties.isHeader = Boolean(parent.tagName === "thead"); |
| 27374 |
if (options.sourcePos) properties["data-sourcepos"] = flattenPosition(position); |
| 27375 |
if (!basic && options.rawSourcePos) properties.sourcePosition = node.position; |
| 27376 |
if (!basic && options.includeElementIndex) { |
| 27377 |
properties.index = getElementsBeforeCount(parent, node); |
| 27378 |
properties.siblingCount = getElementsBeforeCount(parent); |
| 27379 |
} |
| 27380 |
if (!basic) properties.node = node; |
| 27381 |
return children.length > 0 ? react$1.default.createElement(component, properties, children) : react$1.default.createElement(component, properties); |
| 27382 |
} |
| 27383 |
/** |
| 27384 |
* @param {Element|Root} node |
| 27385 |
* @returns {Element?} |
| 27386 |
*/ |
| 27387 |
function getInputElement(node) { |
| 27388 |
let index = -1; |
| 27389 |
while (++index < node.children.length) { |
| 27390 |
const child = node.children[index]; |
| 27391 |
if (child.type === "element" && child.tagName === "input") return child; |
| 27392 |
} |
| 27393 |
return null; |
| 27394 |
} |
| 27395 |
/** |
| 27396 |
* @param {Element|Root} parent |
| 27397 |
* @param {Element} [node] |
| 27398 |
* @returns {number} |
| 27399 |
*/ |
| 27400 |
function getElementsBeforeCount(parent, node) { |
| 27401 |
let index = -1; |
| 27402 |
let count = 0; |
| 27403 |
while (++index < parent.children.length) { |
| 27404 |
if (parent.children[index] === node) break; |
| 27405 |
if (parent.children[index].type === "element") count++; |
| 27406 |
} |
| 27407 |
return count; |
| 27408 |
} |
| 27409 |
/** |
| 27410 |
* @param {Record<string, unknown>} props |
| 27411 |
* @param {string} prop |
| 27412 |
* @param {unknown} value |
| 27413 |
* @param {Context} ctx |
| 27414 |
*/ |
| 27415 |
function addProperty(props, prop, value, ctx) { |
| 27416 |
const info = find(ctx.schema, prop); |
| 27417 |
let result = value; |
| 27418 |
if (result === null || result === void 0 || result !== result) return; |
| 27419 |
if (Array.isArray(result)) result = info.commaSeparated ? stringify(result) : stringify$1(result); |
| 27420 |
if (info.property === "style" && typeof result === "string") result = parseStyle(result); |
| 27421 |
if (info.space && info.property) props[own$1.call(hastToReact, info.property) ? hastToReact[info.property] : info.property] = result; |
| 27422 |
else if (info.attribute) props[info.attribute] = result; |
| 27423 |
} |
| 27424 |
/** |
| 27425 |
* @param {string} value |
| 27426 |
* @returns {Record<string, string>} |
| 27427 |
*/ |
| 27428 |
function parseStyle(value) { |
| 27429 |
/** @type {Record<string, string>} */ |
| 27430 |
const result = {}; |
| 27431 |
try { |
| 27432 |
style_to_object_default(value, iterator); |
| 27433 |
} catch (_unused) {} |
| 27434 |
return result; |
| 27435 |
/** |
| 27436 |
* @param {string} name |
| 27437 |
* @param {string} v |
| 27438 |
*/ |
| 27439 |
function iterator(name, v) { |
| 27440 |
const k = name.slice(0, 4) === "-ms-" ? `ms-${name.slice(4)}` : name; |
| 27441 |
result[k.replace(/-([a-z])/g, styleReplacer)] = v; |
| 27442 |
} |
| 27443 |
} |
| 27444 |
/** |
| 27445 |
* @param {unknown} _ |
| 27446 |
* @param {string} $1 |
| 27447 |
*/ |
| 27448 |
function styleReplacer(_, $1) { |
| 27449 |
return $1.toUpperCase(); |
| 27450 |
} |
| 27451 |
/** |
| 27452 |
* @param {Position|{start: {line: null, column: null, offset: null}, end: {line: null, column: null, offset: null}}} pos |
| 27453 |
* @returns {string} |
| 27454 |
*/ |
| 27455 |
function flattenPosition(pos) { |
| 27456 |
return [ |
| 27457 |
pos.start.line, |
| 27458 |
":", |
| 27459 |
pos.start.column, |
| 27460 |
"-", |
| 27461 |
pos.end.line, |
| 27462 |
":", |
| 27463 |
pos.end.column |
| 27464 |
].map(String).join(""); |
| 27465 |
} |
| 27466 |
var import_react_is, own$1, tableElements; |
| 27467 |
var init_ast_to_react = __esmMin((() => { |
| 27468 |
import_react_is = /* @__PURE__ */ __toESM(require_react_is(), 1); |
| 27469 |
init_hast_util_whitespace(); |
| 27470 |
init_property_information(); |
| 27471 |
init_space_separated_tokens(); |
| 27472 |
init_comma_separated_tokens(); |
| 27473 |
init_style_to_object(); |
| 27474 |
init_uri_transformer(); |
| 27475 |
own$1 = {}.hasOwnProperty; |
| 27476 |
tableElements = /* @__PURE__ */ new Set([ |
| 27477 |
"table", |
| 27478 |
"thead", |
| 27479 |
"tbody", |
| 27480 |
"tfoot", |
| 27481 |
"tr" |
| 27482 |
]); |
| 27483 |
})); |
| 27484 |
|
| 27485 |
//#endregion |
| 27486 |
//#region node_modules/react-markdown/lib/react-markdown.js |
| 27487 |
/** |
| 27488 |
* @typedef {Promise.resolve(React).ReactNode} ReactNode |
| 27489 |
* @typedef {Promise.resolve(React).ReactElement<{}>} ReactElement |
| 27490 |
* @typedef {import('unified').PluggableList} PluggableList |
| 27491 |
* @typedef {import('hast').Root} Root |
| 27492 |
* @typedef {import('./rehype-filter.js').Options} FilterOptions |
| 27493 |
* @typedef {import('./ast-to-react.js').Options} TransformOptions |
| 27494 |
* |
| 27495 |
* @typedef CoreOptions |
| 27496 |
* @property {string} children |
| 27497 |
* |
| 27498 |
* @typedef PluginOptions |
| 27499 |
* @property {PluggableList} [remarkPlugins=[]] |
| 27500 |
* @property {PluggableList} [rehypePlugins=[]] |
| 27501 |
* @property {import('remark-rehype').Options | undefined} [remarkRehypeOptions={}] |
| 27502 |
* |
| 27503 |
* @typedef LayoutOptions |
| 27504 |
* @property {string} [className] |
| 27505 |
* |
| 27506 |
* @typedef {CoreOptions & PluginOptions & LayoutOptions & FilterOptions & TransformOptions} ReactMarkdownOptions |
| 27507 |
* |
| 27508 |
* @typedef Deprecation |
| 27509 |
* @property {string} id |
| 27510 |
* @property {string} [to] |
| 27511 |
*/ |
| 27512 |
/** |
| 27513 |
* React component to render markdown. |
| 27514 |
* |
| 27515 |
* @param {ReactMarkdownOptions} options |
| 27516 |
* @returns {ReactElement} |
| 27517 |
*/ |
| 27518 |
function ReactMarkdown$1(options) { |
| 27519 |
for (const key in deprecated) if (own.call(deprecated, key) && own.call(options, key)) { |
| 27520 |
const deprecation = deprecated[key]; |
| 27521 |
console.warn(`[react-markdown] Warning: please ${deprecation.to ? `use \`${deprecation.to}\` instead of` : "remove"} \`${key}\` (see <${changelog}#${deprecation.id}> for more info)`); |
| 27522 |
delete deprecated[key]; |
| 27523 |
} |
| 27524 |
const processor = unified().use(remarkParse).use(options.remarkPlugins || []).use(remarkRehype, _objectSpread2(_objectSpread2({}, options.remarkRehypeOptions), {}, { allowDangerousHtml: true })).use(options.rehypePlugins || []).use(rehypeFilter, options); |
| 27525 |
const file = new VFile(); |
| 27526 |
if (typeof options.children === "string") file.value = options.children; |
| 27527 |
else if (options.children !== void 0 && options.children !== null) console.warn(`[react-markdown] Warning: please pass a string as \`children\` (not: \`${options.children}\`)`); |
| 27528 |
const hastNode = processor.runSync(processor.parse(file), file); |
| 27529 |
if (hastNode.type !== "root") throw new TypeError("Expected a `root` node"); |
| 27530 |
/** @type {ReactElement} */ |
| 27531 |
let result = react$1.default.createElement(react$1.default.Fragment, {}, childrenToReact({ |
| 27532 |
options, |
| 27533 |
schema: html, |
| 27534 |
listDepth: 0 |
| 27535 |
}, hastNode)); |
| 27536 |
if (options.className) result = react$1.default.createElement("div", { className: options.className }, result); |
| 27537 |
return result; |
| 27538 |
} |
| 27539 |
var import_prop_types$1, own, changelog, deprecated; |
| 27540 |
var init_react_markdown$1 = __esmMin((() => { |
| 27541 |
init_vfile(); |
| 27542 |
init_unified(); |
| 27543 |
init_remark_parse(); |
| 27544 |
init_remark_rehype(); |
| 27545 |
import_prop_types$1 = /* @__PURE__ */ __toESM(require_prop_types(), 1); |
| 27546 |
init_property_information(); |
| 27547 |
init_rehype_filter(); |
| 27548 |
init_ast_to_react(); |
| 27549 |
init_objectSpread2(); |
| 27550 |
own = {}.hasOwnProperty; |
| 27551 |
changelog = "https://github.com/remarkjs/react-markdown/blob/main/changelog.md"; |
| 27552 |
deprecated = { |
| 27553 |
plugins: { |
| 27554 |
to: "remarkPlugins", |
| 27555 |
id: "change-plugins-to-remarkplugins" |
| 27556 |
}, |
| 27557 |
renderers: { |
| 27558 |
to: "components", |
| 27559 |
id: "change-renderers-to-components" |
| 27560 |
}, |
| 27561 |
astPlugins: { id: "remove-buggy-html-in-markdown-parser" }, |
| 27562 |
allowDangerousHtml: { id: "remove-buggy-html-in-markdown-parser" }, |
| 27563 |
escapeHtml: { id: "remove-buggy-html-in-markdown-parser" }, |
| 27564 |
source: { |
| 27565 |
to: "children", |
| 27566 |
id: "change-source-to-children" |
| 27567 |
}, |
| 27568 |
allowNode: { |
| 27569 |
to: "allowElement", |
| 27570 |
id: "replace-allownode-allowedtypes-and-disallowedtypes" |
| 27571 |
}, |
| 27572 |
allowedTypes: { |
| 27573 |
to: "allowedElements", |
| 27574 |
id: "replace-allownode-allowedtypes-and-disallowedtypes" |
| 27575 |
}, |
| 27576 |
disallowedTypes: { |
| 27577 |
to: "disallowedElements", |
| 27578 |
id: "replace-allownode-allowedtypes-and-disallowedtypes" |
| 27579 |
}, |
| 27580 |
includeNodeIndex: { |
| 27581 |
to: "includeElementIndex", |
| 27582 |
id: "change-includenodeindex-to-includeelementindex" |
| 27583 |
} |
| 27584 |
}; |
| 27585 |
__name(ReactMarkdown$1, "ReactMarkdown"); |
| 27586 |
ReactMarkdown$1.propTypes = { |
| 27587 |
children: import_prop_types$1.default.string, |
| 27588 |
className: import_prop_types$1.default.string, |
| 27589 |
allowElement: import_prop_types$1.default.func, |
| 27590 |
allowedElements: import_prop_types$1.default.arrayOf(import_prop_types$1.default.string), |
| 27591 |
disallowedElements: import_prop_types$1.default.arrayOf(import_prop_types$1.default.string), |
| 27592 |
unwrapDisallowed: import_prop_types$1.default.bool, |
| 27593 |
remarkPlugins: import_prop_types$1.default.arrayOf(import_prop_types$1.default.oneOfType([ |
| 27594 |
import_prop_types$1.default.object, |
| 27595 |
import_prop_types$1.default.func, |
| 27596 |
import_prop_types$1.default.arrayOf(import_prop_types$1.default.oneOfType([ |
| 27597 |
import_prop_types$1.default.bool, |
| 27598 |
import_prop_types$1.default.string, |
| 27599 |
import_prop_types$1.default.object, |
| 27600 |
import_prop_types$1.default.func, |
| 27601 |
import_prop_types$1.default.arrayOf(import_prop_types$1.default.any) |
| 27602 |
])) |
| 27603 |
])), |
| 27604 |
rehypePlugins: import_prop_types$1.default.arrayOf(import_prop_types$1.default.oneOfType([ |
| 27605 |
import_prop_types$1.default.object, |
| 27606 |
import_prop_types$1.default.func, |
| 27607 |
import_prop_types$1.default.arrayOf(import_prop_types$1.default.oneOfType([ |
| 27608 |
import_prop_types$1.default.bool, |
| 27609 |
import_prop_types$1.default.string, |
| 27610 |
import_prop_types$1.default.object, |
| 27611 |
import_prop_types$1.default.func, |
| 27612 |
import_prop_types$1.default.arrayOf(import_prop_types$1.default.any) |
| 27613 |
])) |
| 27614 |
])), |
| 27615 |
sourcePos: import_prop_types$1.default.bool, |
| 27616 |
rawSourcePos: import_prop_types$1.default.bool, |
| 27617 |
skipHtml: import_prop_types$1.default.bool, |
| 27618 |
includeElementIndex: import_prop_types$1.default.bool, |
| 27619 |
transformLinkUri: import_prop_types$1.default.oneOfType([import_prop_types$1.default.func, import_prop_types$1.default.bool]), |
| 27620 |
linkTarget: import_prop_types$1.default.oneOfType([import_prop_types$1.default.func, import_prop_types$1.default.string]), |
| 27621 |
transformImageUri: import_prop_types$1.default.func, |
| 27622 |
components: import_prop_types$1.default.object |
| 27623 |
}; |
| 27624 |
})); |
| 27625 |
|
| 27626 |
//#endregion |
| 27627 |
//#region node_modules/react-markdown/index.js |
| 27628 |
var react_markdown_exports = /* @__PURE__ */ __exportAll({ |
| 27629 |
default: () => ReactMarkdown$1, |
| 27630 |
uriTransformer: () => uriTransformer |
| 27631 |
}); |
| 27632 |
var init_react_markdown = __esmMin((() => { |
| 27633 |
init_uri_transformer(); |
| 27634 |
init_react_markdown$1(); |
| 27635 |
})); |
| 27636 |
|
| 27637 |
//#endregion |
| 27638 |
//#region modules/ai/assets/js/editor/pages/form-code/index.js |
| 27639 |
var form_code_exports = /* @__PURE__ */ __exportAll({ default: () => FormCode$1 }); |
| 27640 |
function ownKeys$6(e, r) { |
| 27641 |
var t = Object.keys(e); |
| 27642 |
if (Object.getOwnPropertySymbols) { |
| 27643 |
var o = Object.getOwnPropertySymbols(e); |
| 27644 |
r && (o = o.filter(function(r) { |
| 27645 |
return Object.getOwnPropertyDescriptor(e, r).enumerable; |
| 27646 |
})), t.push.apply(t, o); |
| 27647 |
} |
| 27648 |
return t; |
| 27649 |
} |
| 27650 |
function _objectSpread$6(e) { |
| 27651 |
for (var r = 1; r < arguments.length; r++) { |
| 27652 |
var t = null != arguments[r] ? arguments[r] : {}; |
| 27653 |
r % 2 ? ownKeys$6(Object(t), !0).forEach(function(r) { |
| 27654 |
_defineProperty$1(e, r, t[r]); |
| 27655 |
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$6(Object(t)).forEach(function(r) { |
| 27656 |
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); |
| 27657 |
}); |
| 27658 |
} |
| 27659 |
return e; |
| 27660 |
} |
| 27661 |
var import_regenerator, import_prop_types, ReactMarkdown, generateUniqueId, CodeDisplayWrapper, FormCode$1; |
| 27662 |
var init_form_code = __esmMin((() => { |
| 27663 |
init_extends(); |
| 27664 |
init_asyncToGenerator(); |
| 27665 |
init_slicedToArray(); |
| 27666 |
init_defineProperty$1(); |
| 27667 |
import_regenerator = /* @__PURE__ */ __toESM(require_regenerator()); |
| 27668 |
import_prop_types = /* @__PURE__ */ __toESM(require_prop_types()); |
| 27669 |
init_actions_data(); |
| 27670 |
init_loader(); |
| 27671 |
init_prompt_search(); |
| 27672 |
init_prompt_suggestions(); |
| 27673 |
init_generate_button(); |
| 27674 |
init_prompt_error_message(); |
| 27675 |
init_code_block(); |
| 27676 |
init_use_code_prompt(); |
| 27677 |
init_prompt_history_action_context(); |
| 27678 |
init_prompt_library_link(); |
| 27679 |
init_requests_ids(); |
| 27680 |
init_voice_promotion_alert(); |
| 27681 |
init_splitTextResult(); |
| 27682 |
init_preload_helper(); |
| 27683 |
__name(ownKeys$6, "ownKeys"); |
| 27684 |
__name(_objectSpread$6, "_objectSpread"); |
| 27685 |
ReactMarkdown = (0, react.lazy)(function() { |
| 27686 |
return __vitePreload(() => Promise.resolve().then(() => (init_react_markdown(), react_markdown_exports)), void 0); |
| 27687 |
}); |
| 27688 |
generateUniqueId = function generateUniqueId() { |
| 27689 |
return "custom-css-".concat(Math.random().toString(36).substr(2, 9)); |
| 27690 |
}; |
| 27691 |
CodeDisplayWrapper = (0, _elementor_ui.styled)(_elementor_ui.Box)(function() { |
| 27692 |
return { |
| 27693 |
"& p": { |
| 27694 |
mb: "10px", |
| 27695 |
fontSize: "13px", |
| 27696 |
lineHeight: "1.5" |
| 27697 |
}, |
| 27698 |
"& pre": { position: "relative" }, |
| 27699 |
"& textarea": { |
| 27700 |
fontSize: "13px", |
| 27701 |
lineHeight: "1.7" |
| 27702 |
} |
| 27703 |
}; |
| 27704 |
}); |
| 27705 |
FormCode$1 = function FormCode(_ref) { |
| 27706 |
var onClose = _ref.onClose; |
| 27707 |
var getControlValue = _ref.getControlValue; |
| 27708 |
var setControlValue = _ref.setControlValue; |
| 27709 |
var additionalOptions = _ref.additionalOptions; |
| 27710 |
var credits = _ref.credits; |
| 27711 |
var children = _ref.children; |
| 27712 |
var _useCodePrompt = useCodePrompt(_objectSpread$6(_objectSpread$6({}, additionalOptions), {}, { credits })); |
| 27713 |
var data = _useCodePrompt.data; |
| 27714 |
var isLoading = _useCodePrompt.isLoading; |
| 27715 |
var error = _useCodePrompt.error; |
| 27716 |
var reset = _useCodePrompt.reset; |
| 27717 |
var send = _useCodePrompt.send; |
| 27718 |
var sendUsageData = _useCodePrompt.sendUsageData; |
| 27719 |
var _splitText = splitText(data.result); |
| 27720 |
var code = _splitText.code; |
| 27721 |
var details = _splitText.details; |
| 27722 |
var _useState2 = _slicedToArray((0, react.useState)(""), 2); |
| 27723 |
var prompt = _useState2[0]; |
| 27724 |
var setPrompt = _useState2[1]; |
| 27725 |
var setGenerate = useRequestIds().setGenerate; |
| 27726 |
var styleTagId = (0, react.useRef)(generateUniqueId()); |
| 27727 |
useSubscribeOnPromptHistoryAction([{ |
| 27728 |
type: ACTION_TYPES.REUSE, |
| 27729 |
handler: function handler(action) { |
| 27730 |
reset(); |
| 27731 |
setPrompt(action.data); |
| 27732 |
} |
| 27733 |
}]); |
| 27734 |
var lastRun = (0, react.useRef)(function() {}); |
| 27735 |
var autocompleteItems = codeHtmlAutocomplete; |
| 27736 |
var promptLibraryLink = ""; |
| 27737 |
if ("css" === (additionalOptions === null || additionalOptions === void 0 ? void 0 : additionalOptions.codeLanguage)) { |
| 27738 |
autocompleteItems = codeCssAutocomplete; |
| 27739 |
promptLibraryLink = "https://go.elementor.com/ai-prompt-library-css/"; |
| 27740 |
} else if (additionalOptions !== null && additionalOptions !== void 0 && additionalOptions.htmlMarkup) promptLibraryLink = "https://go.elementor.com/ai-prompt-library-html/"; |
| 27741 |
else promptLibraryLink = "https://go.elementor.com/ai-prompt-library-custom-code/"; |
| 27742 |
var showSuggestions = !prompt; |
| 27743 |
var handleSubmit = /*#__PURE__*/ function() { |
| 27744 |
var _ref2 = _asyncToGenerator$1(/*#__PURE__*/ import_regenerator.default.mark(function _callee(event) { |
| 27745 |
var response; |
| 27746 |
return import_regenerator.default.wrap(function(_context) { |
| 27747 |
while (1) switch (_context.prev = _context.next) { |
| 27748 |
case 0: |
| 27749 |
event.preventDefault(); |
| 27750 |
setGenerate(); |
| 27751 |
lastRun.current = function() { |
| 27752 |
return send({ prompt }); |
| 27753 |
}; |
| 27754 |
_context.next = 1; |
| 27755 |
return lastRun.current(); |
| 27756 |
case 1: |
| 27757 |
response = _context.sent; |
| 27758 |
if ("css" === (additionalOptions === null || additionalOptions === void 0 ? void 0 : additionalOptions.codeLanguage) && response.result) showCssPreview(splitText(response.result).code); |
| 27759 |
case 2: |
| 27760 |
case "end": return _context.stop(); |
| 27761 |
} |
| 27762 |
}, _callee); |
| 27763 |
})); |
| 27764 |
return function handleSubmit(_x) { |
| 27765 |
return _ref2.apply(this, arguments); |
| 27766 |
}; |
| 27767 |
}(); |
| 27768 |
(0, react.useEffect)(function() { |
| 27769 |
return function() { |
| 27770 |
removeStyleTag(); |
| 27771 |
}; |
| 27772 |
}, []); |
| 27773 |
var showCssPreview = function showCssPreview(cssCode) { |
| 27774 |
insertStyleTag(parseCSS(cssCode)); |
| 27775 |
}; |
| 27776 |
var parseCSS = function parseCSS(cssCode) { |
| 27777 |
var elementId = additionalOptions === null || additionalOptions === void 0 ? void 0 : additionalOptions.elementId; |
| 27778 |
var selector = "document" === elementId ? elementor.config.document.settings.cssWrapperSelector : ".elementor-element.elementor-element-".concat(elementId); |
| 27779 |
return cssCode && cssCode.replace(/`/g, "").replace(/^css\s*/i, "").replace(/selector/g, selector); |
| 27780 |
}; |
| 27781 |
var isElementorEditor = function isElementorEditor() { |
| 27782 |
return window.elementorFrontend; |
| 27783 |
}; |
| 27784 |
var insertStyleTag = function insertStyleTag(cssCode) { |
| 27785 |
if (!isElementorEditor()) return; |
| 27786 |
var style = document.createElement("style"); |
| 27787 |
style.id = styleTagId.current; |
| 27788 |
style.appendChild(document.createTextNode(cssCode)); |
| 27789 |
elementorFrontend.elements.$body[0].appendChild(style); |
| 27790 |
}; |
| 27791 |
var removeStyleTag = function removeStyleTag() { |
| 27792 |
if (!isElementorEditor()) return; |
| 27793 |
var styleTag = elementorFrontend.elements.$body[0].querySelector("#".concat(styleTagId.current)); |
| 27794 |
if (styleTag) styleTag.remove(); |
| 27795 |
}; |
| 27796 |
var applyPrompt = function applyPrompt(inputText) { |
| 27797 |
sendUsageData(); |
| 27798 |
setControlValue(inputText); |
| 27799 |
onClose(); |
| 27800 |
}; |
| 27801 |
if (isLoading) return /*#__PURE__*/ react.default.createElement(Loader, null); |
| 27802 |
return /*#__PURE__*/ react.default.createElement(react.default.Fragment, null, error && /*#__PURE__*/ react.default.createElement(PromptErrorMessage, { |
| 27803 |
error, |
| 27804 |
onRetry: lastRun.current, |
| 27805 |
sx: { mb: 2.5 } |
| 27806 |
}), children, !data.result && /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, { |
| 27807 |
component: "form", |
| 27808 |
onSubmit: handleSubmit |
| 27809 |
}, /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, { sx: { pb: 1.5 } }, /*#__PURE__*/ react.default.createElement(PromptSearch, { |
| 27810 |
placeholder: (0, _wordpress_i18n.__)("Describe the code you want to use...", "elementor"), |
| 27811 |
name: "prompt", |
| 27812 |
value: prompt, |
| 27813 |
color: "secondary", |
| 27814 |
onChange: function onChange(event) { |
| 27815 |
return setPrompt(event.target.value); |
| 27816 |
} |
| 27817 |
})), showSuggestions && /*#__PURE__*/ react.default.createElement(PromptSuggestions, { |
| 27818 |
suggestions: autocompleteItems, |
| 27819 |
onSelect: setPrompt |
| 27820 |
}, /*#__PURE__*/ react.default.createElement(PromptLibraryLink, { libraryLink: promptLibraryLink })), /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, { |
| 27821 |
direction: "row", |
| 27822 |
alignItems: "center", |
| 27823 |
sx: { |
| 27824 |
py: 1.5, |
| 27825 |
mt: 4 |
| 27826 |
} |
| 27827 |
}, /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, { |
| 27828 |
direction: "row", |
| 27829 |
justifyContent: "flex-end", |
| 27830 |
flexGrow: 1 |
| 27831 |
}, /*#__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) { |
| 27832 |
return /*#__PURE__*/ react.default.createElement(CodeBlock, _extends$1({}, props, { |
| 27833 |
defaultValue: getControlValue(), |
| 27834 |
onInsert: applyPrompt |
| 27835 |
})); |
| 27836 |
} } }, code)), details, /*#__PURE__*/ react.default.createElement(VoicePromotionAlert, { introductionKey: "ai-context-code-promotion" }), /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, { |
| 27837 |
direction: "row", |
| 27838 |
alignItems: "center", |
| 27839 |
sx: { mt: 4 } |
| 27840 |
}, /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, { |
| 27841 |
direction: "row", |
| 27842 |
gap: 1, |
| 27843 |
justifyContent: "flex-end", |
| 27844 |
flexGrow: 1 |
| 27845 |
}, /*#__PURE__*/ react.default.createElement(_elementor_ui.Button, { |
| 27846 |
size: "small", |
| 27847 |
color: "secondary", |
| 27848 |
variant: "text", |
| 27849 |
onClick: function onClick() { |
| 27850 |
removeStyleTag(); |
| 27851 |
reset(); |
| 27852 |
} |
| 27853 |
}, (0, _wordpress_i18n.__)("New prompt", "elementor")))))); |
| 27854 |
}; |
| 27855 |
FormCode$1.propTypes = { |
| 27856 |
onClose: import_prop_types.default.func.isRequired, |
| 27857 |
getControlValue: import_prop_types.default.func.isRequired, |
| 27858 |
setControlValue: import_prop_types.default.func.isRequired, |
| 27859 |
additionalOptions: import_prop_types.default.shape({ |
| 27860 |
codeLanguage: import_prop_types.default.string, |
| 27861 |
htmlMarkup: import_prop_types.default.string, |
| 27862 |
elementId: import_prop_types.default.string, |
| 27863 |
initialCredits: import_prop_types.default.number |
| 27864 |
}), |
| 27865 |
credits: import_prop_types.default.number, |
| 27866 |
children: import_prop_types.default.node |
| 27867 |
}; |
| 27868 |
})); |
| 27869 |
|
| 27870 |
//#endregion |
| 27871 |
//#region modules/ai/assets/js/editor/page-content.js |
| 27872 |
init_extends(); |
| 27873 |
init_defineProperty$1(); |
| 27874 |
init_slicedToArray(); |
| 27875 |
init_history_types(); |
| 27876 |
init_prompt_history_action_context(); |
| 27877 |
init_prompt_history_context(); |
| 27878 |
init_loader(); |
| 27879 |
init_requests_ids(); |
| 27880 |
init_preload_helper(); |
| 27881 |
function ownKeys$5(e, r) { |
| 27882 |
var t = Object.keys(e); |
| 27883 |
if (Object.getOwnPropertySymbols) { |
| 27884 |
var o = Object.getOwnPropertySymbols(e); |
| 27885 |
r && (o = o.filter(function(r) { |
| 27886 |
return Object.getOwnPropertyDescriptor(e, r).enumerable; |
| 27887 |
})), t.push.apply(t, o); |
| 27888 |
} |
| 27889 |
return t; |
| 27890 |
} |
| 27891 |
__name(ownKeys$5, "ownKeys"); |
| 27892 |
function _objectSpread$5(e) { |
| 27893 |
for (var r = 1; r < arguments.length; r++) { |
| 27894 |
var t = null != arguments[r] ? arguments[r] : {}; |
| 27895 |
r % 2 ? ownKeys$5(Object(t), !0).forEach(function(r) { |
| 27896 |
_defineProperty$1(e, r, t[r]); |
| 27897 |
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$5(Object(t)).forEach(function(r) { |
| 27898 |
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); |
| 27899 |
}); |
| 27900 |
} |
| 27901 |
return e; |
| 27902 |
} |
| 27903 |
__name(_objectSpread$5, "_objectSpread"); |
| 27904 |
var FormCode = (0, react.lazy)(function() { |
| 27905 |
return __vitePreload(() => Promise.resolve().then(() => (init_form_code(), form_code_exports)), void 0); |
| 27906 |
}); |
| 27907 |
var PageContent = function PageContent(_ref) { |
| 27908 |
var type = _ref.type; |
| 27909 |
var controlType = _ref.controlType; |
| 27910 |
var onClose = _ref.onClose; |
| 27911 |
var onConnect = _ref.onConnect; |
| 27912 |
var getControlValue = _ref.getControlValue; |
| 27913 |
var setControlValue = _ref.setControlValue; |
| 27914 |
var additionalOptions = _ref.additionalOptions; |
| 27915 |
var _ref2 = function(_additionalOptions$us) { |
| 27916 |
return (_additionalOptions$us = additionalOptions === null || additionalOptions === void 0 ? void 0 : additionalOptions.useCustomInit) !== null && _additionalOptions$us !== void 0 ? _additionalOptions$us : useUserInfo; |
| 27917 |
}()(); |
| 27918 |
var isLoading = _ref2.isLoading; |
| 27919 |
var isConnected = _ref2.isConnected; |
| 27920 |
var isGetStarted = _ref2.isGetStarted; |
| 27921 |
var connectUrl = _ref2.connectUrl; |
| 27922 |
var fetchData = _ref2.fetchData; |
| 27923 |
var hasSubscription = _ref2.hasSubscription; |
| 27924 |
var credits = _ref2.credits; |
| 27925 |
var initialUsagePercentage = _ref2.usagePercentage; |
| 27926 |
var _useRequestIds = useRequestIds(); |
| 27927 |
var updateUsagePercentage = _useRequestIds.updateUsagePercentage; |
| 27928 |
var usagePercentage = _useRequestIds.usagePercentage; |
| 27929 |
var _useState2 = _slicedToArray((0, react.useState)(false), 2); |
| 27930 |
var isInitUsageDone = _useState2[0]; |
| 27931 |
var setIsInitUsageDone = _useState2[1]; |
| 27932 |
(0, react.useEffect)(function() { |
| 27933 |
if (!isInitUsageDone && !isLoading && (initialUsagePercentage || 0 === initialUsagePercentage)) { |
| 27934 |
updateUsagePercentage(initialUsagePercentage); |
| 27935 |
setIsInitUsageDone(true); |
| 27936 |
} |
| 27937 |
}, [ |
| 27938 |
isLoading, |
| 27939 |
initialUsagePercentage, |
| 27940 |
isInitUsageDone, |
| 27941 |
updateUsagePercentage |
| 27942 |
]); |
| 27943 |
var showBadge = useUpgradeMessage({ |
| 27944 |
usagePercentage, |
| 27945 |
hasSubscription |
| 27946 |
}).showBadge; |
| 27947 |
var _useState4 = _slicedToArray((0, react.useState)({ pointerEvents: "none" }), 2); |
| 27948 |
var sxStyle = _useState4[0]; |
| 27949 |
var setSxStyle = _useState4[1]; |
| 27950 |
var timeoutRef = (0, react.useRef)(null); |
| 27951 |
var _useState6 = _slicedToArray((0, react.useState)(), 2); |
| 27952 |
var originalControlValue = _useState6[0]; |
| 27953 |
var setOriginalControlValue = _useState6[1]; |
| 27954 |
var promptDialogStyleProps = { |
| 27955 |
sx: { |
| 27956 |
zIndex: 17e4, |
| 27957 |
"& .MuiDialog-container": { |
| 27958 |
alignItems: "flex-start", |
| 27959 |
mt: "media" === type ? "2.5vh" : "18vh" |
| 27960 |
}, |
| 27961 |
"& .MuiDialogContent-root": { |
| 27962 |
willChange: "height", |
| 27963 |
transition: "height 300ms ease-in-out", |
| 27964 |
position: "relative" |
| 27965 |
}, |
| 27966 |
"& .MuiBox-root": { boxSizing: "border-box" } |
| 27967 |
}, |
| 27968 |
PaperProps: { sx: { |
| 27969 |
m: 0, |
| 27970 |
maxHeight: "media" === type ? "95vh" : "76vh", |
| 27971 |
minHeight: "80vh", |
| 27972 |
height: "auto" |
| 27973 |
} } |
| 27974 |
}; |
| 27975 |
var codePromptDialogStyleProps = { |
| 27976 |
sx: _objectSpread$5(_objectSpread$5({}, promptDialogStyleProps.sx), sxStyle), |
| 27977 |
PaperProps: { |
| 27978 |
onMouseEnter: function onMouseEnter() { |
| 27979 |
clearTimeout(timeoutRef.current); |
| 27980 |
setSxStyle({ pointerEvents: "all" }); |
| 27981 |
}, |
| 27982 |
onMouseLeave: function onMouseLeave() { |
| 27983 |
clearTimeout(timeoutRef.current); |
| 27984 |
timeoutRef.current = setTimeout(function() { |
| 27985 |
setSxStyle({ pointerEvents: "none" }); |
| 27986 |
}, 200); |
| 27987 |
}, |
| 27988 |
sx: _objectSpread$5(_objectSpread$5({}, promptDialogStyleProps.PaperProps.sx), {}, { pointerEvents: "auto" }) |
| 27989 |
} |
| 27990 |
}; |
| 27991 |
var maybeRenderUpgradeChip = function maybeRenderUpgradeChip() { |
| 27992 |
if (!showBadge) return; |
| 27993 |
return /*#__PURE__*/ react.default.createElement(UpgradeChip, { |
| 27994 |
hasSubscription, |
| 27995 |
usagePercentage |
| 27996 |
}); |
| 27997 |
}; |
| 27998 |
(0, react.useEffect)(function() { |
| 27999 |
if (!originalControlValue) setOriginalControlValue(getControlValue()); |
| 28000 |
}, []); |
| 28001 |
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: { |
| 28002 |
display: "flex", |
| 28003 |
justifyContent: "center", |
| 28004 |
alignItems: "center", |
| 28005 |
width: "100%" |
| 28006 |
} }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, { |
| 28007 |
variant: "body1", |
| 28008 |
color: "secondary" |
| 28009 |
}, additionalOptions === null || additionalOptions === void 0 ? void 0 : additionalOptions.loadingTitle)), /*#__PURE__*/ react.default.createElement(Loader, null))); |
| 28010 |
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, { |
| 28011 |
connectUrl, |
| 28012 |
onSuccess: function onSuccess(data) { |
| 28013 |
onConnect(data); |
| 28014 |
fetchData(); |
| 28015 |
} |
| 28016 |
}))); |
| 28017 |
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 }))); |
| 28018 |
if ("media" === type) return /*#__PURE__*/ react.default.createElement(PromptHistoryProvider, { historyType: HISTORY_TYPES.IMAGE }, /*#__PURE__*/ react.default.createElement(PromptHistoryActionProvider, null, /*#__PURE__*/ react.default.createElement(FormMedia, { |
| 28019 |
onClose, |
| 28020 |
getControlValue, |
| 28021 |
setControlValue, |
| 28022 |
additionalOptions, |
| 28023 |
credits, |
| 28024 |
maybeRenderUpgradeChip, |
| 28025 |
DialogProps: promptDialogStyleProps, |
| 28026 |
hasSubscription, |
| 28027 |
usagePercentage |
| 28028 |
}))); |
| 28029 |
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, { |
| 28030 |
className: "e-ai-dialog-content", |
| 28031 |
dividers: true |
| 28032 |
}, /*#__PURE__*/ react.default.createElement(react.Suspense, { fallback: /*#__PURE__*/ react.default.createElement(Loader, null) }, /*#__PURE__*/ react.default.createElement(FormCode, { |
| 28033 |
onClose, |
| 28034 |
getControlValue, |
| 28035 |
setControlValue, |
| 28036 |
additionalOptions, |
| 28037 |
credits, |
| 28038 |
usagePercentage |
| 28039 |
}, /*#__PURE__*/ react.default.createElement(UsageMessages, { |
| 28040 |
hasSubscription, |
| 28041 |
usagePercentage, |
| 28042 |
sx: { mb: 2 }, |
| 28043 |
feature: FREE_TRIAL_FEATURES_NAMES.CODE |
| 28044 |
}))))))); |
| 28045 |
if ("animation" === type || "hover_animation" === type) { |
| 28046 |
var onCloseAnimationDialog = function onCloseAnimationDialog() { |
| 28047 |
setControlValue(originalControlValue); |
| 28048 |
elementor.documents.getCurrent().history.setActive(true); |
| 28049 |
onClose(); |
| 28050 |
}; |
| 28051 |
return /*#__PURE__*/ react.default.createElement(PromptDialog, _extends$1({ onClose: onCloseAnimationDialog }, codePromptDialogStyleProps), /*#__PURE__*/ react.default.createElement(PromptDialog.Header, { |
| 28052 |
onClose: onCloseAnimationDialog, |
| 28053 |
hideAiBetaLogo: additionalOptions === null || additionalOptions === void 0 ? void 0 : additionalOptions.hideAiBetaLogo |
| 28054 |
}, maybeRenderUpgradeChip()), /*#__PURE__*/ react.default.createElement(PromptDialog.Content, { |
| 28055 |
className: "e-ai-dialog-content", |
| 28056 |
dividers: true |
| 28057 |
}, /*#__PURE__*/ react.default.createElement(FormAnimation, { |
| 28058 |
onClose, |
| 28059 |
getControlValue, |
| 28060 |
setControlValue, |
| 28061 |
additionalOptions: _objectSpread$5(_objectSpread$5({}, additionalOptions), {}, { animationType: "hover_animation" === type ? "hover" : "other" }), |
| 28062 |
credits, |
| 28063 |
usagePercentage |
| 28064 |
}, /*#__PURE__*/ react.default.createElement(UsageMessages, { |
| 28065 |
hasSubscription, |
| 28066 |
usagePercentage, |
| 28067 |
sx: { mb: 2 }, |
| 28068 |
feature: FREE_TRIAL_FEATURES_NAMES.ANIMATION |
| 28069 |
})))); |
| 28070 |
} |
| 28071 |
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, { |
| 28072 |
onClose, |
| 28073 |
hideAiBetaLogo: additionalOptions === null || additionalOptions === void 0 ? void 0 : additionalOptions.hideAiBetaLogo |
| 28074 |
}, !(additionalOptions !== null && additionalOptions !== void 0 && additionalOptions.withoutHistory) && /*#__PURE__*/ react.default.createElement(PromptHistory, null), maybeRenderUpgradeChip()), /*#__PURE__*/ react.default.createElement(PromptDialog.Content, { |
| 28075 |
className: "e-ai-dialog-content", |
| 28076 |
dividers: true |
| 28077 |
}, /*#__PURE__*/ react.default.createElement(FormText, { |
| 28078 |
type, |
| 28079 |
controlType, |
| 28080 |
onClose, |
| 28081 |
getControlValue, |
| 28082 |
setControlValue, |
| 28083 |
additionalOptions, |
| 28084 |
credits, |
| 28085 |
usagePercentage |
| 28086 |
}, /*#__PURE__*/ react.default.createElement(UsageMessages, { |
| 28087 |
hasSubscription, |
| 28088 |
usagePercentage, |
| 28089 |
sx: { mb: 2 }, |
| 28090 |
feature: FREE_TRIAL_FEATURES_NAMES.TEXT |
| 28091 |
})))))); |
| 28092 |
}; |
| 28093 |
PageContent.propTypes = { |
| 28094 |
type: import_prop_types$8.default.string, |
| 28095 |
controlType: import_prop_types$8.default.string, |
| 28096 |
onClose: import_prop_types$8.default.func.isRequired, |
| 28097 |
onConnect: import_prop_types$8.default.func, |
| 28098 |
getControlValue: import_prop_types$8.default.func.isRequired, |
| 28099 |
setControlValue: import_prop_types$8.default.func.isRequired, |
| 28100 |
additionalOptions: import_prop_types$8.default.object |
| 28101 |
}; |
| 28102 |
|
| 28103 |
//#endregion |
| 28104 |
//#region modules/ai/assets/js/editor/utils/preview-container.js |
| 28105 |
/** |
| 28106 |
* @typedef {import('elementor/assets/dev/js/editor/container/container')} Container |
| 28107 |
*/ |
| 28108 |
var PREFIX = "e-ai-preview-container"; |
| 28109 |
var CLASS_HIDDEN = PREFIX + "--hidden"; |
| 28110 |
var CLASS_IDLE = PREFIX + "--idle"; |
| 28111 |
|
| 28112 |
//#endregion |
| 28113 |
//#region modules/ai/assets/js/editor/pages/form-layout/components/unsaved-changes-alert.js |
| 28114 |
init_extends(); |
| 28115 |
init_objectWithoutProperties$1(); |
| 28116 |
var _excluded$5 = [ |
| 28117 |
"onClose", |
| 28118 |
"onCancel", |
| 28119 |
"title", |
| 28120 |
"text" |
| 28121 |
]; |
| 28122 |
var UnsavedChangesAlert = function UnsavedChangesAlert(_ref) { |
| 28123 |
var onClose = _ref.onClose; |
| 28124 |
var onCancel = _ref.onCancel; |
| 28125 |
var title = _ref.title; |
| 28126 |
var text = _ref.text; |
| 28127 |
var props = _objectWithoutProperties$1(_ref, _excluded$5); |
| 28128 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Dialog, _extends$1({ |
| 28129 |
"aria-labelledby": "unsaved-changes-alert-title", |
| 28130 |
"aria-describedby": "unsaved-changes-alert-description" |
| 28131 |
}, 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, { |
| 28132 |
onClick: onCancel, |
| 28133 |
color: "secondary" |
| 28134 |
}, (0, _wordpress_i18n.__)("Cancel", "elementor")), /*#__PURE__*/ react.default.createElement(_elementor_ui.Button, { |
| 28135 |
onClick: onClose, |
| 28136 |
color: "error", |
| 28137 |
variant: "contained" |
| 28138 |
}, (0, _wordpress_i18n.__)("Yes, leave", "elementor")))); |
| 28139 |
}; |
| 28140 |
UnsavedChangesAlert.propTypes = { |
| 28141 |
title: import_prop_types$8.default.string, |
| 28142 |
text: import_prop_types$8.default.string, |
| 28143 |
onCancel: import_prop_types$8.default.func, |
| 28144 |
onClose: import_prop_types$8.default.func |
| 28145 |
}; |
| 28146 |
|
| 28147 |
//#endregion |
| 28148 |
//#region modules/ai/assets/js/editor/pages/form-layout/components/layout-dialog.js |
| 28149 |
init_extends(); |
| 28150 |
init_defineProperty$1(); |
| 28151 |
init_slicedToArray(); |
| 28152 |
init_objectWithoutProperties$1(); |
| 28153 |
var _excluded$4 = ["sx", "PaperProps"]; |
| 28154 |
function ownKeys$4(e, r) { |
| 28155 |
var t = Object.keys(e); |
| 28156 |
if (Object.getOwnPropertySymbols) { |
| 28157 |
var o = Object.getOwnPropertySymbols(e); |
| 28158 |
r && (o = o.filter(function(r) { |
| 28159 |
return Object.getOwnPropertyDescriptor(e, r).enumerable; |
| 28160 |
})), t.push.apply(t, o); |
| 28161 |
} |
| 28162 |
return t; |
| 28163 |
} |
| 28164 |
__name(ownKeys$4, "ownKeys"); |
| 28165 |
function _objectSpread$4(e) { |
| 28166 |
for (var r = 1; r < arguments.length; r++) { |
| 28167 |
var t = null != arguments[r] ? arguments[r] : {}; |
| 28168 |
r % 2 ? ownKeys$4(Object(t), !0).forEach(function(r) { |
| 28169 |
_defineProperty$1(e, r, t[r]); |
| 28170 |
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$4(Object(t)).forEach(function(r) { |
| 28171 |
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); |
| 28172 |
}); |
| 28173 |
} |
| 28174 |
return e; |
| 28175 |
} |
| 28176 |
__name(_objectSpread$4, "_objectSpread"); |
| 28177 |
var StyledDialog = (0, _elementor_ui.styled)(PromptDialog)(function() { |
| 28178 |
return { |
| 28179 |
"& .MuiDialog-container": { |
| 28180 |
marginTop: 0, |
| 28181 |
alignItems: "flex-end", |
| 28182 |
paddingBottom: "16vh" |
| 28183 |
}, |
| 28184 |
"& .MuiPaper-root": { |
| 28185 |
margin: 0, |
| 28186 |
maxHeight: "80vh" |
| 28187 |
} |
| 28188 |
}; |
| 28189 |
}); |
| 28190 |
var DialogHeader = function DialogHeader(_ref) { |
| 28191 |
var onClose = _ref.onClose; |
| 28192 |
var children = _ref.children; |
| 28193 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.AppBar, { |
| 28194 |
sx: { fontWeight: "normal" }, |
| 28195 |
color: "transparent", |
| 28196 |
position: "relative" |
| 28197 |
}, /*#__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, { |
| 28198 |
component: "span", |
| 28199 |
variant: "subtitle2", |
| 28200 |
sx: { |
| 28201 |
fontWeight: "bold", |
| 28202 |
textTransform: "uppercase" |
| 28203 |
} |
| 28204 |
}, (0, _wordpress_i18n.__)("AI", "elementor")), /*#__PURE__*/ react.default.createElement(_elementor_ui.Chip, { |
| 28205 |
label: (0, _wordpress_i18n.__)("Beta", "elementor"), |
| 28206 |
color: "default", |
| 28207 |
size: "small", |
| 28208 |
sx: { ml: 1 } |
| 28209 |
}), /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, { |
| 28210 |
direction: "row", |
| 28211 |
spacing: 1, |
| 28212 |
alignItems: "center", |
| 28213 |
sx: { ml: "auto" } |
| 28214 |
}, children, /*#__PURE__*/ react.default.createElement(_elementor_ui.IconButton, { |
| 28215 |
size: "small", |
| 28216 |
"aria-label": "close", |
| 28217 |
onClick: onClose, |
| 28218 |
sx: { "&.MuiButtonBase-root": { mr: -1 } } |
| 28219 |
}, /*#__PURE__*/ react.default.createElement(_elementor_icons.XIcon, null))))); |
| 28220 |
}; |
| 28221 |
DialogHeader.propTypes = { |
| 28222 |
children: import_prop_types$8.default.node, |
| 28223 |
onClose: import_prop_types$8.default.func.isRequired |
| 28224 |
}; |
| 28225 |
var StyledDialogContent = (0, _elementor_ui.styled)(PromptDialog.Content)(function() { |
| 28226 |
return { "&.MuiDialogContent-root": { padding: 0 } }; |
| 28227 |
}); |
| 28228 |
var LayoutDialog = function LayoutDialog(_ref2) { |
| 28229 |
var _ref2$sx = _ref2.sx; |
| 28230 |
var sx = _ref2$sx === void 0 ? {} : _ref2$sx; |
| 28231 |
var _ref2$PaperProps = _ref2.PaperProps; |
| 28232 |
var PaperProps = _ref2$PaperProps === void 0 ? {} : _ref2$PaperProps; |
| 28233 |
var props = _objectWithoutProperties$1(_ref2, _excluded$4); |
| 28234 |
var _useState2 = _slicedToArray((0, react.useState)({ pointerEvents: "none" }), 2); |
| 28235 |
var sxStyle = _useState2[0]; |
| 28236 |
var setSxStyle = _useState2[1]; |
| 28237 |
var timeoutRef = (0, react.useRef)(null); |
| 28238 |
/** |
| 28239 |
* The PromptDialog is using disableScrollLock in order to allow scrolling the page when the Dialog is opened. |
| 28240 |
* When using the react-draggable library inside the editor, the background page scroll is not working smoothly. |
| 28241 |
* Therefore, we need to delay the pointerEvents: none, which allowing to scroll the page content. |
| 28242 |
*/ |
| 28243 |
return /*#__PURE__*/ react.default.createElement(StyledDialog, _extends$1({ |
| 28244 |
maxWidth: "md", |
| 28245 |
PaperProps: _objectSpread$4({ |
| 28246 |
sx: { pointerEvents: "auto" }, |
| 28247 |
onMouseEnter: function onMouseEnter() { |
| 28248 |
clearTimeout(timeoutRef.current); |
| 28249 |
setSxStyle({ pointerEvents: "all" }); |
| 28250 |
}, |
| 28251 |
onMouseLeave: function onMouseLeave() { |
| 28252 |
clearTimeout(timeoutRef.current); |
| 28253 |
timeoutRef.current = setTimeout(function() { |
| 28254 |
setSxStyle({ pointerEvents: "none" }); |
| 28255 |
}, 200); |
| 28256 |
} |
| 28257 |
}, PaperProps) |
| 28258 |
}, props, { sx: _objectSpread$4(_objectSpread$4({}, sxStyle), sx) })); |
| 28259 |
}; |
| 28260 |
LayoutDialog.propTypes = { |
| 28261 |
sx: import_prop_types$8.default.object, |
| 28262 |
PaperProps: import_prop_types$8.default.object |
| 28263 |
}; |
| 28264 |
LayoutDialog.Header = DialogHeader; |
| 28265 |
LayoutDialog.Content = StyledDialogContent; |
| 28266 |
|
| 28267 |
//#endregion |
| 28268 |
//#region modules/ai/assets/js/editor/pages/form-layout/components/prompt-autocomplete.js |
| 28269 |
init_slicedToArray(); |
| 28270 |
init_objectWithoutProperties$1(); |
| 28271 |
init_extends(); |
| 28272 |
init_defineProperty$1(); |
| 28273 |
init_prompt_library_link(); |
| 28274 |
var _excluded$3 = ["onSubmit"]; |
| 28275 |
function ownKeys$3(e, r) { |
| 28276 |
var t = Object.keys(e); |
| 28277 |
if (Object.getOwnPropertySymbols) { |
| 28278 |
var o = Object.getOwnPropertySymbols(e); |
| 28279 |
r && (o = o.filter(function(r) { |
| 28280 |
return Object.getOwnPropertyDescriptor(e, r).enumerable; |
| 28281 |
})), t.push.apply(t, o); |
| 28282 |
} |
| 28283 |
return t; |
| 28284 |
} |
| 28285 |
__name(ownKeys$3, "ownKeys"); |
| 28286 |
function _objectSpread$3(e) { |
| 28287 |
for (var r = 1; r < arguments.length; r++) { |
| 28288 |
var t = null != arguments[r] ? arguments[r] : {}; |
| 28289 |
r % 2 ? ownKeys$3(Object(t), !0).forEach(function(r) { |
| 28290 |
_defineProperty$1(e, r, t[r]); |
| 28291 |
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$3(Object(t)).forEach(function(r) { |
| 28292 |
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); |
| 28293 |
}); |
| 28294 |
} |
| 28295 |
return e; |
| 28296 |
} |
| 28297 |
__name(_objectSpread$3, "_objectSpread"); |
| 28298 |
var TextInput = (0, react.forwardRef)(function(props, ref) { |
| 28299 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.TextField, _extends$1({ |
| 28300 |
autoFocus: true, |
| 28301 |
multiline: true, |
| 28302 |
size: "small", |
| 28303 |
maxRows: 3, |
| 28304 |
color: "secondary", |
| 28305 |
variant: "standard" |
| 28306 |
}, props, { |
| 28307 |
inputRef: ref, |
| 28308 |
InputProps: _objectSpread$3(_objectSpread$3({}, props.InputProps), {}, { |
| 28309 |
type: "search", |
| 28310 |
sx: { pt: 0 } |
| 28311 |
}) |
| 28312 |
})); |
| 28313 |
}); |
| 28314 |
TextInput.propTypes = { InputProps: import_prop_types$8.default.object }; |
| 28315 |
var PaperComponent = function PaperComponent(props) { |
| 28316 |
var libraryLink = "variation" === useConfig().mode ? "https://go.elementor.com/ai-prompt-library-variations/" : "https://go.elementor.com/ai-prompt-library-containers/"; |
| 28317 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Paper, _extends$1({}, props, { |
| 28318 |
elevation: 8, |
| 28319 |
sx: { borderRadius: 2 } |
| 28320 |
}), /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, { |
| 28321 |
component: _elementor_ui.Box, |
| 28322 |
color: function color(theme) { |
| 28323 |
return theme.palette.text.tertiary; |
| 28324 |
}, |
| 28325 |
variant: "caption", |
| 28326 |
paddingX: 2, |
| 28327 |
paddingY: 1 |
| 28328 |
}, (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 }))); |
| 28329 |
}; |
| 28330 |
PaperComponent.propTypes = { children: import_prop_types$8.default.node }; |
| 28331 |
var PromptAutocomplete = function PromptAutocomplete(_ref) { |
| 28332 |
var onSubmit = _ref.onSubmit; |
| 28333 |
var props = _objectWithoutProperties$1(_ref, _excluded$3); |
| 28334 |
var _useState2 = _slicedToArray((0, react.useState)(false), 2); |
| 28335 |
var showSuggestions = _useState2[0]; |
| 28336 |
var setShowSuggestions = _useState2[1]; |
| 28337 |
var theme = (0, _elementor_ui.useTheme)(); |
| 28338 |
var itemHeight = parseInt(theme.spacing(4)); |
| 28339 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Autocomplete, _extends$1({ |
| 28340 |
PaperComponent, |
| 28341 |
ListboxProps: { sx: { maxHeight: 5 * itemHeight } }, |
| 28342 |
renderOption: function renderOption(optionProps, option) { |
| 28343 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, _extends$1({}, optionProps, { |
| 28344 |
title: option.text, |
| 28345 |
noWrap: true, |
| 28346 |
variant: "body2", |
| 28347 |
component: _elementor_ui.Box, |
| 28348 |
sx: { "&.MuiAutocomplete-option": { |
| 28349 |
display: "block", |
| 28350 |
minHeight: itemHeight |
| 28351 |
} } |
| 28352 |
}), option.text); |
| 28353 |
}, |
| 28354 |
freeSolo: true, |
| 28355 |
fullWidth: true, |
| 28356 |
disableClearable: true, |
| 28357 |
open: showSuggestions, |
| 28358 |
onClose: function onClose(e) { |
| 28359 |
var _e$relatedTarget; |
| 28360 |
return setShowSuggestions("A" === ((_e$relatedTarget = e.relatedTarget) === null || _e$relatedTarget === void 0 ? void 0 : _e$relatedTarget.tagName)); |
| 28361 |
}, |
| 28362 |
onKeyDown: function onKeyDown(e) { |
| 28363 |
if ("Enter" === e.key && !e.shiftKey && !showSuggestions) onSubmit(e); |
| 28364 |
else if ("/" === e.key && "" === e.target.value) { |
| 28365 |
e.preventDefault(); |
| 28366 |
setShowSuggestions(true); |
| 28367 |
} |
| 28368 |
} |
| 28369 |
}, props)); |
| 28370 |
}; |
| 28371 |
PromptAutocomplete.propTypes = { onSubmit: import_prop_types$8.default.func.isRequired }; |
| 28372 |
PromptAutocomplete.TextInput = TextInput; |
| 28373 |
|
| 28374 |
//#endregion |
| 28375 |
//#region modules/ai/assets/js/editor/icons/arrow-left-icon.js |
| 28376 |
init_extends(); |
| 28377 |
var ArrowLeftIcon = react.default.forwardRef(function(props, ref) { |
| 28378 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.SvgIcon, _extends$1({ viewBox: "0 0 24 24" }, props, { ref }), /*#__PURE__*/ react.default.createElement("path", { |
| 28379 |
fillRule: "evenodd", |
| 28380 |
clipRule: "evenodd", |
| 28381 |
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" |
| 28382 |
})); |
| 28383 |
}); |
| 28384 |
|
| 28385 |
//#endregion |
| 28386 |
//#region modules/ai/assets/js/editor/icons/x-circle-icon.js |
| 28387 |
init_extends(); |
| 28388 |
var XCircleIcon = react.default.forwardRef(function(props, ref) { |
| 28389 |
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" })); |
| 28390 |
}); |
| 28391 |
|
| 28392 |
//#endregion |
| 28393 |
//#region modules/ai/assets/js/editor/icons/plus-circle-icon.js |
| 28394 |
init_extends(); |
| 28395 |
var PlusCircleIcon = react.default.forwardRef(function(props, ref) { |
| 28396 |
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" })); |
| 28397 |
}); |
| 28398 |
|
| 28399 |
//#endregion |
| 28400 |
//#region modules/ai/assets/js/editor/components/alert-dialog.js |
| 28401 |
init_slicedToArray(); |
| 28402 |
var AlertDialog = function AlertDialog(props) { |
| 28403 |
var _useState2 = _slicedToArray((0, react.useState)(true), 2); |
| 28404 |
var isShown = _useState2[0]; |
| 28405 |
var setIsShown = _useState2[1]; |
| 28406 |
if (!isShown) return null; |
| 28407 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Dialog, { |
| 28408 |
open: true, |
| 28409 |
maxWidth: "lg" |
| 28410 |
}, /*#__PURE__*/ react.default.createElement(_elementor_ui.DialogContent, { sx: { padding: 0 } }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, { sx: { |
| 28411 |
textAlign: "center", |
| 28412 |
padding: 3 |
| 28413 |
} }, props.message), /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, { |
| 28414 |
alignItems: "center", |
| 28415 |
spacing: 2, |
| 28416 |
marginBottom: 2 |
| 28417 |
}, /*#__PURE__*/ react.default.createElement(_elementor_ui.Button, { |
| 28418 |
variant: "contained", |
| 28419 |
type: "button", |
| 28420 |
color: "primary", |
| 28421 |
onClick: function onClick() { |
| 28422 |
var _props$onClose; |
| 28423 |
setIsShown(false); |
| 28424 |
(_props$onClose = props.onClose) === null || _props$onClose === void 0 || _props$onClose.call(props); |
| 28425 |
} |
| 28426 |
}, (0, _wordpress_i18n.__)("Close", "elementor"))))); |
| 28427 |
}; |
| 28428 |
AlertDialog.propTypes = { |
| 28429 |
message: import_prop_types$8.default.string.isRequired, |
| 28430 |
onClose: import_prop_types$8.default.func |
| 28431 |
}; |
| 28432 |
|
| 28433 |
//#endregion |
| 28434 |
//#region modules/ai/assets/js/editor/hooks/use-timeout.js |
| 28435 |
init_slicedToArray(); |
| 28436 |
var useTimeout = function useTimeout(delay) { |
| 28437 |
var _useState2 = _slicedToArray((0, react.useState)(false), 2); |
| 28438 |
var isTimeout = _useState2[0]; |
| 28439 |
var setIsTimeout = _useState2[1]; |
| 28440 |
var timeoutIdRef = (0, react.useRef)(null); |
| 28441 |
var turnOffTimeout = function turnOffTimeout() { |
| 28442 |
clearTimeout(timeoutIdRef.current); |
| 28443 |
setIsTimeout(false); |
| 28444 |
}; |
| 28445 |
(0, react.useEffect)(function() { |
| 28446 |
timeoutIdRef.current = setTimeout(function() { |
| 28447 |
setIsTimeout(true); |
| 28448 |
}, delay); |
| 28449 |
return function() { |
| 28450 |
clearTimeout(timeoutIdRef.current); |
| 28451 |
}; |
| 28452 |
}, [delay]); |
| 28453 |
return [isTimeout, turnOffTimeout]; |
| 28454 |
}; |
| 28455 |
|
| 28456 |
//#endregion |
| 28457 |
//#region modules/ai/assets/js/editor/pages/form-layout/context/remote-config.js |
| 28458 |
init_asyncToGenerator(); |
| 28459 |
init_slicedToArray(); |
| 28460 |
init_api(); |
| 28461 |
var RemoteConfigContext = react.default.createContext({}); |
| 28462 |
var useRemoteConfig = function useRemoteConfig() { |
| 28463 |
return react.default.useContext(RemoteConfigContext); |
| 28464 |
}; |
| 28465 |
var CONFIG_KEYS = { |
| 28466 |
WEB_BASED_BUILDER_URL: "webBasedBuilderUrl", |
| 28467 |
AUTH_TOKEN: "jwt" |
| 28468 |
}; |
| 28469 |
var RemoteConfigProvider = function RemoteConfigProvider(props) { |
| 28470 |
var _useState2 = _slicedToArray((0, react.useState)(false), 2); |
| 28471 |
var isLoading = _useState2[0]; |
| 28472 |
var setIsLoading = _useState2[1]; |
| 28473 |
var _useState4 = _slicedToArray((0, react.useState)(false), 2); |
| 28474 |
var isLoaded = _useState4[0]; |
| 28475 |
var setIsLoaded = _useState4[1]; |
| 28476 |
var _useState6 = _slicedToArray((0, react.useState)(false), 2); |
| 28477 |
var isError = _useState6[0]; |
| 28478 |
var setIsError = _useState6[1]; |
| 28479 |
var _useState8 = _slicedToArray((0, react.useState)({}), 2); |
| 28480 |
var remoteConfig = _useState8[0]; |
| 28481 |
var setRemoteConfig = _useState8[1]; |
| 28482 |
var fetchData = /*#__PURE__*/ function() { |
| 28483 |
var _ref = _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee() { |
| 28484 |
var result; |
| 28485 |
return import_regenerator$2.default.wrap(function(_context) { |
| 28486 |
while (1) switch (_context.prev = _context.next) { |
| 28487 |
case 0: |
| 28488 |
setIsLoading(true); |
| 28489 |
setIsError(false); |
| 28490 |
_context.prev = 1; |
| 28491 |
_context.next = 2; |
| 28492 |
return getRemoteConfig().finally(function() { |
| 28493 |
setIsLoaded(true); |
| 28494 |
setIsLoading(false); |
| 28495 |
}); |
| 28496 |
case 2: |
| 28497 |
result = _context.sent; |
| 28498 |
if (result.config) { |
| 28499 |
_context.next = 3; |
| 28500 |
break; |
| 28501 |
} |
| 28502 |
throw new Error("Invalid remote config"); |
| 28503 |
case 3: |
| 28504 |
setRemoteConfig(result.config); |
| 28505 |
_context.next = 5; |
| 28506 |
break; |
| 28507 |
case 4: |
| 28508 |
_context.prev = 4; |
| 28509 |
_context["catch"](1); |
| 28510 |
setIsError(true); |
| 28511 |
setIsLoaded(true); |
| 28512 |
setIsLoading(false); |
| 28513 |
case 5: |
| 28514 |
case "end": return _context.stop(); |
| 28515 |
} |
| 28516 |
}, _callee, null, [[1, 4]]); |
| 28517 |
})); |
| 28518 |
return function fetchData() { |
| 28519 |
return _ref.apply(this, arguments); |
| 28520 |
}; |
| 28521 |
}(); |
| 28522 |
(0, react.useEffect)(function() { |
| 28523 |
window.addEventListener("elementor/connect/success", fetchData); |
| 28524 |
return function() { |
| 28525 |
window.removeEventListener("elementor/connect/success", fetchData); |
| 28526 |
}; |
| 28527 |
}, []); |
| 28528 |
if (!isLoaded && !isLoading) fetchData(); |
| 28529 |
return /*#__PURE__*/ react.default.createElement(RemoteConfigContext.Provider, { value: { |
| 28530 |
isLoading, |
| 28531 |
isLoaded, |
| 28532 |
isError, |
| 28533 |
remoteConfig |
| 28534 |
} }, props.children); |
| 28535 |
}; |
| 28536 |
RemoteConfigProvider.propTypes = { |
| 28537 |
children: import_prop_types$8.default.node.isRequired, |
| 28538 |
onError: import_prop_types$8.default.func.isRequired |
| 28539 |
}; |
| 28540 |
|
| 28541 |
//#endregion |
| 28542 |
//#region modules/ai/assets/js/editor/pages/form-layout/components/attachments/url-dialog.js |
| 28543 |
init_slicedToArray(); |
| 28544 |
init_requests_ids(); |
| 28545 |
var UrlDialog = function UrlDialog(props) { |
| 28546 |
var _useTimeout2 = _slicedToArray(useTimeout(1e4), 2); |
| 28547 |
var isTimeout = _useTimeout2[0]; |
| 28548 |
var turnOffTimeout = _useTimeout2[1]; |
| 28549 |
var _useUserInfo = useUserInfo(); |
| 28550 |
var isLoading = _useUserInfo.isLoading; |
| 28551 |
var initialUsagePercentage = _useUserInfo.usagePercentage; |
| 28552 |
var updateUsagePercentage = useRequestIds().updateUsagePercentage; |
| 28553 |
var _useState2 = _slicedToArray((0, react.useState)(false), 2); |
| 28554 |
var isInitUsageDone = _useState2[0]; |
| 28555 |
var setIsInitUsageDone = _useState2[1]; |
| 28556 |
var builderUrl = useRemoteConfig().remoteConfig[CONFIG_KEYS.WEB_BASED_BUILDER_URL]; |
| 28557 |
var iframeOrigin = (builderUrl ? new URL(builderUrl) : {}).origin; |
| 28558 |
var isOpen = (0, react.useRef)(false); |
| 28559 |
(0, react.useEffect)(function() { |
| 28560 |
if (!isInitUsageDone && !isLoading && (initialUsagePercentage || 0 === initialUsagePercentage)) { |
| 28561 |
updateUsagePercentage(initialUsagePercentage); |
| 28562 |
setIsInitUsageDone(true); |
| 28563 |
} |
| 28564 |
}, [ |
| 28565 |
isLoading, |
| 28566 |
initialUsagePercentage, |
| 28567 |
isInitUsageDone, |
| 28568 |
updateUsagePercentage |
| 28569 |
]); |
| 28570 |
(0, react.useEffect)(function() { |
| 28571 |
if (!isOpen.current) try { |
| 28572 |
window.$e.run("ai-integration/open-choose-element", { url: props.url }); |
| 28573 |
isOpen.current = true; |
| 28574 |
} catch (error) { |
| 28575 |
console.error(error); |
| 28576 |
} |
| 28577 |
}, [isOpen.current]); |
| 28578 |
(0, react.useEffect)(function() { |
| 28579 |
var onMessage = function onMessage(event) { |
| 28580 |
if (event.origin !== iframeOrigin) return; |
| 28581 |
var _event$data = event.data; |
| 28582 |
var type = _event$data.type; |
| 28583 |
var html = _event$data.html; |
| 28584 |
var url = _event$data.url; |
| 28585 |
switch (type) { |
| 28586 |
case "element-selector/close": |
| 28587 |
isOpen.current = false; |
| 28588 |
props.onClose(); |
| 28589 |
break; |
| 28590 |
case "element-selector/loaded": |
| 28591 |
turnOffTimeout(); |
| 28592 |
isOpen.current = true; |
| 28593 |
break; |
| 28594 |
case "element-selector/attach": |
| 28595 |
props.onAttach([{ |
| 28596 |
type: "url", |
| 28597 |
previewHTML: html, |
| 28598 |
content: html, |
| 28599 |
label: url ? new URL(url).href : "", |
| 28600 |
source: USER_URL_SOURCE |
| 28601 |
}]); |
| 28602 |
break; |
| 28603 |
} |
| 28604 |
}; |
| 28605 |
window.addEventListener("message", onMessage); |
| 28606 |
return function() { |
| 28607 |
window.removeEventListener("message", onMessage); |
| 28608 |
}; |
| 28609 |
}, [ |
| 28610 |
iframeOrigin, |
| 28611 |
props, |
| 28612 |
turnOffTimeout |
| 28613 |
]); |
| 28614 |
return /*#__PURE__*/ react.default.createElement(react.default.Fragment, null, !isOpen.current && !isTimeout && /*#__PURE__*/ react.default.createElement(_elementor_ui.Dialog, { |
| 28615 |
open: true, |
| 28616 |
maxWidth: "lg" |
| 28617 |
}, /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, { sx: { |
| 28618 |
textAlign: "center", |
| 28619 |
padding: 3 |
| 28620 |
} }, (0, _wordpress_i18n.__)("Loading...", "elementor"))), isTimeout && /*#__PURE__*/ react.default.createElement(AlertDialog, { |
| 28621 |
message: (0, _wordpress_i18n.__)("The app is not responding. Please try again later. (#408)", "elementor"), |
| 28622 |
onClose: props.onClose |
| 28623 |
})); |
| 28624 |
}; |
| 28625 |
UrlDialog.propTypes = { |
| 28626 |
onAttach: import_prop_types$8.default.func.isRequired, |
| 28627 |
onClose: import_prop_types$8.default.func.isRequired, |
| 28628 |
url: import_prop_types$8.default.string |
| 28629 |
}; |
| 28630 |
|
| 28631 |
//#endregion |
| 28632 |
//#region modules/ai/assets/js/editor/pages/form-layout/components/attachments/library-dialog.js |
| 28633 |
var LibraryDialog = function LibraryDialog(props) { |
| 28634 |
var isApplyingTemplate = (0, react.useRef)(false); |
| 28635 |
(0, react.useEffect)(function() { |
| 28636 |
var onLibraryHide = function onLibraryHide() { |
| 28637 |
if (isApplyingTemplate.current) return; |
| 28638 |
props.onClose(); |
| 28639 |
}; |
| 28640 |
$e.components.get("library").layout.getModal().on("hide", onLibraryHide); |
| 28641 |
return function() { |
| 28642 |
$e.components.get("library").layout.getModal().off("hide", onLibraryHide); |
| 28643 |
}; |
| 28644 |
}, [props]); |
| 28645 |
(0, react.useEffect)(function() { |
| 28646 |
var onMessage = function onMessage(event) { |
| 28647 |
var _event$data = event.data; |
| 28648 |
var type = _event$data.type; |
| 28649 |
var json = _event$data.json; |
| 28650 |
var html = _event$data.html; |
| 28651 |
var label = _event$data.label; |
| 28652 |
var source = _event$data.source; |
| 28653 |
switch (type) { |
| 28654 |
case "library/attach:start": |
| 28655 |
isApplyingTemplate.current = true; |
| 28656 |
break; |
| 28657 |
case "library/attach": |
| 28658 |
props.onAttach([{ |
| 28659 |
type: ATTACHMENT_TYPE_JSON, |
| 28660 |
previewHTML: html, |
| 28661 |
content: json, |
| 28662 |
label, |
| 28663 |
source |
| 28664 |
}]); |
| 28665 |
isApplyingTemplate.current = false; |
| 28666 |
props.onClose(); |
| 28667 |
break; |
| 28668 |
} |
| 28669 |
}; |
| 28670 |
window.addEventListener("message", onMessage); |
| 28671 |
return function() { |
| 28672 |
window.removeEventListener("message", onMessage); |
| 28673 |
}; |
| 28674 |
}); |
| 28675 |
$e.run("library/open", { |
| 28676 |
toDefault: true, |
| 28677 |
mode: "ai-attachment" |
| 28678 |
}); |
| 28679 |
isApplyingTemplate.current = false; |
| 28680 |
return null; |
| 28681 |
}; |
| 28682 |
LibraryDialog.propTypes = { |
| 28683 |
onAttach: import_prop_types$8.default.func.isRequired, |
| 28684 |
onClose: import_prop_types$8.default.func.isRequired |
| 28685 |
}; |
| 28686 |
|
| 28687 |
//#endregion |
| 28688 |
//#region modules/ai/assets/js/editor/pages/form-layout/components/attachments/attach-dialog.js |
| 28689 |
var AttachDialog = function AttachDialog(props) { |
| 28690 |
var type = props.type; |
| 28691 |
var url = props.url; |
| 28692 |
switch (type) { |
| 28693 |
case "url": return /*#__PURE__*/ react.default.createElement(UrlDialog, { |
| 28694 |
url, |
| 28695 |
onAttach: props.onAttach, |
| 28696 |
onClose: props.onClose |
| 28697 |
}); |
| 28698 |
case MENU_TYPE_LIBRARY: return /*#__PURE__*/ react.default.createElement(LibraryDialog, { |
| 28699 |
onAttach: props.onAttach, |
| 28700 |
onClose: props.onClose |
| 28701 |
}); |
| 28702 |
} |
| 28703 |
return null; |
| 28704 |
}; |
| 28705 |
AttachDialog.propTypes = { |
| 28706 |
type: import_prop_types$8.default.string, |
| 28707 |
onAttach: import_prop_types$8.default.func, |
| 28708 |
onClose: import_prop_types$8.default.func, |
| 28709 |
url: import_prop_types$8.default.string |
| 28710 |
}; |
| 28711 |
|
| 28712 |
//#endregion |
| 28713 |
//#region modules/ai/assets/js/editor/pages/form-layout/components/attachments/menu.js |
| 28714 |
init_slicedToArray(); |
| 28715 |
init_use_introduction(); |
| 28716 |
var Menu = function Menu(props) { |
| 28717 |
var _useState2 = _slicedToArray((0, react.useState)(false), 2); |
| 28718 |
var isOpen = _useState2[0]; |
| 28719 |
var setIsOpen = _useState2[1]; |
| 28720 |
var _useState4 = _slicedToArray((0, react.useState)(null), 2); |
| 28721 |
var selectedType = _useState4[0]; |
| 28722 |
var setSelectedType = _useState4[1]; |
| 28723 |
var direction = (0, _elementor_ui.useTheme)().direction; |
| 28724 |
var anchorRef = (0, react.useRef)(null); |
| 28725 |
var _useIntroduction = useIntroduction("e-ai-attachment-badge"); |
| 28726 |
var isViewed = _useIntroduction.isViewed; |
| 28727 |
var markAsViewed = _useIntroduction.markAsViewed; |
| 28728 |
return /*#__PURE__*/ react.default.createElement(react.default.Fragment, null, /*#__PURE__*/ react.default.createElement(_elementor_ui.IconButton, { |
| 28729 |
size: "small", |
| 28730 |
ref: anchorRef, |
| 28731 |
disabled: props.disabled, |
| 28732 |
onClick: function onClick() { |
| 28733 |
setIsOpen(true); |
| 28734 |
if (!isViewed) markAsViewed(); |
| 28735 |
}, |
| 28736 |
color: "secondary" |
| 28737 |
}, function() { |
| 28738 |
if (isOpen) return /*#__PURE__*/ react.default.createElement(XCircleIcon, { fontSize: "small" }); |
| 28739 |
else if (isViewed) return /*#__PURE__*/ react.default.createElement(PlusCircleIcon, { fontSize: "small" }); |
| 28740 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Badge, { |
| 28741 |
color: "primary", |
| 28742 |
badgeContent: " ", |
| 28743 |
variant: "dot" |
| 28744 |
}, /*#__PURE__*/ react.default.createElement(PlusCircleIcon, { fontSize: "small" })); |
| 28745 |
}()), /*#__PURE__*/ react.default.createElement(_elementor_ui.Popover, { |
| 28746 |
open: isOpen, |
| 28747 |
anchorEl: anchorRef.current, |
| 28748 |
onClose: function onClose() { |
| 28749 |
return setIsOpen(false); |
| 28750 |
}, |
| 28751 |
anchorOrigin: { |
| 28752 |
vertical: "bottom", |
| 28753 |
horizontal: "rtl" === direction ? "right" : "left" |
| 28754 |
}, |
| 28755 |
transformOrigin: { |
| 28756 |
vertical: "top", |
| 28757 |
horizontal: "rtl" === direction ? "right" : "left" |
| 28758 |
} |
| 28759 |
}, /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, { sx: { width: 440 } }, props.items.map(function(item) { |
| 28760 |
var IconComponent = item.icon; |
| 28761 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.MenuItem, { |
| 28762 |
key: item.type, |
| 28763 |
onClick: function onClick() { |
| 28764 |
setSelectedType(item.type); |
| 28765 |
setIsOpen(false); |
| 28766 |
} |
| 28767 |
}, /*#__PURE__*/ react.default.createElement(_elementor_ui.ListItemIcon, null, /*#__PURE__*/ react.default.createElement(IconComponent, null)), item.title); |
| 28768 |
}))), /*#__PURE__*/ react.default.createElement(AttachDialog, { |
| 28769 |
type: selectedType, |
| 28770 |
onAttach: props.onAttach, |
| 28771 |
onClose: function onClose() { |
| 28772 |
setIsOpen(false); |
| 28773 |
setSelectedType(null); |
| 28774 |
} |
| 28775 |
})); |
| 28776 |
}; |
| 28777 |
Menu.propTypes = { |
| 28778 |
items: import_prop_types$8.default.arrayOf(import_prop_types$8.default.shape({ |
| 28779 |
title: import_prop_types$8.default.string.isRequired, |
| 28780 |
type: import_prop_types$8.default.string.isRequired, |
| 28781 |
icon: import_prop_types$8.default.elementType |
| 28782 |
})).isRequired, |
| 28783 |
onAttach: import_prop_types$8.default.func.isRequired, |
| 28784 |
disabled: import_prop_types$8.default.bool |
| 28785 |
}; |
| 28786 |
|
| 28787 |
//#endregion |
| 28788 |
//#region modules/ai/assets/js/editor/pages/form-layout/components/attachments/thumbnail.js |
| 28789 |
var _templateObject; |
| 28790 |
var THUMBNAIL_SIZE = 64; |
| 28791 |
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); |
| 28792 |
var Thumbnail = function Thumbnail(props) { |
| 28793 |
var _props$html$match; |
| 28794 |
var _props$html$match2; |
| 28795 |
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; |
| 28796 |
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; |
| 28797 |
var width = dataWidth ? parseInt(dataWidth) : 64; |
| 28798 |
var height = dataHeight ? parseInt(dataHeight) : 64; |
| 28799 |
var scale = 64 / Math.min(height, width); |
| 28800 |
var top = height > width ? (64 - 64 * (height / width)) / 2 : 0; |
| 28801 |
var left = width > height ? (64 - 64 * (width / height)) / 2 : 0; |
| 28802 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, { |
| 28803 |
dir: "ltr", |
| 28804 |
sx: { |
| 28805 |
position: "relative", |
| 28806 |
cursor: "default", |
| 28807 |
overflow: "hidden", |
| 28808 |
border: "1px solid", |
| 28809 |
borderColor: "grey.300", |
| 28810 |
borderRadius: 1, |
| 28811 |
boxSizing: "border-box", |
| 28812 |
width: 64, |
| 28813 |
height: 64, |
| 28814 |
opacity: props.disabled ? .5 : 1 |
| 28815 |
} |
| 28816 |
}, /*#__PURE__*/ react.default.createElement("iframe", { |
| 28817 |
title: (0, _wordpress_i18n.__)("Preview", "elementor"), |
| 28818 |
sandbox: "", |
| 28819 |
srcDoc: "<style>" + StyledBody.componentStyle.rules.join("") + "</style>" + props.html, |
| 28820 |
style: { |
| 28821 |
border: "none", |
| 28822 |
overflow: "hidden", |
| 28823 |
width, |
| 28824 |
height, |
| 28825 |
transform: "scale(".concat(scale, ")"), |
| 28826 |
transformOrigin: "".concat(left, "px ").concat(top, "px") |
| 28827 |
} |
| 28828 |
})); |
| 28829 |
}; |
| 28830 |
Thumbnail.propTypes = { |
| 28831 |
html: import_prop_types$8.default.string.isRequired, |
| 28832 |
disabled: import_prop_types$8.default.bool |
| 28833 |
}; |
| 28834 |
|
| 28835 |
//#endregion |
| 28836 |
//#region modules/ai/assets/js/editor/types/attachment.js |
| 28837 |
var AttachmentPropType = import_prop_types$8.default.shape({ |
| 28838 |
type: import_prop_types$8.default.string, |
| 28839 |
previewHTML: import_prop_types$8.default.string, |
| 28840 |
content: import_prop_types$8.default.string, |
| 28841 |
label: import_prop_types$8.default.string, |
| 28842 |
source: import_prop_types$8.default.string |
| 28843 |
}); |
| 28844 |
var AttachmentsTypesPropType = import_prop_types$8.default.shape({ type: import_prop_types$8.default.shape({ |
| 28845 |
promptPlaceholder: import_prop_types$8.default.string, |
| 28846 |
promptSuggestions: import_prop_types$8.default.arrayOf(import_prop_types$8.default.shape({ text: import_prop_types$8.default.string.isRequired })), |
| 28847 |
previewGenerator: import_prop_types$8.default.func |
| 28848 |
}) }); |
| 28849 |
|
| 28850 |
//#endregion |
| 28851 |
//#region modules/ai/assets/js/editor/pages/form-layout/components/attachments/thumbnail-json.js |
| 28852 |
var ThumbnailJson = function ThumbnailJson(props) { |
| 28853 |
var _props$attachments; |
| 28854 |
var attachment = (_props$attachments = props.attachments) === null || _props$attachments === void 0 ? void 0 : _props$attachments.find(function(item) { |
| 28855 |
return "json" === item.type; |
| 28856 |
}); |
| 28857 |
if (!attachment) return null; |
| 28858 |
if (!attachment.previewHTML) return /*#__PURE__*/ react.default.createElement(_elementor_ui.Skeleton, { |
| 28859 |
animation: "wave", |
| 28860 |
variant: "rounded", |
| 28861 |
width: 60, |
| 28862 |
height: 60 |
| 28863 |
}); |
| 28864 |
return /*#__PURE__*/ react.default.createElement(Thumbnail, { |
| 28865 |
html: attachment.previewHTML, |
| 28866 |
disabled: props.disabled |
| 28867 |
}); |
| 28868 |
}; |
| 28869 |
ThumbnailJson.propTypes = { |
| 28870 |
attachments: import_prop_types$8.default.arrayOf(AttachmentPropType).isRequired, |
| 28871 |
disabled: import_prop_types$8.default.bool |
| 28872 |
}; |
| 28873 |
|
| 28874 |
//#endregion |
| 28875 |
//#region modules/ai/assets/js/editor/pages/form-layout/components/attachments/thumbnail-url.js |
| 28876 |
var ThumbnailUrl = function ThumbnailUrl(props) { |
| 28877 |
var _props$attachments; |
| 28878 |
var attachment = (_props$attachments = props.attachments) === null || _props$attachments === void 0 ? void 0 : _props$attachments.find(function(item) { |
| 28879 |
return "url" === item.type; |
| 28880 |
}); |
| 28881 |
if (!attachment) return null; |
| 28882 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, { sx: { |
| 28883 |
position: "relative", |
| 28884 |
"&:hover::before": { |
| 28885 |
content: "\"\"", |
| 28886 |
position: "absolute", |
| 28887 |
userSelect: "none", |
| 28888 |
inset: 0, |
| 28889 |
backgroundColor: "rgba(0,0,0,0.6)", |
| 28890 |
borderRadius: 1, |
| 28891 |
zIndex: 1 |
| 28892 |
}, |
| 28893 |
"&:hover .remove-attachment": { display: "flex" } |
| 28894 |
} }, /*#__PURE__*/ react.default.createElement(_elementor_ui.IconButton, { |
| 28895 |
className: "remove-attachment", |
| 28896 |
size: "small", |
| 28897 |
"aria-label": (0, _wordpress_i18n.__)("Remove", "elementor"), |
| 28898 |
disabled: props.disabled, |
| 28899 |
onClick: function onClick(event) { |
| 28900 |
event.stopPropagation(); |
| 28901 |
props.onDetach(); |
| 28902 |
}, |
| 28903 |
sx: { |
| 28904 |
display: "none", |
| 28905 |
position: "absolute", |
| 28906 |
insetInlineEnd: 4, |
| 28907 |
insetBlockStart: 4, |
| 28908 |
backgroundColor: "secondary.main", |
| 28909 |
zIndex: 1, |
| 28910 |
borderRadius: 1, |
| 28911 |
p: "3px", |
| 28912 |
"&:hover": { backgroundColor: "secondary.dark" } |
| 28913 |
} |
| 28914 |
}, /*#__PURE__*/ react.default.createElement(_elementor_icons.TrashIcon, { sx: { |
| 28915 |
fontSize: "1.125rem", |
| 28916 |
color: "common.white" |
| 28917 |
} })), /*#__PURE__*/ react.default.createElement(Thumbnail, { |
| 28918 |
disabled: props.disabled, |
| 28919 |
html: attachment.previewHTML |
| 28920 |
})); |
| 28921 |
}; |
| 28922 |
ThumbnailUrl.propTypes = { |
| 28923 |
attachments: import_prop_types$8.default.arrayOf(AttachmentPropType).isRequired, |
| 28924 |
disabled: import_prop_types$8.default.bool, |
| 28925 |
onDetach: import_prop_types$8.default.func |
| 28926 |
}; |
| 28927 |
|
| 28928 |
//#endregion |
| 28929 |
//#region modules/ai/assets/js/editor/icons/website-icon.js |
| 28930 |
init_extends(); |
| 28931 |
var WebsiteIcon = react.default.forwardRef(function(props, ref) { |
| 28932 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.SvgIcon, _extends$1({ viewBox: "0 0 24 24" }, props, { ref }), /*#__PURE__*/ react.default.createElement("path", { |
| 28933 |
fillRule: "evenodd", |
| 28934 |
clipRule: "evenodd", |
| 28935 |
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" |
| 28936 |
})); |
| 28937 |
}); |
| 28938 |
|
| 28939 |
//#endregion |
| 28940 |
//#region modules/ai/assets/js/editor/icons/copy-page-icon.js |
| 28941 |
init_extends(); |
| 28942 |
var CopyPageIcon = react.default.forwardRef(function(props, ref) { |
| 28943 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.SvgIcon, _extends$1({ viewBox: "0 0 24 24" }, props, { ref }), /*#__PURE__*/ react.default.createElement("path", { |
| 28944 |
fillRule: "evenodd", |
| 28945 |
clipRule: "evenodd", |
| 28946 |
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" |
| 28947 |
})); |
| 28948 |
}); |
| 28949 |
|
| 28950 |
//#endregion |
| 28951 |
//#region modules/ai/assets/js/editor/pages/form-layout/components/attachments.js |
| 28952 |
init_extends(); |
| 28953 |
var ATTACHMENT_TYPE_JSON = "json"; |
| 28954 |
var ATTACHMENT_TYPE_URL = "url"; |
| 28955 |
var MENU_TYPE_LIBRARY = "library"; |
| 28956 |
var USER_URL_SOURCE = "user-url"; |
| 28957 |
var Attachments = function Attachments(props) { |
| 28958 |
if (!props.attachments.length) return /*#__PURE__*/ react.default.createElement(Menu, { |
| 28959 |
disabled: props.disabled, |
| 28960 |
onAttach: props.onAttach, |
| 28961 |
items: [{ |
| 28962 |
title: (0, _wordpress_i18n.__)("Reference a website", "elementor"), |
| 28963 |
icon: WebsiteIcon, |
| 28964 |
type: "url" |
| 28965 |
}, { |
| 28966 |
title: (0, _wordpress_i18n.__)("Create variations from Template Library", "elementor"), |
| 28967 |
icon: CopyPageIcon, |
| 28968 |
type: MENU_TYPE_LIBRARY |
| 28969 |
}] |
| 28970 |
}); |
| 28971 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, { |
| 28972 |
direction: "row", |
| 28973 |
spacing: 1 |
| 28974 |
}, props.attachments.map(function(attachment, index) { |
| 28975 |
switch (attachment.type) { |
| 28976 |
case ATTACHMENT_TYPE_JSON: return /*#__PURE__*/ react.default.createElement(ThumbnailJson, _extends$1({ key: index }, props)); |
| 28977 |
case "url": return /*#__PURE__*/ react.default.createElement(ThumbnailUrl, _extends$1({ key: index }, props)); |
| 28978 |
default: return null; |
| 28979 |
} |
| 28980 |
})); |
| 28981 |
}; |
| 28982 |
Attachments.propTypes = { |
| 28983 |
attachments: import_prop_types$8.default.arrayOf(AttachmentPropType).isRequired, |
| 28984 |
onAttach: import_prop_types$8.default.func.isRequired, |
| 28985 |
onDetach: import_prop_types$8.default.func, |
| 28986 |
disabled: import_prop_types$8.default.bool |
| 28987 |
}; |
| 28988 |
|
| 28989 |
//#endregion |
| 28990 |
//#region modules/ai/assets/js/editor/pages/form-layout/components/prompt-form.js |
| 28991 |
init_slicedToArray(); |
| 28992 |
init_extends(); |
| 28993 |
init_objectWithoutProperties$1(); |
| 28994 |
var _excluded$2 = ["tooltip"]; |
| 28995 |
var PROMPT_SUGGESTIONS = Object.freeze([ |
| 28996 |
{ text: (0, _wordpress_i18n.__)("Hero section on [topic] with heading, text, buttons on the right, and an image on the left", "elementor.com") }, |
| 28997 |
{ text: (0, _wordpress_i18n.__)("About Us section on [topic] with heading, text, and big image below", "elementor.com") }, |
| 28998 |
{ text: (0, _wordpress_i18n.__)("Team section with four image boxes showcasing team members", "elementor.com") }, |
| 28999 |
{ text: (0, _wordpress_i18n.__)("FAQ section with a toggle widget showcasing FAQs about [topic]", "elementor.com") }, |
| 29000 |
{ text: (0, _wordpress_i18n.__)("Gallery section with a carousel displaying three images at once", "elementor.com") }, |
| 29001 |
{ text: (0, _wordpress_i18n.__)("Contact section with a form for [topic]", "elementor.com") }, |
| 29002 |
{ text: (0, _wordpress_i18n.__)("Client section featuring companies' logos", "elementor.com") }, |
| 29003 |
{ text: (0, _wordpress_i18n.__)("Testimonial section with testimonials, each featuring a star rating and an image", "elementor.com") }, |
| 29004 |
{ text: (0, _wordpress_i18n.__)("Service section about [topic], showcasing four services with buttons", "elementor.com") }, |
| 29005 |
{ text: (0, _wordpress_i18n.__)("Stats section with counters displaying data about [topic]", "elementor.com") }, |
| 29006 |
{ text: (0, _wordpress_i18n.__)("Quote section with colored background, featuring a centered quote", "elementor.com") }, |
| 29007 |
{ text: (0, _wordpress_i18n.__)("Pricing section for [topic] with a pricing list", "elementor.com") }, |
| 29008 |
{ text: (0, _wordpress_i18n.__)("Subscribe section featuring a simple email form, inviting users to stay informed on [topic]", "elementor.com") } |
| 29009 |
]); |
| 29010 |
var IconButtonWithTooltip = function IconButtonWithTooltip(_ref) { |
| 29011 |
var tooltip = _ref.tooltip; |
| 29012 |
var props = _objectWithoutProperties$1(_ref, _excluded$2); |
| 29013 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Tooltip, { title: tooltip }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, { |
| 29014 |
component: "span", |
| 29015 |
sx: { cursor: props.disabled ? "default" : "pointer" } |
| 29016 |
}, /*#__PURE__*/ react.default.createElement(_elementor_ui.IconButton, props))); |
| 29017 |
}; |
| 29018 |
IconButtonWithTooltip.propTypes = { |
| 29019 |
tooltip: import_prop_types$8.default.string, |
| 29020 |
disabled: import_prop_types$8.default.bool |
| 29021 |
}; |
| 29022 |
var BackButton = function BackButton(props) { |
| 29023 |
return /*#__PURE__*/ react.default.createElement(IconButtonWithTooltip, _extends$1({ |
| 29024 |
size: "small", |
| 29025 |
color: "secondary", |
| 29026 |
tooltip: (0, _wordpress_i18n.__)("Back to results", "elementor") |
| 29027 |
}, props), /*#__PURE__*/ react.default.createElement(ArrowLeftIcon, null)); |
| 29028 |
}; |
| 29029 |
var EditButton = function EditButton(props) { |
| 29030 |
return /*#__PURE__*/ react.default.createElement(IconButtonWithTooltip, _extends$1({ |
| 29031 |
size: "small", |
| 29032 |
color: "primary", |
| 29033 |
tooltip: (0, _wordpress_i18n.__)("Edit prompt", "elementor") |
| 29034 |
}, props), /*#__PURE__*/ react.default.createElement(EditIcon$1, null)); |
| 29035 |
}; |
| 29036 |
var GenerateButton = function GenerateButton(props) { |
| 29037 |
return /*#__PURE__*/ react.default.createElement(GenerateSubmit, _extends$1({ |
| 29038 |
size: "small", |
| 29039 |
fullWidth: false |
| 29040 |
}, props), (0, _wordpress_i18n.__)("Generate", "elementor")); |
| 29041 |
}; |
| 29042 |
var PromptForm = (0, react.forwardRef)(function(_ref2, ref) { |
| 29043 |
var _attachments$; |
| 29044 |
var attachments = _ref2.attachments; |
| 29045 |
var isActive = _ref2.isActive; |
| 29046 |
var isLoading = _ref2.isLoading; |
| 29047 |
var _ref2$showActions = _ref2.showActions; |
| 29048 |
var showActions = _ref2$showActions === void 0 ? false : _ref2$showActions; |
| 29049 |
var onAttach = _ref2.onAttach; |
| 29050 |
var onDetach = _ref2.onDetach; |
| 29051 |
var _onSubmit = _ref2.onSubmit; |
| 29052 |
var onBack = _ref2.onBack; |
| 29053 |
var onEdit = _ref2.onEdit; |
| 29054 |
var _ref2$shouldResetProm = _ref2.shouldResetPrompt; |
| 29055 |
var shouldResetPrompt = _ref2$shouldResetProm === void 0 ? false : _ref2$shouldResetProm; |
| 29056 |
var _useState2 = _slicedToArray((0, react.useState)(""), 2); |
| 29057 |
var prompt = _useState2[0]; |
| 29058 |
var setPrompt = _useState2[1]; |
| 29059 |
(0, react.useEffect)(function() { |
| 29060 |
if (shouldResetPrompt) setPrompt(""); |
| 29061 |
}, [shouldResetPrompt]); |
| 29062 |
var _usePromptEnhancer = usePromptEnhancer(prompt, "layout"); |
| 29063 |
var isEnhancing = _usePromptEnhancer.isEnhancing; |
| 29064 |
var enhance = _usePromptEnhancer.enhance; |
| 29065 |
var previousPrompt = (0, react.useRef)(""); |
| 29066 |
var attachmentsTypes = useConfig().attachmentsTypes; |
| 29067 |
var isInputDisabled = isLoading || isEnhancing || !isActive; |
| 29068 |
var isInputEmpty = "" === prompt && !attachments.length; |
| 29069 |
var isGenerateDisabled = isInputDisabled || isInputEmpty; |
| 29070 |
var attachmentsConfig = attachmentsTypes[((_attachments$ = attachments[0]) === null || _attachments$ === void 0 ? void 0 : _attachments$.type) || ""]; |
| 29071 |
var promptSuggestions = (attachmentsConfig === null || attachmentsConfig === void 0 ? void 0 : attachmentsConfig.promptSuggestions) || PROMPT_SUGGESTIONS; |
| 29072 |
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"); |
| 29073 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, { |
| 29074 |
component: "form", |
| 29075 |
onSubmit: function onSubmit(e) { |
| 29076 |
return _onSubmit(e, prompt); |
| 29077 |
}, |
| 29078 |
direction: "row", |
| 29079 |
sx: { p: 3 }, |
| 29080 |
alignItems: "start", |
| 29081 |
gap: 1 |
| 29082 |
}, /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, { |
| 29083 |
direction: "row", |
| 29084 |
alignItems: "start", |
| 29085 |
flexGrow: 1, |
| 29086 |
spacing: 2 |
| 29087 |
}, showActions && (isActive ? /*#__PURE__*/ react.default.createElement(BackButton, { |
| 29088 |
disabled: isLoading || isEnhancing, |
| 29089 |
onClick: function handleBack() { |
| 29090 |
setPrompt(previousPrompt.current); |
| 29091 |
onBack(); |
| 29092 |
} |
| 29093 |
}) : /*#__PURE__*/ react.default.createElement(EditButton, { |
| 29094 |
disabled: isLoading, |
| 29095 |
onClick: function handleEdit() { |
| 29096 |
previousPrompt.current = prompt; |
| 29097 |
onEdit(); |
| 29098 |
} |
| 29099 |
})), /*#__PURE__*/ react.default.createElement(Attachments, { |
| 29100 |
attachments, |
| 29101 |
onAttach, |
| 29102 |
onDetach, |
| 29103 |
disabled: isInputDisabled |
| 29104 |
}), /*#__PURE__*/ react.default.createElement(PromptAutocomplete, { |
| 29105 |
value: prompt, |
| 29106 |
disabled: isInputDisabled, |
| 29107 |
onSubmit: function onSubmit(e) { |
| 29108 |
return _onSubmit(e, prompt); |
| 29109 |
}, |
| 29110 |
options: promptSuggestions, |
| 29111 |
onChange: function onChange(_, selectedValue) { |
| 29112 |
return setPrompt(selectedValue.text + " "); |
| 29113 |
}, |
| 29114 |
renderInput: function renderInput(params) { |
| 29115 |
return /*#__PURE__*/ react.default.createElement(PromptAutocomplete.TextInput, _extends$1({}, params, { |
| 29116 |
ref, |
| 29117 |
onChange: function onChange(e) { |
| 29118 |
return setPrompt(e.target.value); |
| 29119 |
}, |
| 29120 |
placeholder: promptPlaceholder |
| 29121 |
})); |
| 29122 |
} |
| 29123 |
})), /*#__PURE__*/ react.default.createElement(EnhanceButton, { |
| 29124 |
size: "small", |
| 29125 |
disabled: isGenerateDisabled || "" === prompt, |
| 29126 |
isLoading: isEnhancing, |
| 29127 |
onClick: function onClick() { |
| 29128 |
return enhance().then(function(_ref3) { |
| 29129 |
var result = _ref3.result; |
| 29130 |
return setPrompt(result); |
| 29131 |
}); |
| 29132 |
} |
| 29133 |
}), /*#__PURE__*/ react.default.createElement(GenerateButton, { disabled: isGenerateDisabled })); |
| 29134 |
}); |
| 29135 |
PromptForm.propTypes = { |
| 29136 |
isActive: import_prop_types$8.default.bool, |
| 29137 |
onAttach: import_prop_types$8.default.func, |
| 29138 |
onDetach: import_prop_types$8.default.func, |
| 29139 |
isLoading: import_prop_types$8.default.bool, |
| 29140 |
showActions: import_prop_types$8.default.bool, |
| 29141 |
onSubmit: import_prop_types$8.default.func.isRequired, |
| 29142 |
onBack: import_prop_types$8.default.func.isRequired, |
| 29143 |
onEdit: import_prop_types$8.default.func.isRequired, |
| 29144 |
attachments: import_prop_types$8.default.arrayOf(AttachmentPropType), |
| 29145 |
shouldResetPrompt: import_prop_types$8.default.bool |
| 29146 |
}; |
| 29147 |
|
| 29148 |
//#endregion |
| 29149 |
//#region modules/ai/assets/js/editor/pages/form-layout/components/screenshot-container.js |
| 29150 |
var ScreenshotContainer = (0, _elementor_ui.styled)(_elementor_ui.Box, { shouldForwardProp: function shouldForwardProp(prop) { |
| 29151 |
return prop !== "outlineOffset"; |
| 29152 |
} })(function(_ref) { |
| 29153 |
var theme = _ref.theme; |
| 29154 |
var selected = _ref.selected; |
| 29155 |
var height = _ref.height; |
| 29156 |
var disabled = _ref.disabled; |
| 29157 |
var _ref$outlineOffset = _ref.outlineOffset; |
| 29158 |
var outlineOffset = _ref$outlineOffset === void 0 ? "0px" : _ref$outlineOffset; |
| 29159 |
var outlineColor = selected ? theme.palette.text.primary : theme.palette.text.disabled; |
| 29160 |
var outline = "2px solid ".concat(outlineColor); |
| 29161 |
return { |
| 29162 |
height, |
| 29163 |
cursor: disabled ? "default" : "pointer", |
| 29164 |
overflow: "hidden", |
| 29165 |
boxSizing: "border-box", |
| 29166 |
backgroundPosition: "top center", |
| 29167 |
backgroundSize: "100% auto", |
| 29168 |
backgroundRepeat: "no-repeat", |
| 29169 |
backgroundColor: theme.palette.common.white, |
| 29170 |
borderRadius: theme.shape.borderRadius * .5, |
| 29171 |
outlineOffset, |
| 29172 |
outline, |
| 29173 |
opacity: disabled ? "0.4" : "1", |
| 29174 |
transition: "all 50ms linear", |
| 29175 |
"&:hover": disabled ? {} : { outlineColor: theme.palette.text.primary } |
| 29176 |
}; |
| 29177 |
}); |
| 29178 |
|
| 29179 |
//#endregion |
| 29180 |
//#region modules/ai/assets/js/editor/pages/form-layout/components/screenshot-unavailable.js |
| 29181 |
init_extends(); |
| 29182 |
init_defineProperty$1(); |
| 29183 |
function ownKeys$2(e, r) { |
| 29184 |
var t = Object.keys(e); |
| 29185 |
if (Object.getOwnPropertySymbols) { |
| 29186 |
var o = Object.getOwnPropertySymbols(e); |
| 29187 |
r && (o = o.filter(function(r) { |
| 29188 |
return Object.getOwnPropertyDescriptor(e, r).enumerable; |
| 29189 |
})), t.push.apply(t, o); |
| 29190 |
} |
| 29191 |
return t; |
| 29192 |
} |
| 29193 |
__name(ownKeys$2, "ownKeys"); |
| 29194 |
function _objectSpread$2(e) { |
| 29195 |
for (var r = 1; r < arguments.length; r++) { |
| 29196 |
var t = null != arguments[r] ? arguments[r] : {}; |
| 29197 |
r % 2 ? ownKeys$2(Object(t), !0).forEach(function(r) { |
| 29198 |
_defineProperty$1(e, r, t[r]); |
| 29199 |
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function(r) { |
| 29200 |
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); |
| 29201 |
}); |
| 29202 |
} |
| 29203 |
return e; |
| 29204 |
} |
| 29205 |
__name(_objectSpread$2, "_objectSpread"); |
| 29206 |
function ScreenshotUnavailable(props) { |
| 29207 |
return /*#__PURE__*/ react.default.createElement(ScreenshotContainer, _extends$1({}, props, { sx: _objectSpread$2(_objectSpread$2({}, props.sx || {}), {}, { |
| 29208 |
display: "flex", |
| 29209 |
alignItems: "center", |
| 29210 |
justifyContent: "center", |
| 29211 |
backgroundColor: "background.paper", |
| 29212 |
color: "text.tertiary", |
| 29213 |
fontStyle: "italic", |
| 29214 |
fontSize: "12px", |
| 29215 |
paddingInline: 12, |
| 29216 |
textAlign: "center", |
| 29217 |
lineHeight: 1.5 |
| 29218 |
}) }), (0, _wordpress_i18n.__)("Preview unavailable", "elementor")); |
| 29219 |
} |
| 29220 |
ScreenshotUnavailable.propTypes = { sx: import_prop_types$8.default.object }; |
| 29221 |
|
| 29222 |
//#endregion |
| 29223 |
//#region modules/ai/assets/js/editor/icons/lock-icon.js |
| 29224 |
init_extends(); |
| 29225 |
var LockIcon = react.default.forwardRef(function(props, ref) { |
| 29226 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.SvgIcon, _extends$1({ viewBox: "0 0 24 24" }, props, { ref }), /*#__PURE__*/ react.default.createElement("path", { |
| 29227 |
fillRule: "evenodd", |
| 29228 |
clipRule: "evenodd", |
| 29229 |
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" |
| 29230 |
}), /*#__PURE__*/ react.default.createElement("path", { |
| 29231 |
fillRule: "evenodd", |
| 29232 |
clipRule: "evenodd", |
| 29233 |
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" |
| 29234 |
}), /*#__PURE__*/ react.default.createElement("path", { d: "M6 12H19V20H6V12Z" })); |
| 29235 |
}); |
| 29236 |
|
| 29237 |
//#endregion |
| 29238 |
//#region modules/ai/assets/js/editor/pages/form-layout/components/pro-template-indicator.js |
| 29239 |
init_slicedToArray(); |
| 29240 |
var popoverId = "e-pro-upgrade-popover"; |
| 29241 |
var StyledContent = (0, _elementor_ui.styled)(_elementor_ui.Paper)(function(_ref) { |
| 29242 |
var theme = _ref.theme; |
| 29243 |
return { |
| 29244 |
position: "relative", |
| 29245 |
padding: theme.spacing(3), |
| 29246 |
boxShadow: theme.shadows[4], |
| 29247 |
zIndex: "9999" |
| 29248 |
}; |
| 29249 |
}); |
| 29250 |
var StyledArrow = (0, _elementor_ui.styled)(_elementor_ui.Box)(function(_ref2) { |
| 29251 |
var theme = _ref2.theme; |
| 29252 |
return { |
| 29253 |
position: "absolute", |
| 29254 |
width: theme.spacing(5), |
| 29255 |
height: theme.spacing(5), |
| 29256 |
overflow: "hidden", |
| 29257 |
left: "100% !important", |
| 29258 |
transform: "translateX(-50%) translateY(-50%) rotate(var(--rotate, 0deg)) !important", |
| 29259 |
"&::after": { |
| 29260 |
backgroundColor: theme.palette.background.paper, |
| 29261 |
content: "\"\"", |
| 29262 |
display: "block", |
| 29263 |
position: "absolute", |
| 29264 |
width: theme.spacing(2.5), |
| 29265 |
height: theme.spacing(2.5), |
| 29266 |
top: "50%", |
| 29267 |
left: "50%", |
| 29268 |
transform: "translateX(-50%) translateY(-50%) rotate(45deg)", |
| 29269 |
boxShadow: "5px -5px 5px 0px rgba(0, 0, 0, 0.2)", |
| 29270 |
backgroundImage: "linear-gradient(rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.05))" |
| 29271 |
} |
| 29272 |
}; |
| 29273 |
}); |
| 29274 |
var ProTemplateIndicator = function ProTemplateIndicator() { |
| 29275 |
var actionUrl = "https://go.elementor.com/go-pro-ai/"; |
| 29276 |
var actionLabel = (0, _wordpress_i18n.__)("Go Pro", "elementor"); |
| 29277 |
var _useState2 = _slicedToArray((0, react.useState)(false), 2); |
| 29278 |
var isPopoverOpen = _useState2[0]; |
| 29279 |
var setIsPopoverOpen = _useState2[1]; |
| 29280 |
var anchorEl = (0, react.useRef)(null); |
| 29281 |
var arrowEl = (0, react.useRef)(null); |
| 29282 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, { |
| 29283 |
flexDirection: "row-reverse", |
| 29284 |
component: "span", |
| 29285 |
display: "flex", |
| 29286 |
onMouseLeave: function hidePopover() { |
| 29287 |
return setIsPopoverOpen(false); |
| 29288 |
}, |
| 29289 |
alignItems: "center" |
| 29290 |
}, /*#__PURE__*/ react.default.createElement(_elementor_ui.IconButton, { |
| 29291 |
ref: anchorEl, |
| 29292 |
onMouseEnter: function showPopover() { |
| 29293 |
return setIsPopoverOpen(true); |
| 29294 |
}, |
| 29295 |
onClick: function onClick(e) { |
| 29296 |
return e.stopPropagation(); |
| 29297 |
}, |
| 29298 |
"aria-owns": isPopoverOpen ? popoverId : void 0, |
| 29299 |
"aria-haspopup": "true", |
| 29300 |
sx: { |
| 29301 |
m: 1, |
| 29302 |
"&:hover": { backgroundColor: "action.selected" } |
| 29303 |
} |
| 29304 |
}, /*#__PURE__*/ react.default.createElement(LockIcon, { sx: { color: "text.primary" } })), /*#__PURE__*/ react.default.createElement(_elementor_ui.Popper, { |
| 29305 |
open: isPopoverOpen, |
| 29306 |
popperOptions: { |
| 29307 |
placement: "left-start", |
| 29308 |
modifiers: [{ |
| 29309 |
name: "arrow", |
| 29310 |
enabled: true, |
| 29311 |
options: { |
| 29312 |
element: arrowEl.current, |
| 29313 |
padding: 5 |
| 29314 |
} |
| 29315 |
}, { |
| 29316 |
name: "offset", |
| 29317 |
options: { offset: [0, 10] } |
| 29318 |
}] |
| 29319 |
}, |
| 29320 |
anchorEl: anchorEl.current, |
| 29321 |
sx: { |
| 29322 |
zIndex: "9999", |
| 29323 |
maxWidth: 300 |
| 29324 |
} |
| 29325 |
}, /*#__PURE__*/ react.default.createElement(StyledContent, null, /*#__PURE__*/ react.default.createElement(StyledArrow, { ref: arrowEl }), /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, { |
| 29326 |
alignItems: "start", |
| 29327 |
spacing: 2 |
| 29328 |
}, /*#__PURE__*/ react.default.createElement(_elementor_ui.Chip, { |
| 29329 |
color: "promotion", |
| 29330 |
variant: "outlined", |
| 29331 |
size: "small", |
| 29332 |
label: (0, _wordpress_i18n.__)("Pro", "elementor"), |
| 29333 |
icon: /*#__PURE__*/ react.default.createElement(LockIcon, null) |
| 29334 |
}), /*#__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, { |
| 29335 |
variant: "contained", |
| 29336 |
color: "promotion", |
| 29337 |
size: "small", |
| 29338 |
href: actionUrl, |
| 29339 |
target: "_blank", |
| 29340 |
sx: { alignSelf: "flex-end" } |
| 29341 |
}, actionLabel))))); |
| 29342 |
}; |
| 29343 |
|
| 29344 |
//#endregion |
| 29345 |
//#region modules/ai/assets/js/editor/pages/form-layout/components/template-badge.js |
| 29346 |
var TemplateBadge = function TemplateBadge(props) { |
| 29347 |
var hasPro = useConfig().hasPro; |
| 29348 |
if ("Pro" === props.type && !hasPro) return /*#__PURE__*/ react.default.createElement(ProTemplateIndicator, null); |
| 29349 |
return null; |
| 29350 |
}; |
| 29351 |
TemplateBadge.propTypes = { type: import_prop_types$8.default.string }; |
| 29352 |
|
| 29353 |
//#endregion |
| 29354 |
//#region modules/ai/assets/js/editor/pages/form-layout/components/screenshot.js |
| 29355 |
init_defineProperty$1(); |
| 29356 |
function ownKeys$1(e, r) { |
| 29357 |
var t = Object.keys(e); |
| 29358 |
if (Object.getOwnPropertySymbols) { |
| 29359 |
var o = Object.getOwnPropertySymbols(e); |
| 29360 |
r && (o = o.filter(function(r) { |
| 29361 |
return Object.getOwnPropertyDescriptor(e, r).enumerable; |
| 29362 |
})), t.push.apply(t, o); |
| 29363 |
} |
| 29364 |
return t; |
| 29365 |
} |
| 29366 |
__name(ownKeys$1, "ownKeys"); |
| 29367 |
function _objectSpread$1(e) { |
| 29368 |
for (var r = 1; r < arguments.length; r++) { |
| 29369 |
var t = null != arguments[r] ? arguments[r] : {}; |
| 29370 |
r % 2 ? ownKeys$1(Object(t), !0).forEach(function(r) { |
| 29371 |
_defineProperty$1(e, r, t[r]); |
| 29372 |
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function(r) { |
| 29373 |
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); |
| 29374 |
}); |
| 29375 |
} |
| 29376 |
return e; |
| 29377 |
} |
| 29378 |
__name(_objectSpread$1, "_objectSpread"); |
| 29379 |
var SCREENSHOT_HEIGHT = "138px"; |
| 29380 |
var Screenshot = function Screenshot(_ref) { |
| 29381 |
var url = _ref.url; |
| 29382 |
var type = _ref.type; |
| 29383 |
var _ref$isLoading = _ref.isLoading; |
| 29384 |
var isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading; |
| 29385 |
var _ref$isSelected = _ref.isSelected; |
| 29386 |
var isSelected = _ref$isSelected === void 0 ? false : _ref$isSelected; |
| 29387 |
var isPlaceholder = _ref.isPlaceholder; |
| 29388 |
var disabled = _ref.disabled; |
| 29389 |
var onClick = _ref.onClick; |
| 29390 |
var _ref$sx = _ref.sx; |
| 29391 |
var sx = _ref$sx === void 0 ? {} : _ref$sx; |
| 29392 |
var outlineOffset = _ref.outlineOffset; |
| 29393 |
if (isPlaceholder) return /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, { sx: _objectSpread$1({ height: SCREENSHOT_HEIGHT }, sx) }); |
| 29394 |
if (isLoading) return /*#__PURE__*/ react.default.createElement(_elementor_ui.Skeleton, { |
| 29395 |
width: "100%", |
| 29396 |
animation: "wave", |
| 29397 |
variant: "rounded", |
| 29398 |
height: SCREENSHOT_HEIGHT, |
| 29399 |
sx |
| 29400 |
}); |
| 29401 |
if (!url) return /*#__PURE__*/ react.default.createElement(ScreenshotUnavailable, { |
| 29402 |
selected: isSelected, |
| 29403 |
disabled, |
| 29404 |
sx, |
| 29405 |
onClick, |
| 29406 |
height: SCREENSHOT_HEIGHT, |
| 29407 |
outlineOffset |
| 29408 |
}); |
| 29409 |
return /*#__PURE__*/ react.default.createElement(ScreenshotContainer, { |
| 29410 |
selected: isSelected, |
| 29411 |
disabled, |
| 29412 |
sx: _objectSpread$1({ backgroundImage: "url('".concat(url, "')") }, sx), |
| 29413 |
onClick, |
| 29414 |
height: SCREENSHOT_HEIGHT, |
| 29415 |
outlineOffset |
| 29416 |
}, /*#__PURE__*/ react.default.createElement(TemplateBadge, { type })); |
| 29417 |
}; |
| 29418 |
Screenshot.propTypes = { |
| 29419 |
isSelected: import_prop_types$8.default.bool, |
| 29420 |
isLoading: import_prop_types$8.default.bool, |
| 29421 |
isPlaceholder: import_prop_types$8.default.bool, |
| 29422 |
disabled: import_prop_types$8.default.bool, |
| 29423 |
onClick: import_prop_types$8.default.func.isRequired, |
| 29424 |
url: import_prop_types$8.default.string, |
| 29425 |
type: import_prop_types$8.default.string, |
| 29426 |
sx: import_prop_types$8.default.object, |
| 29427 |
outlineOffset: import_prop_types$8.default.string |
| 29428 |
}; |
| 29429 |
|
| 29430 |
//#endregion |
| 29431 |
//#region modules/ai/assets/js/editor/pages/form-layout/hooks/use-layout-prompt.js |
| 29432 |
init_api(); |
| 29433 |
init_use_prompt(); |
| 29434 |
var useLayoutPrompt = function useLayoutPrompt(type, initialValue) { |
| 29435 |
return usePrompt(function(requestBody, signal) { |
| 29436 |
requestBody.variationType = type; |
| 29437 |
return generateLayout(requestBody, signal); |
| 29438 |
}, initialValue); |
| 29439 |
}; |
| 29440 |
|
| 29441 |
//#endregion |
| 29442 |
//#region modules/ai/assets/js/editor/pages/form-layout/hooks/use-screenshot.js |
| 29443 |
init_asyncToGenerator(); |
| 29444 |
init_slicedToArray(); |
| 29445 |
var ERROR_INITIAL_VALUE = ""; |
| 29446 |
var useScreenshot = function useScreenshot(type, onData) { |
| 29447 |
var _useState2 = _slicedToArray((0, react.useState)(ERROR_INITIAL_VALUE), 2); |
| 29448 |
var error = _useState2[0]; |
| 29449 |
var setError = _useState2[1]; |
| 29450 |
var _useState4 = _slicedToArray((0, react.useState)(false), 2); |
| 29451 |
var isLoading = _useState4[0]; |
| 29452 |
var setIsLoading = _useState4[1]; |
| 29453 |
var layoutData = useLayoutPrompt(type, null); |
| 29454 |
return { |
| 29455 |
generate: function generate(requestBody, signal) { |
| 29456 |
setIsLoading(true); |
| 29457 |
setError(ERROR_INITIAL_VALUE); |
| 29458 |
return layoutData.send(requestBody, signal).then(/*#__PURE__*/ function() { |
| 29459 |
var _ref = _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee(data) { |
| 29460 |
var createdScreenshot; |
| 29461 |
return import_regenerator$2.default.wrap(function(_context) { |
| 29462 |
while (1) switch (_context.prev = _context.next) { |
| 29463 |
case 0: |
| 29464 |
_context.next = 1; |
| 29465 |
return onData(data.result); |
| 29466 |
case 1: |
| 29467 |
createdScreenshot = _context.sent; |
| 29468 |
createdScreenshot.sendUsageData = function() { |
| 29469 |
return layoutData.sendUsageData(data); |
| 29470 |
}; |
| 29471 |
createdScreenshot.baseTemplateId = data.baseTemplateId; |
| 29472 |
createdScreenshot.type = data.type; |
| 29473 |
return _context.abrupt("return", createdScreenshot); |
| 29474 |
case 2: |
| 29475 |
case "end": return _context.stop(); |
| 29476 |
} |
| 29477 |
}, _callee); |
| 29478 |
})); |
| 29479 |
return function(_x) { |
| 29480 |
return _ref.apply(this, arguments); |
| 29481 |
}; |
| 29482 |
}()).catch(function(err) { |
| 29483 |
setError(err.extra_data ? err : err.message || err); |
| 29484 |
throw err; |
| 29485 |
}).finally(function() { |
| 29486 |
return setIsLoading(false); |
| 29487 |
}); |
| 29488 |
}, |
| 29489 |
error, |
| 29490 |
isLoading |
| 29491 |
}; |
| 29492 |
}; |
| 29493 |
|
| 29494 |
//#endregion |
| 29495 |
//#region modules/ai/assets/js/editor/pages/form-layout/hooks/use-screenshots.js |
| 29496 |
init_asyncToGenerator(); |
| 29497 |
init_slicedToArray(); |
| 29498 |
init_requests_ids(); |
| 29499 |
var PENDING_VALUE = { isPending: true }; |
| 29500 |
var useScreenshots = function useScreenshots(_ref) { |
| 29501 |
var onData = _ref.onData; |
| 29502 |
var _useState2 = _slicedToArray((0, react.useState)([]), 2); |
| 29503 |
var screenshots = _useState2[0]; |
| 29504 |
var setScreenshots = _useState2[1]; |
| 29505 |
/** |
| 29506 |
* The ids for each request are: |
| 29507 |
* - editorSessionId: a unique id for each editor opening |
| 29508 |
* - sessionId: a unique id for each session. (open the AI builder) |
| 29509 |
* - generateId: a unique id for each generate request. (prompt change) |
| 29510 |
* - batchId: a unique id for each batch of generate requests. (generate, regenerate) |
| 29511 |
* - requestId: a unique id for each generate request. |
| 29512 |
*/ |
| 29513 |
var currentContext = useConfig().currentContext; |
| 29514 |
var _useRequestIds = useRequestIds(); |
| 29515 |
var editorSessionId = _useRequestIds.editorSessionId; |
| 29516 |
var sessionId = _useRequestIds.sessionId; |
| 29517 |
var setRequest = _useRequestIds.setRequest; |
| 29518 |
var setBatch = _useRequestIds.setBatch; |
| 29519 |
var setGenerate = _useRequestIds.setGenerate; |
| 29520 |
var generateIdRef = (0, react.useRef)(""); |
| 29521 |
var batchId = setBatch(); |
| 29522 |
var screenshotsData = [ |
| 29523 |
useScreenshot(0, onData), |
| 29524 |
useScreenshot(1, onData), |
| 29525 |
useScreenshot(2, onData) |
| 29526 |
]; |
| 29527 |
var screenshotsGroupCount = screenshotsData.length; |
| 29528 |
var error = screenshotsData.every(function(s) { |
| 29529 |
return s === null || s === void 0 ? void 0 : s.error; |
| 29530 |
}) ? screenshotsData[0].error : ""; |
| 29531 |
var isLoading = screenshotsData.some(function(s) { |
| 29532 |
return s === null || s === void 0 ? void 0 : s.isLoading; |
| 29533 |
}); |
| 29534 |
var abortController = (0, react.useRef)(null); |
| 29535 |
var abort = function abort() { |
| 29536 |
var _abortController$curr; |
| 29537 |
return (_abortController$curr = abortController.current) === null || _abortController$curr === void 0 ? void 0 : _abortController$curr.abort(); |
| 29538 |
}; |
| 29539 |
var createScreenshots = /*#__PURE__*/ function() { |
| 29540 |
var _ref2 = _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee(prompt, attachments) { |
| 29541 |
var onGenerate; |
| 29542 |
var onError; |
| 29543 |
var promises; |
| 29544 |
var results; |
| 29545 |
var isAllFailed; |
| 29546 |
return import_regenerator$2.default.wrap(function(_context) { |
| 29547 |
while (1) switch (_context.prev = _context.next) { |
| 29548 |
case 0: |
| 29549 |
abortController.current = new AbortController(); |
| 29550 |
onGenerate = function onGenerate(screenshot) { |
| 29551 |
setScreenshots(function(prev) { |
| 29552 |
var updatedData = _toConsumableArray(prev); |
| 29553 |
var pendingIndex = updatedData.indexOf(PENDING_VALUE); |
| 29554 |
updatedData[pendingIndex] = screenshot; |
| 29555 |
return updatedData; |
| 29556 |
}); |
| 29557 |
return true; |
| 29558 |
}; |
| 29559 |
onError = function onError() { |
| 29560 |
setScreenshots(function(prev) { |
| 29561 |
var updatedData = _toConsumableArray(prev); |
| 29562 |
var pendingIndex = updatedData.lastIndexOf(PENDING_VALUE); |
| 29563 |
updatedData[pendingIndex] = { isError: true }; |
| 29564 |
return updatedData; |
| 29565 |
}); |
| 29566 |
return false; |
| 29567 |
}; |
| 29568 |
promises = screenshotsData.map(function(_ref3) { |
| 29569 |
var generate = _ref3.generate; |
| 29570 |
return generate({ |
| 29571 |
prompt, |
| 29572 |
prevGeneratedIds: screenshots.map(function(screenshot) { |
| 29573 |
return screenshot.baseTemplateId || ""; |
| 29574 |
}), |
| 29575 |
currentContext, |
| 29576 |
ids: { |
| 29577 |
editorSessionId: editorSessionId.current, |
| 29578 |
sessionId: sessionId.current, |
| 29579 |
generateId: generateIdRef.current, |
| 29580 |
batchId: batchId.current, |
| 29581 |
requestId: setRequest().current |
| 29582 |
}, |
| 29583 |
attachments: attachments.map(function(_ref4) { |
| 29584 |
return { |
| 29585 |
type: _ref4.type, |
| 29586 |
content: _ref4.content, |
| 29587 |
label: _ref4.label, |
| 29588 |
source: _ref4.source |
| 29589 |
}; |
| 29590 |
}) |
| 29591 |
}, abortController.current.signal).then(onGenerate).catch(onError); |
| 29592 |
}); |
| 29593 |
_context.next = 1; |
| 29594 |
return Promise.all(promises); |
| 29595 |
case 1: |
| 29596 |
results = _context.sent; |
| 29597 |
isAllFailed = results.every(function(value) { |
| 29598 |
return false === value; |
| 29599 |
}); |
| 29600 |
if (isAllFailed) setScreenshots(function(prev) { |
| 29601 |
var updatedData = _toConsumableArray(prev); |
| 29602 |
updatedData.splice(screenshotsGroupCount * -1); |
| 29603 |
return updatedData; |
| 29604 |
}); |
| 29605 |
case 2: |
| 29606 |
case "end": return _context.stop(); |
| 29607 |
} |
| 29608 |
}, _callee); |
| 29609 |
})); |
| 29610 |
return function createScreenshots(_x, _x2) { |
| 29611 |
return _ref2.apply(this, arguments); |
| 29612 |
}; |
| 29613 |
}(); |
| 29614 |
return { |
| 29615 |
generate: function generate(prompt, attachments) { |
| 29616 |
var placeholders = Array(screenshotsGroupCount).fill(PENDING_VALUE); |
| 29617 |
generateIdRef.current = setGenerate().current; |
| 29618 |
setScreenshots(placeholders); |
| 29619 |
createScreenshots(prompt, attachments); |
| 29620 |
}, |
| 29621 |
regenerate: function regenerate(prompt, attachments) { |
| 29622 |
var placeholders = Array(screenshotsGroupCount).fill(PENDING_VALUE); |
| 29623 |
setScreenshots(function(prev) { |
| 29624 |
return [].concat(_toConsumableArray(prev), _toConsumableArray(placeholders)); |
| 29625 |
}); |
| 29626 |
createScreenshots(prompt, attachments); |
| 29627 |
}, |
| 29628 |
screenshots, |
| 29629 |
isLoading, |
| 29630 |
error, |
| 29631 |
abort |
| 29632 |
}; |
| 29633 |
}; |
| 29634 |
|
| 29635 |
//#endregion |
| 29636 |
//#region modules/ai/assets/js/editor/pages/form-layout/hooks/use-slider.js |
| 29637 |
init_slicedToArray(); |
| 29638 |
var SCREENSHOTS_PER_PAGE = 3; |
| 29639 |
var useSlider = function useSlider() { |
| 29640 |
var _ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; |
| 29641 |
var _ref$slidesCount = _ref.slidesCount; |
| 29642 |
var slidesCount = _ref$slidesCount === void 0 ? 0 : _ref$slidesCount; |
| 29643 |
var _ref$slidesPerPage = _ref.slidesPerPage; |
| 29644 |
var slidesPerPage = _ref$slidesPerPage === void 0 ? 3 : _ref$slidesPerPage; |
| 29645 |
var _ref$gapPercentage = _ref.gapPercentage; |
| 29646 |
var gapPercentage = _ref$gapPercentage === void 0 ? 2 : _ref$gapPercentage; |
| 29647 |
var _useState2 = _slicedToArray((0, react.useState)(1), 2); |
| 29648 |
var currentPage = _useState2[0]; |
| 29649 |
var setCurrentPage = _useState2[1]; |
| 29650 |
var slideWidthPercentage = (100 - gapPercentage * (slidesPerPage - 1)) / slidesPerPage; |
| 29651 |
var offsetXPercentage = (slideWidthPercentage + gapPercentage) * slidesPerPage * (currentPage - 1) * -1; |
| 29652 |
var pagesCount = Math.ceil(slidesCount / slidesPerPage); |
| 29653 |
(0, react.useEffect)(function() { |
| 29654 |
if (currentPage > 1 && currentPage > pagesCount) setCurrentPage(pagesCount); |
| 29655 |
}, [pagesCount]); |
| 29656 |
return { |
| 29657 |
currentPage, |
| 29658 |
setCurrentPage, |
| 29659 |
pagesCount, |
| 29660 |
slidesPerPage, |
| 29661 |
gapPercentage, |
| 29662 |
offsetXPercentage, |
| 29663 |
slideWidthPercentage |
| 29664 |
}; |
| 29665 |
}; |
| 29666 |
|
| 29667 |
//#endregion |
| 29668 |
//#region modules/ai/assets/js/editor/icons/minimize-diagonal-icon.js |
| 29669 |
init_extends(); |
| 29670 |
var MinimizeDiagonalIcon = react.default.forwardRef(function(props, ref) { |
| 29671 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.SvgIcon, _extends$1({ viewBox: "0 0 24 24" }, props, { ref }), /*#__PURE__*/ react.default.createElement("path", { |
| 29672 |
fillRule: "evenodd", |
| 29673 |
clipRule: "evenodd", |
| 29674 |
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" |
| 29675 |
})); |
| 29676 |
}); |
| 29677 |
|
| 29678 |
//#endregion |
| 29679 |
//#region modules/ai/assets/js/editor/icons/expand-diagonal-icon.js |
| 29680 |
init_extends(); |
| 29681 |
var ExpandDiagonalIcon = react.default.forwardRef(function(props, ref) { |
| 29682 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.SvgIcon, _extends$1({ viewBox: "0 0 24 24" }, props, { ref }), /*#__PURE__*/ react.default.createElement("path", { |
| 29683 |
fillRule: "evenodd", |
| 29684 |
clipRule: "evenodd", |
| 29685 |
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" |
| 29686 |
})); |
| 29687 |
}); |
| 29688 |
|
| 29689 |
//#endregion |
| 29690 |
//#region modules/ai/assets/js/editor/pages/form-layout/components/attachments/prompt-power-notice.js |
| 29691 |
init_use_introduction(); |
| 29692 |
var PromptPowerNotice = function PromptPowerNotice() { |
| 29693 |
var _useIntroduction = useIntroduction("e-ai-builder-attachments-power"); |
| 29694 |
var isViewed = _useIntroduction.isViewed; |
| 29695 |
var markAsViewed = _useIntroduction.markAsViewed; |
| 29696 |
if (isViewed) return null; |
| 29697 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, { sx: { |
| 29698 |
pt: 2, |
| 29699 |
px: 2, |
| 29700 |
pb: 0 |
| 29701 |
} }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Alert, { |
| 29702 |
severity: "info", |
| 29703 |
onClose: function onClose() { |
| 29704 |
return markAsViewed(); |
| 29705 |
} |
| 29706 |
}, /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, { |
| 29707 |
variant: "body2", |
| 29708 |
display: "inline-block", |
| 29709 |
sx: { paddingInlineEnd: 1 } |
| 29710 |
}, (0, _wordpress_i18n.__)("You’ve got the power.", "elementor")), /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, { |
| 29711 |
variant: "body2", |
| 29712 |
display: "inline-block" |
| 29713 |
}, (0, _wordpress_i18n.__)("Craft your prompt to affect content, images and/or colors - whichever you decide.", "elementor")))); |
| 29714 |
}; |
| 29715 |
|
| 29716 |
//#endregion |
| 29717 |
//#region node_modules/validator/lib/util/assertString.js |
| 29718 |
var require_assertString = /* @__PURE__ */ __commonJSMin(((exports, module) => { |
| 29719 |
Object.defineProperty(exports, "__esModule", { value: true }); |
| 29720 |
exports.default = assertString; |
| 29721 |
function assertString(input) { |
| 29722 |
if (input === void 0 || input === null) throw new TypeError("Expected a string but received a ".concat(input)); |
| 29723 |
if (input.constructor.name !== "String") throw new TypeError("Expected a string but received a ".concat(input.constructor.name)); |
| 29724 |
} |
| 29725 |
module.exports = exports.default; |
| 29726 |
module.exports.default = exports.default; |
| 29727 |
})); |
| 29728 |
|
| 29729 |
//#endregion |
| 29730 |
//#region node_modules/validator/lib/util/checkHost.js |
| 29731 |
var require_checkHost = /* @__PURE__ */ __commonJSMin(((exports, module) => { |
| 29732 |
Object.defineProperty(exports, "__esModule", { value: true }); |
| 29733 |
exports.default = checkHost; |
| 29734 |
function isRegExp(obj) { |
| 29735 |
return Object.prototype.toString.call(obj) === "[object RegExp]"; |
| 29736 |
} |
| 29737 |
function checkHost(host, matches) { |
| 29738 |
for (var i = 0; i < matches.length; i++) { |
| 29739 |
var match = matches[i]; |
| 29740 |
if (host === match || isRegExp(match) && match.test(host)) return true; |
| 29741 |
} |
| 29742 |
return false; |
| 29743 |
} |
| 29744 |
module.exports = exports.default; |
| 29745 |
module.exports.default = exports.default; |
| 29746 |
})); |
| 29747 |
|
| 29748 |
//#endregion |
| 29749 |
//#region node_modules/validator/lib/util/includesString.js |
| 29750 |
var require_includesString = /* @__PURE__ */ __commonJSMin(((exports, module) => { |
| 29751 |
Object.defineProperty(exports, "__esModule", { value: true }); |
| 29752 |
exports.default = void 0; |
| 29753 |
var includes = function includes(str, val) { |
| 29754 |
return str.indexOf(val) !== -1; |
| 29755 |
}; |
| 29756 |
exports.default = includes; |
| 29757 |
module.exports = exports.default; |
| 29758 |
module.exports.default = exports.default; |
| 29759 |
})); |
| 29760 |
|
| 29761 |
//#endregion |
| 29762 |
//#region node_modules/validator/lib/util/merge.js |
| 29763 |
var require_merge = /* @__PURE__ */ __commonJSMin(((exports, module) => { |
| 29764 |
Object.defineProperty(exports, "__esModule", { value: true }); |
| 29765 |
exports.default = merge; |
| 29766 |
function merge() { |
| 29767 |
var obj = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; |
| 29768 |
var defaults = arguments.length > 1 ? arguments[1] : void 0; |
| 29769 |
for (var key in defaults) if (typeof obj[key] === "undefined") obj[key] = defaults[key]; |
| 29770 |
return obj; |
| 29771 |
} |
| 29772 |
module.exports = exports.default; |
| 29773 |
module.exports.default = exports.default; |
| 29774 |
})); |
| 29775 |
|
| 29776 |
//#endregion |
| 29777 |
//#region node_modules/validator/lib/isFQDN.js |
| 29778 |
var require_isFQDN = /* @__PURE__ */ __commonJSMin(((exports, module) => { |
| 29779 |
Object.defineProperty(exports, "__esModule", { value: true }); |
| 29780 |
exports.default = isFQDN; |
| 29781 |
var _assertString = _interopRequireDefault(require_assertString()); |
| 29782 |
var _merge = _interopRequireDefault(require_merge()); |
| 29783 |
function _interopRequireDefault(e) { |
| 29784 |
return e && e.__esModule ? e : { default: e }; |
| 29785 |
} |
| 29786 |
var default_fqdn_options = { |
| 29787 |
require_tld: true, |
| 29788 |
allow_underscores: false, |
| 29789 |
allow_trailing_dot: false, |
| 29790 |
allow_numeric_tld: false, |
| 29791 |
allow_wildcard: false, |
| 29792 |
ignore_max_length: false |
| 29793 |
}; |
| 29794 |
function isFQDN(str, options) { |
| 29795 |
(0, _assertString.default)(str); |
| 29796 |
options = (0, _merge.default)(options, default_fqdn_options); |
| 29797 |
if (options.allow_trailing_dot && str[str.length - 1] === ".") str = str.substring(0, str.length - 1); |
| 29798 |
if (options.allow_wildcard === true && str.indexOf("*.") === 0) str = str.substring(2); |
| 29799 |
var parts = str.split("."); |
| 29800 |
var tld = parts[parts.length - 1]; |
| 29801 |
if (options.require_tld) { |
| 29802 |
if (parts.length < 2) return false; |
| 29803 |
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; |
| 29804 |
if (/\s/.test(tld)) return false; |
| 29805 |
} |
| 29806 |
if (!options.allow_numeric_tld && /^\d+$/.test(tld)) return false; |
| 29807 |
return parts.every(function(part) { |
| 29808 |
if (part.length > 63 && !options.ignore_max_length) return false; |
| 29809 |
if (!/^[a-z_\u00a1-\uffff0-9-]+$/i.test(part)) return false; |
| 29810 |
if (/[\uff01-\uff5e]/.test(part)) return false; |
| 29811 |
if (/^-|-$/.test(part)) return false; |
| 29812 |
if (!options.allow_underscores && /_/.test(part)) return false; |
| 29813 |
return true; |
| 29814 |
}); |
| 29815 |
} |
| 29816 |
module.exports = exports.default; |
| 29817 |
module.exports.default = exports.default; |
| 29818 |
})); |
| 29819 |
|
| 29820 |
//#endregion |
| 29821 |
//#region node_modules/validator/lib/isIP.js |
| 29822 |
var require_isIP = /* @__PURE__ */ __commonJSMin(((exports, module) => { |
| 29823 |
Object.defineProperty(exports, "__esModule", { value: true }); |
| 29824 |
exports.default = isIP; |
| 29825 |
var _assertString = _interopRequireDefault(require_assertString()); |
| 29826 |
function _interopRequireDefault(e) { |
| 29827 |
return e && e.__esModule ? e : { default: e }; |
| 29828 |
} |
| 29829 |
function _typeof(o) { |
| 29830 |
"@babel/helpers - typeof"; |
| 29831 |
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) { |
| 29832 |
return typeof o; |
| 29833 |
} : function(o) { |
| 29834 |
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; |
| 29835 |
}, _typeof(o); |
| 29836 |
} |
| 29837 |
/** |
| 29838 |
11.3. Examples |
| 29839 |
|
| 29840 |
The following addresses |
| 29841 |
|
| 29842 |
fe80::1234 (on the 1st link of the node) |
| 29843 |
ff02::5678 (on the 5th link of the node) |
| 29844 |
ff08::9abc (on the 10th organization of the node) |
| 29845 |
|
| 29846 |
would be represented as follows: |
| 29847 |
|
| 29848 |
fe80::1234%1 |
| 29849 |
ff02::5678%5 |
| 29850 |
ff08::9abc%10 |
| 29851 |
|
| 29852 |
(Here we assume a natural translation from a zone index to the |
| 29853 |
<zone_id> part, where the Nth zone of any scope is translated into |
| 29854 |
"N".) |
| 29855 |
|
| 29856 |
If we use interface names as <zone_id>, those addresses could also be |
| 29857 |
represented as follows: |
| 29858 |
|
| 29859 |
fe80::1234%ne0 |
| 29860 |
ff02::5678%pvc1.3 |
| 29861 |
ff08::9abc%interface10 |
| 29862 |
|
| 29863 |
where the interface "ne0" belongs to the 1st link, "pvc1.3" belongs |
| 29864 |
to the 5th link, and "interface10" belongs to the 10th organization. |
| 29865 |
* * */ |
| 29866 |
var IPv4SegmentFormat = "(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])"; |
| 29867 |
var IPv4AddressFormat = "(".concat(IPv4SegmentFormat, "[.]){3}").concat(IPv4SegmentFormat); |
| 29868 |
var IPv4AddressRegExp = new RegExp("^".concat(IPv4AddressFormat, "$")); |
| 29869 |
var IPv6SegmentFormat = "(?:[0-9a-fA-F]{1,4})"; |
| 29870 |
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,})?$"); |
| 29871 |
function isIP(ipAddress) { |
| 29872 |
var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; |
| 29873 |
(0, _assertString.default)(ipAddress); |
| 29874 |
var version = (_typeof(options) === "object" ? options.version : arguments[1]) || ""; |
| 29875 |
if (!version) return isIP(ipAddress, { version: 4 }) || isIP(ipAddress, { version: 6 }); |
| 29876 |
if (version.toString() === "4") return IPv4AddressRegExp.test(ipAddress); |
| 29877 |
if (version.toString() === "6") return IPv6AddressRegExp.test(ipAddress); |
| 29878 |
return false; |
| 29879 |
} |
| 29880 |
module.exports = exports.default; |
| 29881 |
module.exports.default = exports.default; |
| 29882 |
})); |
| 29883 |
|
| 29884 |
//#endregion |
| 29885 |
//#region node_modules/validator/lib/isURL.js |
| 29886 |
var require_isURL = /* @__PURE__ */ __commonJSMin(((exports, module) => { |
| 29887 |
Object.defineProperty(exports, "__esModule", { value: true }); |
| 29888 |
exports.default = isURL; |
| 29889 |
var _assertString = _interopRequireDefault(require_assertString()); |
| 29890 |
var _checkHost = _interopRequireDefault(require_checkHost()); |
| 29891 |
var _includesString = _interopRequireDefault(require_includesString()); |
| 29892 |
var _isFQDN = _interopRequireDefault(require_isFQDN()); |
| 29893 |
var _isIP = _interopRequireDefault(require_isIP()); |
| 29894 |
var _merge = _interopRequireDefault(require_merge()); |
| 29895 |
function _interopRequireDefault(e) { |
| 29896 |
return e && e.__esModule ? e : { default: e }; |
| 29897 |
} |
| 29898 |
function _slicedToArray(r, e) { |
| 29899 |
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); |
| 29900 |
} |
| 29901 |
function _nonIterableRest() { |
| 29902 |
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); |
| 29903 |
} |
| 29904 |
function _unsupportedIterableToArray(r, a) { |
| 29905 |
if (r) { |
| 29906 |
if ("string" == typeof r) return _arrayLikeToArray(r, a); |
| 29907 |
var t = {}.toString.call(r).slice(8, -1); |
| 29908 |
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; |
| 29909 |
} |
| 29910 |
} |
| 29911 |
function _arrayLikeToArray(r, a) { |
| 29912 |
(null == a || a > r.length) && (a = r.length); |
| 29913 |
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; |
| 29914 |
return n; |
| 29915 |
} |
| 29916 |
function _iterableToArrayLimit(r, l) { |
| 29917 |
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; |
| 29918 |
if (null != t) { |
| 29919 |
var e; |
| 29920 |
var n; |
| 29921 |
var i; |
| 29922 |
var u; |
| 29923 |
var a = []; |
| 29924 |
var f = !0; |
| 29925 |
var o = !1; |
| 29926 |
try { |
| 29927 |
if (i = (t = t.call(r)).next, 0 === l) { |
| 29928 |
if (Object(t) !== t) return; |
| 29929 |
f = !1; |
| 29930 |
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); |
| 29931 |
} catch (r) { |
| 29932 |
o = !0, n = r; |
| 29933 |
} finally { |
| 29934 |
try { |
| 29935 |
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; |
| 29936 |
} finally { |
| 29937 |
if (o) throw n; |
| 29938 |
} |
| 29939 |
} |
| 29940 |
return a; |
| 29941 |
} |
| 29942 |
} |
| 29943 |
function _arrayWithHoles(r) { |
| 29944 |
if (Array.isArray(r)) return r; |
| 29945 |
} |
| 29946 |
var default_url_options = { |
| 29947 |
protocols: [ |
| 29948 |
"http", |
| 29949 |
"https", |
| 29950 |
"ftp" |
| 29951 |
], |
| 29952 |
require_tld: true, |
| 29953 |
require_protocol: false, |
| 29954 |
require_host: true, |
| 29955 |
require_port: false, |
| 29956 |
require_valid_protocol: true, |
| 29957 |
allow_underscores: false, |
| 29958 |
allow_trailing_dot: false, |
| 29959 |
allow_protocol_relative_urls: false, |
| 29960 |
allow_fragments: true, |
| 29961 |
allow_query_components: true, |
| 29962 |
validate_length: true, |
| 29963 |
max_allowed_length: 2084 |
| 29964 |
}; |
| 29965 |
var wrapped_ipv6 = /^\[([^\]]+)\](?::([0-9]+))?$/; |
| 29966 |
function isURL(url, options) { |
| 29967 |
(0, _assertString.default)(url); |
| 29968 |
if (!url || /[\s<>]/.test(url)) return false; |
| 29969 |
if (url.indexOf("mailto:") === 0) return false; |
| 29970 |
options = (0, _merge.default)(options, default_url_options); |
| 29971 |
if (options.validate_length && url.length > options.max_allowed_length) return false; |
| 29972 |
if (!options.allow_fragments && (0, _includesString.default)(url, "#")) return false; |
| 29973 |
if (!options.allow_query_components && ((0, _includesString.default)(url, "?") || (0, _includesString.default)(url, "&"))) return false; |
| 29974 |
var protocol; |
| 29975 |
var auth; |
| 29976 |
var host; |
| 29977 |
var hostname; |
| 29978 |
var port; |
| 29979 |
var port_str; |
| 29980 |
var split = url.split("#"); |
| 29981 |
var ipv6; |
| 29982 |
url = split.shift(); |
| 29983 |
split = url.split("?"); |
| 29984 |
url = split.shift(); |
| 29985 |
var protocol_match = url.match(/^([a-z][a-z0-9+\-.]*):/i); |
| 29986 |
var had_explicit_protocol = false; |
| 29987 |
var cleanUpProtocol = function cleanUpProtocol(potential_protocol) { |
| 29988 |
had_explicit_protocol = true; |
| 29989 |
protocol = potential_protocol.toLowerCase(); |
| 29990 |
if (options.require_valid_protocol && options.protocols.indexOf(protocol) === -1) return false; |
| 29991 |
return url.substring(protocol_match[0].length); |
| 29992 |
}; |
| 29993 |
if (protocol_match) { |
| 29994 |
var potential_protocol = protocol_match[1]; |
| 29995 |
var after_colon = url.substring(protocol_match[0].length); |
| 29996 |
if (!(after_colon.slice(0, 2) === "//")) { |
| 29997 |
var first_slash_position = after_colon.indexOf("/"); |
| 29998 |
var before_slash = first_slash_position === -1 ? after_colon : after_colon.substring(0, first_slash_position); |
| 29999 |
var at_position = before_slash.indexOf("@"); |
| 30000 |
if (at_position !== -1) { |
| 30001 |
var before_at = before_slash.substring(0, at_position); |
| 30002 |
if (/^[a-zA-Z0-9\-_.%:]*$/.test(before_at)) { |
| 30003 |
if (options.require_protocol) return false; |
| 30004 |
} else { |
| 30005 |
url = cleanUpProtocol(potential_protocol); |
| 30006 |
if (url === false) return false; |
| 30007 |
} |
| 30008 |
} else if (/^[0-9]/.test(after_colon)) { |
| 30009 |
if (options.require_protocol) return false; |
| 30010 |
} else { |
| 30011 |
url = cleanUpProtocol(potential_protocol); |
| 30012 |
if (url === false) return false; |
| 30013 |
} |
| 30014 |
} else { |
| 30015 |
url = cleanUpProtocol(potential_protocol); |
| 30016 |
if (url === false) return false; |
| 30017 |
} |
| 30018 |
} else if (options.require_protocol) return false; |
| 30019 |
if (url.slice(0, 2) === "//") { |
| 30020 |
if (!had_explicit_protocol && !options.allow_protocol_relative_urls) return false; |
| 30021 |
url = url.slice(2); |
| 30022 |
} |
| 30023 |
if (url === "") return false; |
| 30024 |
split = url.split("/"); |
| 30025 |
url = split.shift(); |
| 30026 |
if (url === "" && !options.require_host) return true; |
| 30027 |
split = url.split("@"); |
| 30028 |
if (split.length > 1) { |
| 30029 |
if (options.disallow_auth) return false; |
| 30030 |
if (split[0] === "") return false; |
| 30031 |
auth = split.shift(); |
| 30032 |
if (auth.indexOf(":") >= 0 && auth.split(":").length > 2) return false; |
| 30033 |
var _auth$split2 = _slicedToArray(auth.split(":"), 2); |
| 30034 |
var user = _auth$split2[0]; |
| 30035 |
var password = _auth$split2[1]; |
| 30036 |
if (user === "" && password === "") return false; |
| 30037 |
} |
| 30038 |
hostname = split.join("@"); |
| 30039 |
port_str = null; |
| 30040 |
ipv6 = null; |
| 30041 |
var ipv6_match = hostname.match(wrapped_ipv6); |
| 30042 |
if (ipv6_match) { |
| 30043 |
host = ""; |
| 30044 |
ipv6 = ipv6_match[1]; |
| 30045 |
port_str = ipv6_match[2] || null; |
| 30046 |
} else { |
| 30047 |
split = hostname.split(":"); |
| 30048 |
host = split.shift(); |
| 30049 |
if (split.length) port_str = split.join(":"); |
| 30050 |
} |
| 30051 |
if (port_str !== null && port_str.length > 0) { |
| 30052 |
port = parseInt(port_str, 10); |
| 30053 |
if (!/^[0-9]+$/.test(port_str) || port <= 0 || port > 65535) return false; |
| 30054 |
} else if (options.require_port) return false; |
| 30055 |
if (options.host_whitelist) return (0, _checkHost.default)(host, options.host_whitelist); |
| 30056 |
if (host === "" && !options.require_host) return true; |
| 30057 |
if (!(0, _isIP.default)(host) && !(0, _isFQDN.default)(host, options) && (!ipv6 || !(0, _isIP.default)(ipv6, 6))) return false; |
| 30058 |
host = host || ipv6; |
| 30059 |
if (options.host_blacklist && (0, _checkHost.default)(host, options.host_blacklist)) return false; |
| 30060 |
return true; |
| 30061 |
} |
| 30062 |
module.exports = exports.default; |
| 30063 |
module.exports.default = exports.default; |
| 30064 |
})); |
| 30065 |
|
| 30066 |
//#endregion |
| 30067 |
//#region modules/ai/assets/js/editor/pages/form-layout/index.js |
| 30068 |
init_objectWithoutProperties$1(); |
| 30069 |
init_slicedToArray(); |
| 30070 |
init_extends(); |
| 30071 |
init_prompt_error_message(); |
| 30072 |
var import_isURL = /* @__PURE__ */ __toESM(require_isURL()); |
| 30073 |
init_voice_promotion_alert(); |
| 30074 |
var _excluded$1 = ["children"]; |
| 30075 |
var DirectionalMinimizeDiagonalIcon = (0, _elementor_ui.withDirection)(MinimizeDiagonalIcon); |
| 30076 |
var DirectionalExpandDiagonalIcon = (0, _elementor_ui.withDirection)(ExpandDiagonalIcon); |
| 30077 |
/** |
| 30078 |
* @typedef {Object} Attachment |
| 30079 |
* @property {('json')} type - The type of the attachment, currently only `json` is supported. |
| 30080 |
* @property {string} previewHTML - HTML content as a string, representing a preview. |
| 30081 |
* @property {string} content - Actual content of the attachment as a string. |
| 30082 |
* @property {string} label - Label for the attachment. |
| 30083 |
*/ |
| 30084 |
var RegenerateButton = function RegenerateButton(props) { |
| 30085 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Button, _extends$1({ |
| 30086 |
size: "small", |
| 30087 |
color: "secondary", |
| 30088 |
startIcon: /*#__PURE__*/ react.default.createElement(RefreshIcon, null) |
| 30089 |
}, props), (0, _wordpress_i18n.__)("Regenerate", "elementor")); |
| 30090 |
}; |
| 30091 |
var UseLayoutButton = function UseLayoutButton(props) { |
| 30092 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Button, _extends$1({ |
| 30093 |
size: "small", |
| 30094 |
variant: "contained" |
| 30095 |
}, props), (0, _wordpress_i18n.__)("Use Layout", "elementor")); |
| 30096 |
}; |
| 30097 |
UseLayoutButton.propTypes = { sx: import_prop_types$8.default.object }; |
| 30098 |
var isRegenerateButtonDisabled = function isRegenerateButtonDisabled(screenshots, isLoading, isPromptFormActive) { |
| 30099 |
if (isLoading || isPromptFormActive) return true; |
| 30100 |
return screenshots.length >= 3 * 5; |
| 30101 |
}; |
| 30102 |
var FormLayout = function FormLayout(_ref) { |
| 30103 |
var _screenshots$selected; |
| 30104 |
var _screenshots$2; |
| 30105 |
var _ref$DialogHeaderProp = _ref.DialogHeaderProps; |
| 30106 |
var DialogHeaderProps = _ref$DialogHeaderProp === void 0 ? {} : _ref$DialogHeaderProp; |
| 30107 |
var _ref$DialogContentPro = _ref.DialogContentProps; |
| 30108 |
var DialogContentProps = _ref$DialogContentPro === void 0 ? {} : _ref$DialogContentPro; |
| 30109 |
var initialAttachments = _ref.attachments; |
| 30110 |
var _useConfig = useConfig(); |
| 30111 |
var attachmentsTypes = _useConfig.attachmentsTypes; |
| 30112 |
var onData = _useConfig.onData; |
| 30113 |
var onInsert = _useConfig.onInsert; |
| 30114 |
var onSelect = _useConfig.onSelect; |
| 30115 |
var onClose = _useConfig.onClose; |
| 30116 |
var onGenerate = _useConfig.onGenerate; |
| 30117 |
var _useScreenshots = useScreenshots({ onData }); |
| 30118 |
var screenshots = _useScreenshots.screenshots; |
| 30119 |
var generate = _useScreenshots.generate; |
| 30120 |
var regenerate = _useScreenshots.regenerate; |
| 30121 |
var isLoading = _useScreenshots.isLoading; |
| 30122 |
var error = _useScreenshots.error; |
| 30123 |
var abort = _useScreenshots.abort; |
| 30124 |
var screenshotOutlineOffset = "2px"; |
| 30125 |
var _useSlider = useSlider({ slidesCount: screenshots.length }); |
| 30126 |
var currentPage = _useSlider.currentPage; |
| 30127 |
var setCurrentPage = _useSlider.setCurrentPage; |
| 30128 |
var pagesCount = _useSlider.pagesCount; |
| 30129 |
var gapPercentage = _useSlider.gapPercentage; |
| 30130 |
var slidesPerPage = _useSlider.slidesPerPage; |
| 30131 |
var offsetXPercentage = _useSlider.offsetXPercentage; |
| 30132 |
var slideWidthPercentage = _useSlider.slideWidthPercentage; |
| 30133 |
var _useState2 = _slicedToArray((0, react.useState)(-1), 2); |
| 30134 |
var selectedScreenshotIndex = _useState2[0]; |
| 30135 |
var setSelectedScreenshotIndex = _useState2[1]; |
| 30136 |
var _useState4 = _slicedToArray((0, react.useState)(false), 2); |
| 30137 |
var showUnsavedChangesAlert = _useState4[0]; |
| 30138 |
var setShowUnsavedChangesAlert = _useState4[1]; |
| 30139 |
var _useState6 = _slicedToArray((0, react.useState)(true), 2); |
| 30140 |
var isPromptEditable = _useState6[0]; |
| 30141 |
var setIsPromptEditable = _useState6[1]; |
| 30142 |
var _useState8 = _slicedToArray((0, react.useState)([]), 2); |
| 30143 |
var attachments = _useState8[0]; |
| 30144 |
var setAttachments = _useState8[1]; |
| 30145 |
var _useState0 = _slicedToArray((0, react.useState)(false), 2); |
| 30146 |
var shouldRenderWebApp = _useState0[0]; |
| 30147 |
var setShouldRenderWebApp = _useState0[1]; |
| 30148 |
var _useState10 = _slicedToArray((0, react.useState)(false), 2); |
| 30149 |
var isMinimized = _useState10[0]; |
| 30150 |
var setIsMinimized = _useState10[1]; |
| 30151 |
var lastRun = (0, react.useRef)(function() {}); |
| 30152 |
var promptInputRef = (0, react.useRef)(null); |
| 30153 |
var selectedTemplate = (_screenshots$selected = screenshots[selectedScreenshotIndex]) === null || _screenshots$selected === void 0 ? void 0 : _screenshots$selected.template; |
| 30154 |
var dialogContentChildren = DialogContentProps.children; |
| 30155 |
var dialogContentProps = _objectWithoutProperties$1(DialogContentProps, _excluded$1); |
| 30156 |
var shouldFallbackToEditPrompt = !!(error && 0 === screenshots.length); |
| 30157 |
var isPromptFormActive = isPromptEditable || shouldFallbackToEditPrompt; |
| 30158 |
var abortAndClose = function abortAndClose() { |
| 30159 |
abort(); |
| 30160 |
onClose(); |
| 30161 |
}; |
| 30162 |
var onCloseIntent = function onCloseIntent() { |
| 30163 |
if (promptInputRef.current.value.trim() !== "" || screenshots.length > 0) return setShowUnsavedChangesAlert(true); |
| 30164 |
abortAndClose(); |
| 30165 |
}; |
| 30166 |
var handleGenerate = function handleGenerate(event, prompt) { |
| 30167 |
event.preventDefault(); |
| 30168 |
if ("" === prompt.trim() && 0 === attachments.length) return; |
| 30169 |
if ((0, import_isURL.default)(prompt)) { |
| 30170 |
setShouldRenderWebApp(true); |
| 30171 |
return; |
| 30172 |
} |
| 30173 |
onGenerate(); |
| 30174 |
lastRun.current = function() { |
| 30175 |
setSelectedScreenshotIndex(-1); |
| 30176 |
generate(prompt, attachments); |
| 30177 |
}; |
| 30178 |
lastRun.current(); |
| 30179 |
setIsPromptEditable(false); |
| 30180 |
setCurrentPage(1); |
| 30181 |
}; |
| 30182 |
var handleRegenerate = function handleRegenerate() { |
| 30183 |
lastRun.current = function() { |
| 30184 |
regenerate(promptInputRef.current.value, attachments); |
| 30185 |
setCurrentPage(pagesCount + 1); |
| 30186 |
}; |
| 30187 |
lastRun.current(); |
| 30188 |
}; |
| 30189 |
var applyTemplate = function applyTemplate() { |
| 30190 |
onInsert(selectedTemplate); |
| 30191 |
screenshots[selectedScreenshotIndex].sendUsageData(); |
| 30192 |
abortAndClose(); |
| 30193 |
}; |
| 30194 |
var handleScreenshotClick = function handleScreenshotClick(index, template) { |
| 30195 |
return function() { |
| 30196 |
if (isPromptFormActive) return; |
| 30197 |
setSelectedScreenshotIndex(index); |
| 30198 |
onSelect(template); |
| 30199 |
}; |
| 30200 |
}; |
| 30201 |
/** |
| 30202 |
* @param {Attachment[]} items |
| 30203 |
*/ |
| 30204 |
var onAttach = function onAttach(items) { |
| 30205 |
items.forEach(function(item) { |
| 30206 |
if (!attachmentsTypes[item.type]) throw new Error("Invalid attachment type: ".concat(item.type)); |
| 30207 |
var typeConfig = attachmentsTypes[item.type]; |
| 30208 |
if (!item.previewHTML && typeConfig.previewGenerator) typeConfig.previewGenerator(item.content).then(function(html) { |
| 30209 |
item.previewHTML = html; |
| 30210 |
setAttachments(function(prev) { |
| 30211 |
return prev.map(function(attachment) { |
| 30212 |
if (attachment.content === item.content) return item; |
| 30213 |
return attachment; |
| 30214 |
}); |
| 30215 |
}); |
| 30216 |
}); |
| 30217 |
}); |
| 30218 |
setAttachments(items); |
| 30219 |
setShouldRenderWebApp(false); |
| 30220 |
setIsPromptEditable(true); |
| 30221 |
}; |
| 30222 |
(0, react.useEffect)(function() { |
| 30223 |
var _screenshots$; |
| 30224 |
if ((_screenshots$ = screenshots[0]) === null || _screenshots$ === void 0 ? void 0 : _screenshots$.template) { |
| 30225 |
onSelect(screenshots[0].template); |
| 30226 |
setSelectedScreenshotIndex(0); |
| 30227 |
} |
| 30228 |
}, [(_screenshots$2 = screenshots[0]) === null || _screenshots$2 === void 0 ? void 0 : _screenshots$2.template]); |
| 30229 |
(0, react.useEffect)(function() { |
| 30230 |
if (initialAttachments !== null && initialAttachments !== void 0 && initialAttachments.length) onAttach(initialAttachments); |
| 30231 |
}, []); |
| 30232 |
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, { |
| 30233 |
size: "small", |
| 30234 |
"aria-label": "minimize", |
| 30235 |
onClick: function onClick() { |
| 30236 |
return setIsMinimized(function(prev) { |
| 30237 |
return !prev; |
| 30238 |
}); |
| 30239 |
} |
| 30240 |
}, 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: { |
| 30241 |
pt: 2, |
| 30242 |
px: 2, |
| 30243 |
pb: 0 |
| 30244 |
} }, dialogContentChildren), attachments.length > 0 && /*#__PURE__*/ react.default.createElement(PromptPowerNotice, null), error && /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, { sx: { |
| 30245 |
pt: 2, |
| 30246 |
px: 2, |
| 30247 |
pb: 0 |
| 30248 |
} }, /*#__PURE__*/ react.default.createElement(PromptErrorMessage, { |
| 30249 |
error, |
| 30250 |
onRetry: lastRun.current |
| 30251 |
})), showUnsavedChangesAlert && /*#__PURE__*/ react.default.createElement(UnsavedChangesAlert, { |
| 30252 |
open: showUnsavedChangesAlert, |
| 30253 |
title: (0, _wordpress_i18n.__)("Leave Elementor AI?", "elementor"), |
| 30254 |
text: (0, _wordpress_i18n.__)("Your progress will be deleted, and can't be recovered.", "elementor"), |
| 30255 |
onClose: abortAndClose, |
| 30256 |
onCancel: function onCancel() { |
| 30257 |
return setShowUnsavedChangesAlert(false); |
| 30258 |
} |
| 30259 |
}), shouldRenderWebApp && /*#__PURE__*/ react.default.createElement(AttachDialog, { |
| 30260 |
type: "url", |
| 30261 |
url: promptInputRef.current.value, |
| 30262 |
onAttach, |
| 30263 |
onClose: function onClose() { |
| 30264 |
setShouldRenderWebApp(false); |
| 30265 |
} |
| 30266 |
}), /*#__PURE__*/ react.default.createElement(PromptForm, { |
| 30267 |
shouldResetPrompt: shouldRenderWebApp, |
| 30268 |
ref: promptInputRef, |
| 30269 |
isActive: isPromptFormActive, |
| 30270 |
isLoading, |
| 30271 |
showActions: screenshots.length > 0 || isLoading, |
| 30272 |
attachmentsTypes, |
| 30273 |
attachments, |
| 30274 |
onAttach, |
| 30275 |
onDetach: function onDetach(index) { |
| 30276 |
setAttachments(function(prev) { |
| 30277 |
var newAttachments = _toConsumableArray(prev); |
| 30278 |
newAttachments.splice(index, 1); |
| 30279 |
return newAttachments; |
| 30280 |
}); |
| 30281 |
setIsPromptEditable(true); |
| 30282 |
}, |
| 30283 |
onSubmit: handleGenerate, |
| 30284 |
onBack: function onBack() { |
| 30285 |
return setIsPromptEditable(false); |
| 30286 |
}, |
| 30287 |
onEdit: function onEdit() { |
| 30288 |
return setIsPromptEditable(true); |
| 30289 |
} |
| 30290 |
}), (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: { |
| 30291 |
overflow: "hidden", |
| 30292 |
p: .5 |
| 30293 |
} }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, { sx: { |
| 30294 |
display: "flex", |
| 30295 |
transition: "all 0.4s ease", |
| 30296 |
gap: "".concat(gapPercentage, "%"), |
| 30297 |
transform: "translateX(".concat(offsetXPercentage, "%)") |
| 30298 |
} }, screenshots.map(function(_ref2, index) { |
| 30299 |
var screenshot = _ref2.screenshot; |
| 30300 |
var type = _ref2.type; |
| 30301 |
var template = _ref2.template; |
| 30302 |
var isError = _ref2.isError; |
| 30303 |
var isPending = _ref2.isPending; |
| 30304 |
return /*#__PURE__*/ react.default.createElement(Screenshot, { |
| 30305 |
key: index, |
| 30306 |
url: screenshot, |
| 30307 |
type, |
| 30308 |
disabled: isPromptFormActive, |
| 30309 |
isPlaceholder: isError, |
| 30310 |
isLoading: isPending, |
| 30311 |
isSelected: selectedScreenshotIndex === index, |
| 30312 |
onClick: handleScreenshotClick(index, template), |
| 30313 |
outlineOffset: screenshotOutlineOffset, |
| 30314 |
sx: { flex: "0 0 ".concat(slideWidthPercentage, "%") } |
| 30315 |
}); |
| 30316 |
}))), /*#__PURE__*/ react.default.createElement(VoicePromotionAlert, { introductionKey: "ai-context-layout-promotion" })), screenshots.length > 0 && /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, { |
| 30317 |
sx: { |
| 30318 |
pt: 0, |
| 30319 |
px: 2, |
| 30320 |
pb: 2 |
| 30321 |
}, |
| 30322 |
display: "grid", |
| 30323 |
gridTemplateColumns: "repeat(3, 1fr)", |
| 30324 |
justifyItems: "center" |
| 30325 |
}, /*#__PURE__*/ react.default.createElement(RegenerateButton, { |
| 30326 |
onClick: handleRegenerate, |
| 30327 |
disabled: isRegenerateButtonDisabled(screenshots, isLoading, isPromptFormActive), |
| 30328 |
sx: { justifySelf: "start" } |
| 30329 |
}), screenshots.length > slidesPerPage && /*#__PURE__*/ react.default.createElement(_elementor_ui.Pagination, { |
| 30330 |
page: currentPage, |
| 30331 |
count: pagesCount, |
| 30332 |
disabled: isPromptFormActive, |
| 30333 |
onChange: function onChange(_, page) { |
| 30334 |
return setCurrentPage(page); |
| 30335 |
} |
| 30336 |
}), /*#__PURE__*/ react.default.createElement(UseLayoutButton, { |
| 30337 |
onClick: applyTemplate, |
| 30338 |
disabled: isPromptFormActive || -1 === selectedScreenshotIndex, |
| 30339 |
sx: { |
| 30340 |
justifySelf: "end", |
| 30341 |
gridColumn: 3 |
| 30342 |
} |
| 30343 |
})))))); |
| 30344 |
}; |
| 30345 |
FormLayout.propTypes = { |
| 30346 |
DialogHeaderProps: import_prop_types$8.default.object, |
| 30347 |
DialogContentProps: import_prop_types$8.default.object, |
| 30348 |
attachments: import_prop_types$8.default.arrayOf(AttachmentPropType) |
| 30349 |
}; |
| 30350 |
|
| 30351 |
//#endregion |
| 30352 |
//#region modules/ai/assets/js/editor/layout-content.js |
| 30353 |
init_slicedToArray(); |
| 30354 |
init_loader(); |
| 30355 |
init_requests_ids(); |
| 30356 |
var LayoutContent = function LayoutContent(props) { |
| 30357 |
var _useUserInfo = useUserInfo(); |
| 30358 |
var isLoading = _useUserInfo.isLoading; |
| 30359 |
var isConnected = _useUserInfo.isConnected; |
| 30360 |
var isGetStarted = _useUserInfo.isGetStarted; |
| 30361 |
var connectUrl = _useUserInfo.connectUrl; |
| 30362 |
var fetchData = _useUserInfo.fetchData; |
| 30363 |
var hasSubscription = _useUserInfo.hasSubscription; |
| 30364 |
var initialUsagePercentage = _useUserInfo.usagePercentage; |
| 30365 |
var _useConfig = useConfig(); |
| 30366 |
var onClose = _useConfig.onClose; |
| 30367 |
var onConnect = _useConfig.onConnect; |
| 30368 |
var _useRequestIds = useRequestIds(); |
| 30369 |
var updateUsagePercentage = _useRequestIds.updateUsagePercentage; |
| 30370 |
var usagePercentage = _useRequestIds.usagePercentage; |
| 30371 |
var _useState2 = _slicedToArray((0, react.useState)(false), 2); |
| 30372 |
var isInitUsageDone = _useState2[0]; |
| 30373 |
var setIsInitUsageDone = _useState2[1]; |
| 30374 |
(0, react.useEffect)(function() { |
| 30375 |
if (!isInitUsageDone && !isLoading && (initialUsagePercentage || 0 === initialUsagePercentage)) { |
| 30376 |
updateUsagePercentage(initialUsagePercentage); |
| 30377 |
setIsInitUsageDone(true); |
| 30378 |
} |
| 30379 |
}, [ |
| 30380 |
isLoading, |
| 30381 |
initialUsagePercentage, |
| 30382 |
isInitUsageDone, |
| 30383 |
updateUsagePercentage |
| 30384 |
]); |
| 30385 |
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 } } }))); |
| 30386 |
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, { |
| 30387 |
connectUrl, |
| 30388 |
onSuccess: function onSuccess(data) { |
| 30389 |
onConnect(data); |
| 30390 |
fetchData(); |
| 30391 |
} |
| 30392 |
}))); |
| 30393 |
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 }))); |
| 30394 |
var showUpgradeChip = !hasSubscription || 80 <= usagePercentage; |
| 30395 |
return /*#__PURE__*/ react.default.createElement(FormLayout, { |
| 30396 |
attachments: props.attachments, |
| 30397 |
DialogHeaderProps: { children: showUpgradeChip && /*#__PURE__*/ react.default.createElement(UpgradeChip, { |
| 30398 |
hasSubscription, |
| 30399 |
usagePercentage |
| 30400 |
}) } |
| 30401 |
}); |
| 30402 |
}; |
| 30403 |
LayoutContent.propTypes = { attachments: import_prop_types$8.default.arrayOf(AttachmentPropType) }; |
| 30404 |
|
| 30405 |
//#endregion |
| 30406 |
//#region modules/ai/assets/js/editor/layout-app.js |
| 30407 |
init_requests_ids(); |
| 30408 |
var LayoutApp = function LayoutApp(props) { |
| 30409 |
return /*#__PURE__*/ react.default.createElement(RemoteConfigProvider, { onError: props.onClose }, /*#__PURE__*/ react.default.createElement(RequestIdsProvider, null, /*#__PURE__*/ react.default.createElement(ConfigProvider, { |
| 30410 |
mode: props.mode, |
| 30411 |
attachmentsTypes: props.attachmentsTypes, |
| 30412 |
onClose: props.onClose, |
| 30413 |
onConnect: props.onConnect, |
| 30414 |
onData: props.onData, |
| 30415 |
onInsert: props.onInsert, |
| 30416 |
onSelect: props.onSelect, |
| 30417 |
onGenerate: props.onGenerate, |
| 30418 |
currentContext: props.currentContext, |
| 30419 |
hasPro: props.hasPro |
| 30420 |
}, /*#__PURE__*/ react.default.createElement(LayoutContent, { attachments: props.attachments })))); |
| 30421 |
}; |
| 30422 |
LayoutApp.propTypes = { |
| 30423 |
mode: import_prop_types$8.default.oneOf(LAYOUT_APP_MODES).isRequired, |
| 30424 |
attachmentsTypes: AttachmentsTypesPropType, |
| 30425 |
attachments: import_prop_types$8.default.arrayOf(AttachmentPropType), |
| 30426 |
onClose: import_prop_types$8.default.func.isRequired, |
| 30427 |
onConnect: import_prop_types$8.default.func.isRequired, |
| 30428 |
onData: import_prop_types$8.default.func.isRequired, |
| 30429 |
onInsert: import_prop_types$8.default.func.isRequired, |
| 30430 |
onSelect: import_prop_types$8.default.func.isRequired, |
| 30431 |
onGenerate: import_prop_types$8.default.func.isRequired, |
| 30432 |
currentContext: import_prop_types$8.default.object, |
| 30433 |
hasPro: import_prop_types$8.default.bool |
| 30434 |
}; |
| 30435 |
|
| 30436 |
//#endregion |
| 30437 |
//#region modules/ai/assets/js/editor/utils/screenshot.js |
| 30438 |
init_requests_ids(); |
| 30439 |
|
| 30440 |
//#endregion |
| 30441 |
//#region modules/ai/assets/js/editor/layout-app-wrapper.js |
| 30442 |
var LayoutAppWrapper = function LayoutAppWrapper(props) { |
| 30443 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.DirectionProvider, { rtl: props.isRTL }, /*#__PURE__*/ react.default.createElement(_elementor_ui.ThemeProvider, { colorScheme: props.colorScheme }, props.children)); |
| 30444 |
}; |
| 30445 |
LayoutAppWrapper.propTypes = { |
| 30446 |
children: import_prop_types$8.default.node, |
| 30447 |
isRTL: import_prop_types$8.default.bool, |
| 30448 |
colorScheme: import_prop_types$8.default.oneOf([ |
| 30449 |
"auto", |
| 30450 |
"light", |
| 30451 |
"dark" |
| 30452 |
]) |
| 30453 |
}; |
| 30454 |
|
| 30455 |
//#endregion |
| 30456 |
//#region modules/ai/assets/js/editor/utils/editor-integration.js |
| 30457 |
init_requests_ids(); |
| 30458 |
var onConnect = function onConnect(data) { |
| 30459 |
elementorCommon.config.library_connect.is_connected = true; |
| 30460 |
elementorCommon.config.library_connect.current_access_level = data.kits_access_level || data.access_level || 0; |
| 30461 |
elementorCommon.config.library_connect.current_access_tier = data.access_tier; |
| 30462 |
elementorCommon.config.library_connect.plan_type = data.plan_type; |
| 30463 |
}; |
| 30464 |
var getUiConfig = function getUiConfig() { |
| 30465 |
var _elementor; |
| 30466 |
var _elementor$getPrefere; |
| 30467 |
return { |
| 30468 |
colorScheme: ((_elementor = elementor) === null || _elementor === void 0 || (_elementor$getPrefere = _elementor.getPreferences) === null || _elementor$getPrefere === void 0 ? void 0 : _elementor$getPrefere.call(_elementor, "ui_theme")) || "auto", |
| 30469 |
isRTL: elementorCommon.config.isRTL |
| 30470 |
}; |
| 30471 |
}; |
| 30472 |
var VARIATIONS_PROMPTS = [ |
| 30473 |
{ text: (0, _wordpress_i18n.__)("Minimalist design with bold typography about", "elementor") }, |
| 30474 |
{ text: (0, _wordpress_i18n.__)("Elegant style with serif fonts discussing", "elementor") }, |
| 30475 |
{ text: (0, _wordpress_i18n.__)("Retro vibe with muted colors and classic fonts about", "elementor") }, |
| 30476 |
{ text: (0, _wordpress_i18n.__)("Futuristic design with neon accents about", "elementor") }, |
| 30477 |
{ text: (0, _wordpress_i18n.__)("Professional look with clean lines for", "elementor") }, |
| 30478 |
{ text: (0, _wordpress_i18n.__)("Earthy tones and organic shapes featuring", "elementor") }, |
| 30479 |
{ text: (0, _wordpress_i18n.__)("Luxurious theme with rich colors discussing", "elementor") }, |
| 30480 |
{ text: (0, _wordpress_i18n.__)("Tech-inspired style with modern fonts about", "elementor") }, |
| 30481 |
{ text: (0, _wordpress_i18n.__)("Warm hues with comforting visuals about", "elementor") } |
| 30482 |
]; |
| 30483 |
var WEB_BASED_PROMPTS = [ |
| 30484 |
{ text: (0, _wordpress_i18n.__)("Change the content to be about [topic]", "elementor") }, |
| 30485 |
{ text: (0, _wordpress_i18n.__)("Generate lorem ipsum placeholder text for all paragraphs", "elementor") }, |
| 30486 |
{ text: (0, _wordpress_i18n.__)("Revise the content to focus on [topic] and then translate it into Spanish", "elementor") }, |
| 30487 |
{ text: (0, _wordpress_i18n.__)("Shift the focus of the content to [topic] in order to showcase our company's mission and values", "elementor") }, |
| 30488 |
{ text: (0, _wordpress_i18n.__)("Alter the content to provide helpful tips related to [topic]", "elementor") }, |
| 30489 |
{ text: (0, _wordpress_i18n.__)("Adjust the content to include FAQs and answers for common inquiries about [topic]", "elementor") } |
| 30490 |
]; |
| 30491 |
var PROMPT_PLACEHOLDER = (0, _wordpress_i18n.__)("Press '/' for suggestions or describe the changes you want to apply (optional)...", "elementor"); |
| 30492 |
|
| 30493 |
//#endregion |
| 30494 |
//#region modules/ai/assets/js/editor/app.js |
| 30495 |
init_requests_ids(); |
| 30496 |
var App = function App(props) { |
| 30497 |
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, { |
| 30498 |
type: props.type, |
| 30499 |
controlType: props.controlType, |
| 30500 |
onClose: props.onClose, |
| 30501 |
onConnect, |
| 30502 |
getControlValue: props.getControlValue, |
| 30503 |
setControlValue: props.setControlValue, |
| 30504 |
additionalOptions: props.additionalOptions |
| 30505 |
})))); |
| 30506 |
}; |
| 30507 |
App.propTypes = { |
| 30508 |
colorScheme: import_prop_types$8.default.oneOf([ |
| 30509 |
"auto", |
| 30510 |
"light", |
| 30511 |
"dark" |
| 30512 |
]), |
| 30513 |
type: import_prop_types$8.default.string, |
| 30514 |
controlType: import_prop_types$8.default.string, |
| 30515 |
onClose: import_prop_types$8.default.func, |
| 30516 |
getControlValue: import_prop_types$8.default.func, |
| 30517 |
setControlValue: import_prop_types$8.default.func, |
| 30518 |
additionalOptions: import_prop_types$8.default.object, |
| 30519 |
isRTL: import_prop_types$8.default.bool |
| 30520 |
}; |
| 30521 |
|
| 30522 |
//#endregion |
| 30523 |
//#region modules/ai/assets/js/editor/hooks/use-excerpt-prompt.js |
| 30524 |
init_asyncToGenerator(); |
| 30525 |
init_api(); |
| 30526 |
init_use_prompt(); |
| 30527 |
var useExcerptPrompt = function useExcerptPrompt(initialValue) { |
| 30528 |
return usePrompt(/*#__PURE__*/ function() { |
| 30529 |
var _ref = _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee(payload) { |
| 30530 |
return import_regenerator$2.default.wrap(function(_context) { |
| 30531 |
while (1) switch (_context.prev = _context.next) { |
| 30532 |
case 0: return _context.abrupt("return", getExcerpt(payload)); |
| 30533 |
case 1: |
| 30534 |
case "end": return _context.stop(); |
| 30535 |
} |
| 30536 |
}, _callee); |
| 30537 |
})); |
| 30538 |
return function(_x) { |
| 30539 |
return _ref.apply(this, arguments); |
| 30540 |
}; |
| 30541 |
}(), initialValue); |
| 30542 |
}; |
| 30543 |
|
| 30544 |
//#endregion |
| 30545 |
//#region modules/ai/assets/js/editor/ai-excerpt.js |
| 30546 |
init_asyncToGenerator(); |
| 30547 |
init_slicedToArray(); |
| 30548 |
init_requests_ids(); |
| 30549 |
var AIExcerpt = function AIExcerpt(_ref) { |
| 30550 |
var onClose = _ref.onClose; |
| 30551 |
var currExcerpt = _ref.currExcerpt; |
| 30552 |
var updateExcerpt = _ref.updateExcerpt; |
| 30553 |
var postTextualContent = _ref.postTextualContent; |
| 30554 |
var _useUserInfo = useUserInfo(true); |
| 30555 |
var isLoadingUserInfo = _useUserInfo.isLoading; |
| 30556 |
var isConnected = _useUserInfo.isConnected; |
| 30557 |
var isGetStarted = _useUserInfo.isGetStarted; |
| 30558 |
var connectUrl = _useUserInfo.connectUrl; |
| 30559 |
var fetchData = _useUserInfo.fetchData; |
| 30560 |
var hasSubscription = _useUserInfo.hasSubscription; |
| 30561 |
var credits = _useUserInfo.credits; |
| 30562 |
var initialUsagePercentage = _useUserInfo.usagePercentage; |
| 30563 |
var _useExcerptPrompt = useExcerptPrompt({ |
| 30564 |
result: currExcerpt, |
| 30565 |
credits |
| 30566 |
}); |
| 30567 |
var newExcerpt = _useExcerptPrompt.data; |
| 30568 |
var error = _useExcerptPrompt.error; |
| 30569 |
var send = _useExcerptPrompt.send; |
| 30570 |
var _useRequestIds = useRequestIds(); |
| 30571 |
var updateUsagePercentage = _useRequestIds.updateUsagePercentage; |
| 30572 |
var usagePercentage = _useRequestIds.usagePercentage; |
| 30573 |
var _useState2 = _slicedToArray((0, react.useState)(false), 2); |
| 30574 |
var isInitUsageDone = _useState2[0]; |
| 30575 |
var setIsInitUsageDone = _useState2[1]; |
| 30576 |
(0, react.useEffect)(function() { |
| 30577 |
if (!isInitUsageDone && !isLoadingUserInfo && (initialUsagePercentage || 0 === initialUsagePercentage)) { |
| 30578 |
updateUsagePercentage(initialUsagePercentage); |
| 30579 |
setIsInitUsageDone(true); |
| 30580 |
} |
| 30581 |
}, [ |
| 30582 |
isLoadingUserInfo, |
| 30583 |
initialUsagePercentage, |
| 30584 |
isInitUsageDone, |
| 30585 |
updateUsagePercentage |
| 30586 |
]); |
| 30587 |
var generateExcerptOnce = (0, react.useRef)(false); |
| 30588 |
var _useState4 = _slicedToArray((0, react.useState)(true), 2); |
| 30589 |
var isLoadingCombined = _useState4[0]; |
| 30590 |
var setIsLoadingCombined = _useState4[1]; |
| 30591 |
var initHook = function initHook() { |
| 30592 |
return { |
| 30593 |
isLoading: isLoadingCombined, |
| 30594 |
isConnected, |
| 30595 |
isGetStarted, |
| 30596 |
connectUrl, |
| 30597 |
fetchData, |
| 30598 |
hasSubscription, |
| 30599 |
credits, |
| 30600 |
usagePercentage |
| 30601 |
}; |
| 30602 |
}; |
| 30603 |
var fetchAiExcerpt = (0, react.useCallback)(/*#__PURE__*/ _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee() { |
| 30604 |
return import_regenerator$2.default.wrap(function(_context) { |
| 30605 |
while (1) switch (_context.prev = _context.next) { |
| 30606 |
case 0: |
| 30607 |
if (!(send && postTextualContent)) { |
| 30608 |
_context.next = 1; |
| 30609 |
break; |
| 30610 |
} |
| 30611 |
generateExcerptOnce.current = true; |
| 30612 |
_context.next = 1; |
| 30613 |
return send({ content: postTextualContent }).finally(function() { |
| 30614 |
setIsLoadingCombined(false); |
| 30615 |
}); |
| 30616 |
case 1: |
| 30617 |
case "end": return _context.stop(); |
| 30618 |
} |
| 30619 |
}, _callee); |
| 30620 |
})), [postTextualContent, send]); |
| 30621 |
(0, react.useEffect)(function() { |
| 30622 |
if (!generateExcerptOnce.current && isConnected && isGetStarted) fetchAiExcerpt(); |
| 30623 |
}, [ |
| 30624 |
fetchAiExcerpt, |
| 30625 |
isConnected, |
| 30626 |
isGetStarted |
| 30627 |
]); |
| 30628 |
(0, react.useEffect)(function() { |
| 30629 |
if (!isLoadingUserInfo && (!isConnected || !isGetStarted)) setIsLoadingCombined(false); |
| 30630 |
}, [ |
| 30631 |
isConnected, |
| 30632 |
isGetStarted, |
| 30633 |
isLoadingUserInfo |
| 30634 |
]); |
| 30635 |
var isRTL = elementorCommon.config.isRTL; |
| 30636 |
return /*#__PURE__*/ react.default.createElement(react.default.Fragment, null, /*#__PURE__*/ react.default.createElement(App, { |
| 30637 |
type: "text", |
| 30638 |
getControlValue: function getControlValue() { |
| 30639 |
return newExcerpt.result ? newExcerpt : currExcerpt; |
| 30640 |
}, |
| 30641 |
setControlValue: function setControlValue(value) { |
| 30642 |
return updateExcerpt(value); |
| 30643 |
}, |
| 30644 |
onClose, |
| 30645 |
isRTL, |
| 30646 |
additionalOptions: { |
| 30647 |
loadingTitle: (0, _wordpress_i18n.__)("Analyzing your post to craft an excerpt...", "elementor"), |
| 30648 |
useCustomInit: initHook, |
| 30649 |
initError: error, |
| 30650 |
initRetry: fetchAiExcerpt |
| 30651 |
} |
| 30652 |
})); |
| 30653 |
}; |
| 30654 |
AIExcerpt.propTypes = { |
| 30655 |
onClose: import_prop_types$8.default.func.isRequired, |
| 30656 |
updateExcerpt: import_prop_types$8.default.func.isRequired, |
| 30657 |
currExcerpt: import_prop_types$8.default.string.isRequired, |
| 30658 |
postTextualContent: import_prop_types$8.default.string.isRequired |
| 30659 |
}; |
| 30660 |
|
| 30661 |
//#endregion |
| 30662 |
//#region modules/ai/assets/js/editor/hooks/use-featured-image-prompt.js |
| 30663 |
init_asyncToGenerator(); |
| 30664 |
init_api(); |
| 30665 |
var useFeaturedImagePrompt = function useFeaturedImagePrompt(initialValue) { |
| 30666 |
return useImagePrompt(/*#__PURE__*/ function() { |
| 30667 |
var _ref = _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee(payload) { |
| 30668 |
return import_regenerator$2.default.wrap(function(_context) { |
| 30669 |
while (1) switch (_context.prev = _context.next) { |
| 30670 |
case 0: return _context.abrupt("return", getFeaturedImage(payload)); |
| 30671 |
case 1: |
| 30672 |
case "end": return _context.stop(); |
| 30673 |
} |
| 30674 |
}, _callee); |
| 30675 |
})); |
| 30676 |
return function(_x) { |
| 30677 |
return _ref.apply(this, arguments); |
| 30678 |
}; |
| 30679 |
}(), initialValue); |
| 30680 |
}; |
| 30681 |
|
| 30682 |
//#endregion |
| 30683 |
//#region modules/ai/assets/js/media-library/components.js |
| 30684 |
var AIMediaGenerateApp = function AIMediaGenerateApp(_ref) { |
| 30685 |
var onClose = _ref.onClose; |
| 30686 |
var setControlValue = _ref.setControlValue; |
| 30687 |
var _ref$predefinedPrompt = _ref.predefinedPrompt; |
| 30688 |
var predefinedPrompt = _ref$predefinedPrompt === void 0 ? "" : _ref$predefinedPrompt; |
| 30689 |
var _ref$textToImageHook = _ref.textToImageHook; |
| 30690 |
var textToImageHook = _ref$textToImageHook === void 0 ? null : _ref$textToImageHook; |
| 30691 |
var _ref$initialSettings = _ref.initialSettings; |
| 30692 |
var initialSettings = _ref$initialSettings === void 0 ? {} : _ref$initialSettings; |
| 30693 |
return /*#__PURE__*/ react.default.createElement(react.default.Fragment, null, /*#__PURE__*/ react.default.createElement(App, { |
| 30694 |
type: "media", |
| 30695 |
getControlValue: function getControlValue() {}, |
| 30696 |
setControlValue, |
| 30697 |
onClose, |
| 30698 |
isRTL: elementorCommon.config.isRTL, |
| 30699 |
additionalOptions: { |
| 30700 |
defaultImageType: Object.keys(IMAGE_PROMPT_CATEGORIES)[1], |
| 30701 |
textToImageHook, |
| 30702 |
predefinedPrompt, |
| 30703 |
initialSettings |
| 30704 |
} |
| 30705 |
})); |
| 30706 |
}; |
| 30707 |
AIMediaGenerateApp.propTypes = { |
| 30708 |
onClose: import_prop_types$8.default.func.isRequired, |
| 30709 |
predefinedPrompt: import_prop_types$8.default.string, |
| 30710 |
textToImageHook: import_prop_types$8.default.func, |
| 30711 |
setControlValue: import_prop_types$8.default.func.isRequired, |
| 30712 |
initialSettings: import_prop_types$8.default.object |
| 30713 |
}; |
| 30714 |
var AIMediaEditApp = function AIMediaEditApp(_ref2) { |
| 30715 |
var onClose = _ref2.onClose; |
| 30716 |
var imageId = _ref2.imageId; |
| 30717 |
var image = wp.media.attachment(imageId); |
| 30718 |
return /*#__PURE__*/ react.default.createElement(react.default.Fragment, null, /*#__PURE__*/ react.default.createElement(App, { |
| 30719 |
type: "media", |
| 30720 |
getControlValue: function getControlValue() { |
| 30721 |
return image.attributes; |
| 30722 |
}, |
| 30723 |
setControlValue: function setControlValue() {}, |
| 30724 |
onClose, |
| 30725 |
isRTL: elementorCommon.config.isRTL, |
| 30726 |
additionalOptions: { location: LOCATIONS.IMAGE_TOOLS } |
| 30727 |
})); |
| 30728 |
}; |
| 30729 |
AIMediaEditApp.propTypes = { |
| 30730 |
onClose: import_prop_types$8.default.func.isRequired, |
| 30731 |
imageId: import_prop_types$8.default.string |
| 30732 |
}; |
| 30733 |
|
| 30734 |
//#endregion |
| 30735 |
//#region modules/ai/assets/js/editor/ai-behavior.js |
| 30736 |
init_requests_ids(); |
| 30737 |
function _callSuper$1(t, o, e) { |
| 30738 |
return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct$1() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); |
| 30739 |
} |
| 30740 |
__name(_callSuper$1, "_callSuper"); |
| 30741 |
function _isNativeReflectConstruct$1() { |
| 30742 |
try { |
| 30743 |
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})); |
| 30744 |
} catch (t) {} |
| 30745 |
return (_isNativeReflectConstruct$1 = function _isNativeReflectConstruct() { |
| 30746 |
return !!t; |
| 30747 |
})(); |
| 30748 |
} |
| 30749 |
__name(_isNativeReflectConstruct$1, "_isNativeReflectConstruct"); |
| 30750 |
var AiBehavior = /*#__PURE__*/ function(_Marionette$Behavior) { |
| 30751 |
function AiBehavior() { |
| 30752 |
_classCallCheck(this, AiBehavior); |
| 30753 |
return _callSuper$1(this, AiBehavior, arguments); |
| 30754 |
} |
| 30755 |
_inherits(AiBehavior, _Marionette$Behavior); |
| 30756 |
return _createClass(AiBehavior, [ |
| 30757 |
{ |
| 30758 |
key: "initialize", |
| 30759 |
value: function initialize() { |
| 30760 |
this.type = "text"; |
| 30761 |
this.controlType = "text"; |
| 30762 |
this.buttonLabel = (0, _wordpress_i18n.__)("Write with AI", "elementor"); |
| 30763 |
this.editButtonLabel = (0, _wordpress_i18n.__)("Edit with AI", "elementor"); |
| 30764 |
this.isLabelBlock = false; |
| 30765 |
this.additionalOptions = {}; |
| 30766 |
this.context = {}; |
| 30767 |
this.config = window.ElementorAiConfig; |
| 30768 |
} |
| 30769 |
}, |
| 30770 |
{ |
| 30771 |
key: "ui", |
| 30772 |
value: function ui() { |
| 30773 |
return { aiButton: ".e-ai-button" }; |
| 30774 |
} |
| 30775 |
}, |
| 30776 |
{ |
| 30777 |
key: "events", |
| 30778 |
value: function events() { |
| 30779 |
return { "click @ui.aiButton": "onAiButtonClick" }; |
| 30780 |
} |
| 30781 |
}, |
| 30782 |
{ |
| 30783 |
key: "getTextualContent", |
| 30784 |
value: function getTextualContent() { |
| 30785 |
var _window$elementor$$pr; |
| 30786 |
var pageTextContent = []; |
| 30787 |
var clonedCurrentLayout = (_window$elementor$$pr = window.elementor.$previewContents[0]) === null || _window$elementor$$pr === void 0 ? void 0 : _window$elementor$$pr.cloneNode(true); |
| 30788 |
clonedCurrentLayout.querySelectorAll(".elementor-editor-element-settings, #elementor-add-new-section, .elementor-add-section-inner, header, footer").forEach(function(handle) { |
| 30789 |
return handle.remove(); |
| 30790 |
}); |
| 30791 |
var _walkDOM = function walkDOM(node) { |
| 30792 |
var _node$classList; |
| 30793 |
var ancestorOfElementorElement = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false; |
| 30794 |
ancestorOfElementorElement = ((_node$classList = node.classList) === null || _node$classList === void 0 ? void 0 : _node$classList.contains("elementor-element")) || ancestorOfElementorElement; |
| 30795 |
if (Node.TEXT_NODE === node.nodeType && ancestorOfElementorElement) { |
| 30796 |
var _node$textContent; |
| 30797 |
var cleanText = ((_node$textContent = node.textContent) !== null && _node$textContent !== void 0 ? _node$textContent : "").trim().replace(/\t+/g, " ").replace(/\n+/g, "\n").replace(/\s+/g, " "); |
| 30798 |
if (cleanText) pageTextContent.push(cleanText); |
| 30799 |
} else node.childNodes.forEach(function(child) { |
| 30800 |
return _walkDOM(child, ancestorOfElementorElement); |
| 30801 |
}); |
| 30802 |
}; |
| 30803 |
_walkDOM(clonedCurrentLayout); |
| 30804 |
return pageTextContent.join("\n"); |
| 30805 |
} |
| 30806 |
}, |
| 30807 |
{ |
| 30808 |
key: "onAiButtonClick", |
| 30809 |
value: function onAiButtonClick(event) { |
| 30810 |
var _elementor; |
| 30811 |
var _elementor$getPrefere; |
| 30812 |
event.stopPropagation(); |
| 30813 |
var colorScheme = ((_elementor = elementor) === null || _elementor === void 0 || (_elementor$getPrefere = _elementor.getPreferences) === null || _elementor$getPrefere === void 0 ? void 0 : _elementor$getPrefere.call(_elementor, "ui_theme")) || "auto"; |
| 30814 |
var isRTL = elementorCommon.config.isRTL; |
| 30815 |
var rootElement = document.createElement("div"); |
| 30816 |
document.body.append(rootElement); |
| 30817 |
window.elementorAiCurrentContext = this.getOption("context"); |
| 30818 |
var unmount = react_default.render(this.getElementToRender(rootElement, colorScheme, isRTL), rootElement).unmount; |
| 30819 |
this.unmount = unmount; |
| 30820 |
} |
| 30821 |
}, |
| 30822 |
{ |
| 30823 |
key: "getElementToRender", |
| 30824 |
value: function getElementToRender(rootElement, colorScheme, isRTL) { |
| 30825 |
var _this = this; |
| 30826 |
var _this$getOption; |
| 30827 |
var onClose = function onClose() { |
| 30828 |
_this.handleClose(); |
| 30829 |
rootElement.remove(); |
| 30830 |
var onCloseCallback = _this.getOption("onCloseCallback"); |
| 30831 |
if (onCloseCallback) onCloseCallback(); |
| 30832 |
}; |
| 30833 |
if ("post_featured_image" === ((_this$getOption = this.getOption("context")) === null || _this$getOption === void 0 ? void 0 : _this$getOption.controlName)) return /*#__PURE__*/ react.default.createElement(AIMediaGenerateApp, { |
| 30834 |
onClose, |
| 30835 |
predefinedPrompt: this.getTextualContent(), |
| 30836 |
textToImageHook: useFeaturedImagePrompt, |
| 30837 |
getControlValue: this.getOption("getControlValue"), |
| 30838 |
setControlValue: this.getOption("setControlValue"), |
| 30839 |
initialSettings: { aspectRatio: "4:3" } |
| 30840 |
}); |
| 30841 |
if ("excerpt" === this.getOption("type")) return /*#__PURE__*/ react.default.createElement(RequestIdsProvider, null, /*#__PURE__*/ react.default.createElement(AIExcerpt, { |
| 30842 |
onClose, |
| 30843 |
currExcerpt: this.getOption("getControlValue")(), |
| 30844 |
updateExcerpt: this.getOption("setControlValue"), |
| 30845 |
postTextualContent: this.getTextualContent() |
| 30846 |
})); |
| 30847 |
return /*#__PURE__*/ react.default.createElement(App, { |
| 30848 |
type: this.getOption("type"), |
| 30849 |
controlType: this.getOption("controlType"), |
| 30850 |
getControlValue: this.getOption("getControlValue"), |
| 30851 |
setControlValue: this.getOption("setControlValue"), |
| 30852 |
additionalOptions: this.getOption("additionalOptions"), |
| 30853 |
onClose, |
| 30854 |
colorScheme, |
| 30855 |
isRTL |
| 30856 |
}); |
| 30857 |
} |
| 30858 |
}, |
| 30859 |
{ |
| 30860 |
key: "handleClose", |
| 30861 |
value: function handleClose() { |
| 30862 |
if (this.unmount) this.unmount(); |
| 30863 |
} |
| 30864 |
}, |
| 30865 |
{ |
| 30866 |
key: "getAiButtonLabel", |
| 30867 |
value: function getAiButtonLabel() { |
| 30868 |
var _this$getOption2; |
| 30869 |
var defaultValue = (_this$getOption2 = this.getOption("additionalOptions")) === null || _this$getOption2 === void 0 ? void 0 : _this$getOption2.defaultValue; |
| 30870 |
var currentValue = this.getOption("getControlValue")(); |
| 30871 |
var isMedia = "media" === this.getOption("type"); |
| 30872 |
return !isMedia && defaultValue === currentValue || isMedia && (currentValue === null || currentValue === void 0 ? void 0 : currentValue.url) === (defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.url) ? this.getOption("buttonLabel") : this.getOption("editButtonLabel"); |
| 30873 |
} |
| 30874 |
}, |
| 30875 |
{ |
| 30876 |
key: "onRender", |
| 30877 |
value: function onRender() { |
| 30878 |
var isPromotion = !this.config.is_get_started; |
| 30879 |
var buttonLabel = this.getAiButtonLabel(); |
| 30880 |
var buttonClass = "e-ai-button"; |
| 30881 |
if (this.getOption("additionalOptions").buttonBorder) buttonClass += " e-ai-border-button"; |
| 30882 |
var $button = jQuery("<button>", { class: buttonClass }); |
| 30883 |
if (!isPromotion) $button.addClass("e-active"); |
| 30884 |
$button.html("<i class=\"eicon-ai\"></i>"); |
| 30885 |
if (this.getOption("isLabelBlock") && isPromotion) $button.append(" " + buttonLabel); |
| 30886 |
else $button.tipsy({ |
| 30887 |
gravity: "s", |
| 30888 |
title: function title() { |
| 30889 |
return buttonLabel; |
| 30890 |
} |
| 30891 |
}); |
| 30892 |
var $wrap = this.$el.find(".elementor-control-responsive-switchers"); |
| 30893 |
if (!$wrap.length) $wrap = this.$el.find(".elementor-control-title"); |
| 30894 |
$wrap.after($button); |
| 30895 |
} |
| 30896 |
} |
| 30897 |
]); |
| 30898 |
}(Marionette.Behavior); |
| 30899 |
|
| 30900 |
//#endregion |
| 30901 |
//#region modules/ai/assets/js/editor/components/wizard-dialog-wrapper.js |
| 30902 |
var WizardDialogWrapper = function WizardDialogWrapper(props) { |
| 30903 |
return /*#__PURE__*/ react.default.createElement(WizardDialog, { onClose: props.onClose }, /*#__PURE__*/ react.default.createElement(WizardDialog.Header, { onClose: props.onClose }), /*#__PURE__*/ react.default.createElement(WizardDialog.Content, { dividers: true }, props.children)); |
| 30904 |
}; |
| 30905 |
WizardDialogWrapper.propTypes = { |
| 30906 |
onClose: import_prop_types$8.default.func.isRequired, |
| 30907 |
children: import_prop_types$8.default.node.isRequired |
| 30908 |
}; |
| 30909 |
|
| 30910 |
//#endregion |
| 30911 |
//#region modules/ai/assets/js/editor/pages/connect/connect-and-get-started.js |
| 30912 |
init_slicedToArray(); |
| 30913 |
var ConnectAndGetStarted = function ConnectAndGetStarted(_ref) { |
| 30914 |
var connectUrl = _ref.connectUrl; |
| 30915 |
var onSuccess = _ref.onSuccess; |
| 30916 |
var isConnected = _ref.isConnected; |
| 30917 |
var getStartedAction = _ref.getStartedAction; |
| 30918 |
var approveButtonRef = (0, react.useRef)(); |
| 30919 |
var _useState2 = _slicedToArray((0, react.useState)(false), 2); |
| 30920 |
var isTermsChecked = _useState2[0]; |
| 30921 |
var setIsTermsChecked = _useState2[1]; |
| 30922 |
(0, react.useEffect)(function() { |
| 30923 |
if (!jQuery.fn.elementorConnect) return; |
| 30924 |
jQuery(approveButtonRef.current).elementorConnect({ |
| 30925 |
success: function success(_, data) { |
| 30926 |
onSuccess(data); |
| 30927 |
}, |
| 30928 |
error: function error() { |
| 30929 |
throw new Error("Elementor AI: Failed to connect."); |
| 30930 |
} |
| 30931 |
}); |
| 30932 |
}, []); |
| 30933 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, { |
| 30934 |
alignItems: "center", |
| 30935 |
gap: 2 |
| 30936 |
}, /*#__PURE__*/ react.default.createElement(_elementor_icons.AIIcon, { sx: { |
| 30937 |
color: "text.primary", |
| 30938 |
fontSize: "60px", |
| 30939 |
mb: 1 |
| 30940 |
} }), /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, { |
| 30941 |
variant: "h4", |
| 30942 |
sx: { color: "text.primary" } |
| 30943 |
}, (0, _wordpress_i18n.__)("Step into the future with Elementor AI", "elementor")), /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, { variant: "body2" }, (0, _wordpress_i18n.__)("Create websites faster with AI built right into the Editor.", "elementor")), /*#__PURE__*/ react.default.createElement(_elementor_ui.Divider, { sx: { |
| 30944 |
mt: 2, |
| 30945 |
ml: 2, |
| 30946 |
mr: 2, |
| 30947 |
height: "1px", |
| 30948 |
width: "50%" |
| 30949 |
} }), /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, { |
| 30950 |
direction: "row", |
| 30951 |
gap: 1.5, |
| 30952 |
alignItems: "flex-start" |
| 30953 |
}, /*#__PURE__*/ react.default.createElement(_elementor_ui.Checkbox, { |
| 30954 |
id: "e-ai-terms-approval", |
| 30955 |
color: "secondary", |
| 30956 |
checked: isTermsChecked, |
| 30957 |
onClick: function onClick() { |
| 30958 |
return setIsTermsChecked(function(prevState) { |
| 30959 |
return !prevState; |
| 30960 |
}); |
| 30961 |
} |
| 30962 |
}), /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, null, /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, { |
| 30963 |
variant: "caption", |
| 30964 |
sx: { maxWidth: 520 }, |
| 30965 |
component: "label", |
| 30966 |
htmlFor: "e-ai-terms-approval" |
| 30967 |
}, " ", (0, _wordpress_i18n.__)("I approve the ", "elementor"), /*#__PURE__*/ react.default.createElement(_elementor_ui.Link, { |
| 30968 |
href: "https://go.elementor.com/ai-terms/", |
| 30969 |
target: "_blank", |
| 30970 |
color: "info.main" |
| 30971 |
}, (0, _wordpress_i18n.__)("Terms of Service", "elementor")), " & ", /*#__PURE__*/ react.default.createElement(_elementor_ui.Link, { |
| 30972 |
href: "https://go.elementor.com/ai-privacy-policy/", |
| 30973 |
target: "_blank", |
| 30974 |
color: "info.main" |
| 30975 |
}, (0, _wordpress_i18n.__)("Privacy Policy", "elementor")), (0, _wordpress_i18n.__)(" of the Elementor AI service. ", "elementor"), (0, _wordpress_i18n.__)("This includes consenting to the collection and use of data to improve user experience.", "elementor")))), isConnected ? /*#__PURE__*/ react.default.createElement(_elementor_ui.Button, { |
| 30976 |
disabled: !isTermsChecked, |
| 30977 |
variant: "contained", |
| 30978 |
onClick: getStartedAction, |
| 30979 |
sx: { |
| 30980 |
mt: 1, |
| 30981 |
"&:hover": { color: "primary.contrastText" } |
| 30982 |
} |
| 30983 |
}, (0, _wordpress_i18n.__)("Get Started", "elementor")) : /*#__PURE__*/ react.default.createElement(_elementor_ui.Button, { |
| 30984 |
ref: approveButtonRef, |
| 30985 |
disabled: !isTermsChecked, |
| 30986 |
href: connectUrl, |
| 30987 |
variant: "contained", |
| 30988 |
sx: { |
| 30989 |
mt: 1, |
| 30990 |
"&:hover": { color: "primary.contrastText" } |
| 30991 |
} |
| 30992 |
}, (0, _wordpress_i18n.__)("Connect", "elementor"))); |
| 30993 |
}; |
| 30994 |
ConnectAndGetStarted.propTypes = { |
| 30995 |
connectUrl: import_prop_types$8.default.string.isRequired, |
| 30996 |
onSuccess: import_prop_types$8.default.func.isRequired, |
| 30997 |
isConnected: import_prop_types$8.default.bool.isRequired, |
| 30998 |
getStartedAction: import_prop_types$8.default.func.isRequired |
| 30999 |
}; |
| 31000 |
|
| 31001 |
//#endregion |
| 31002 |
//#region modules/ai/assets/js/editor/components/ai-promotion-infotip.js |
| 31003 |
var StyledPopper = (0, _elementor_ui.styled)(_elementor_ui.Popper)(function(_ref) { |
| 31004 |
var theme = _ref.theme; |
| 31005 |
return { |
| 31006 |
"& .MuiTooltip-tooltip": { |
| 31007 |
width: 500, |
| 31008 |
minHeight: 50, |
| 31009 |
padding: 0, |
| 31010 |
backgroundColor: theme.palette.background.paper, |
| 31011 |
color: theme.palette.text.primary, |
| 31012 |
boxShadow: "0px -6px 10px 2px rgba(0,0,0,0.025),6px 0px 10px 2px rgba(0,0,0,0.025),-6px 0px 10px 2px rgba(0,0,0,0.025),0px 6px 10px 2px rgba(0,0,0,0.025)" |
| 31013 |
}, |
| 31014 |
"& .MuiTooltip-arrow": { |
| 31015 |
color: theme.palette.background.paper, |
| 31016 |
fontSize: "1.2rem" |
| 31017 |
}, |
| 31018 |
"&.MuiTooltip-popper .MuiTooltip-tooltip.MuiTooltip-tooltipPlacementBottom": { marginTop: theme.spacing(2) }, |
| 31019 |
"&.MuiTooltip-popper .MuiTooltip-tooltip.MuiTooltip-tooltipPlacementRight": { marginLeft: theme.spacing(2) }, |
| 31020 |
"&.MuiTooltip-popper .MuiTooltip-tooltip.MuiTooltip-tooltipPlacementLeft": { marginRight: theme.spacing(2) }, |
| 31021 |
"&.MuiTooltip-popper .MuiTooltip-tooltip.MuiTooltip-tooltipPlacementTop": { marginBottom: theme.spacing(2) } |
| 31022 |
}; |
| 31023 |
}); |
| 31024 |
function AiPromotionInfotip(_ref2) { |
| 31025 |
var anchor = _ref2.anchor; |
| 31026 |
var content = _ref2.content; |
| 31027 |
var focusOutListener = _ref2.focusOutListener; |
| 31028 |
var placement = _ref2.placement; |
| 31029 |
var _ref2$offset = _ref2.offset; |
| 31030 |
var offset = _ref2$offset === void 0 ? { |
| 31031 |
x: 0, |
| 31032 |
y: 0 |
| 31033 |
} : _ref2$offset; |
| 31034 |
var positionRef = react.default.useRef({ |
| 31035 |
x: 0, |
| 31036 |
y: 0, |
| 31037 |
width: 0, |
| 31038 |
height: 0 |
| 31039 |
}); |
| 31040 |
var popperRef = react.default.useRef(null); |
| 31041 |
var showTooltip = function showTooltip() { |
| 31042 |
var _anchor$getBoundingCl = anchor.getBoundingClientRect(); |
| 31043 |
var x = _anchor$getBoundingCl.x; |
| 31044 |
var y = _anchor$getBoundingCl.y; |
| 31045 |
var width = _anchor$getBoundingCl.width; |
| 31046 |
var height = _anchor$getBoundingCl.height; |
| 31047 |
positionRef.current = { |
| 31048 |
x: x + offset.x, |
| 31049 |
y: y + offset.y, |
| 31050 |
width, |
| 31051 |
height |
| 31052 |
}; |
| 31053 |
if (null === popperRef.current) return; |
| 31054 |
popperRef.current.update(); |
| 31055 |
}; |
| 31056 |
react.default.useEffect(function() { |
| 31057 |
showTooltip(); |
| 31058 |
}, []); |
| 31059 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Tooltip, { |
| 31060 |
arrow: true, |
| 31061 |
open: true, |
| 31062 |
title: content, |
| 31063 |
placement: placement || "left", |
| 31064 |
PopperComponent: StyledPopper, |
| 31065 |
PopperProps: { |
| 31066 |
onClick: function onClick() { |
| 31067 |
return focusOutListener.reset(); |
| 31068 |
}, |
| 31069 |
popperRef, |
| 31070 |
anchorEl: { getBoundingClientRect: function getBoundingClientRect() { |
| 31071 |
return new DOMRect(positionRef.current.x, positionRef.current.y, positionRef.current.width, positionRef.current.height); |
| 31072 |
} } |
| 31073 |
} |
| 31074 |
}, /*#__PURE__*/ react.default.createElement("div", { style: { display: "none" } })); |
| 31075 |
} |
| 31076 |
AiPromotionInfotip.propTypes = { |
| 31077 |
anchor: import_prop_types$8.default.object.isRequired, |
| 31078 |
content: import_prop_types$8.default.object.isRequired, |
| 31079 |
focusOutListener: import_prop_types$8.default.object.isRequired, |
| 31080 |
placement: import_prop_types$8.default.string, |
| 31081 |
offset: import_prop_types$8.default.object |
| 31082 |
}; |
| 31083 |
|
| 31084 |
//#endregion |
| 31085 |
//#region modules/ai/assets/js/editor/components/ai-promotion-infotip-content.js |
| 31086 |
var AiPromotionInfotipContent = function AiPromotionInfotipContent(props) { |
| 31087 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.Card, { |
| 31088 |
sx: { width: 300 }, |
| 31089 |
elevation: 0 |
| 31090 |
}, /*#__PURE__*/ react.default.createElement(_elementor_ui.CardHeader, { subheader: "ELEMENTOR AI" }), /*#__PURE__*/ react.default.createElement(_elementor_ui.CardContent, { sx: { pt: 1 } }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, { |
| 31091 |
variant: "subtitle2", |
| 31092 |
color: "text.secondary", |
| 31093 |
sx: { pb: .5 } |
| 31094 |
}, props.header), /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, { |
| 31095 |
variant: "body2", |
| 31096 |
color: "text.secondary" |
| 31097 |
}, props.contentText)), /*#__PURE__*/ react.default.createElement(_elementor_ui.CardActions, { |
| 31098 |
disableSpacing: true, |
| 31099 |
sx: { |
| 31100 |
justifyContent: "flex-end", |
| 31101 |
gap: 1 |
| 31102 |
} |
| 31103 |
}, /*#__PURE__*/ react.default.createElement(_elementor_ui.Button, { |
| 31104 |
onClick: function onClick() { |
| 31105 |
return props.onClose(); |
| 31106 |
}, |
| 31107 |
color: "secondary" |
| 31108 |
}, (0, _wordpress_i18n.__)("Not Now", "elementor")), /*#__PURE__*/ react.default.createElement(_elementor_ui.Button, { |
| 31109 |
onClick: function onClick() { |
| 31110 |
return props.onClick(); |
| 31111 |
}, |
| 31112 |
variant: "contained" |
| 31113 |
}, props.mainActionText))); |
| 31114 |
}; |
| 31115 |
AiPromotionInfotipContent.propTypes = { |
| 31116 |
header: import_prop_types$8.default.string, |
| 31117 |
contentText: import_prop_types$8.default.string, |
| 31118 |
onClick: import_prop_types$8.default.func, |
| 31119 |
onClose: import_prop_types$8.default.func, |
| 31120 |
mainActionText: import_prop_types$8.default.string |
| 31121 |
}; |
| 31122 |
|
| 31123 |
//#endregion |
| 31124 |
//#region modules/ai/assets/js/editor/helpers/focus-out-listener.js |
| 31125 |
function FocusOutListener(_ref) { |
| 31126 |
var children = _ref.children; |
| 31127 |
var listener = _ref.listener; |
| 31128 |
var onFocusOut = _ref.onFocusOut; |
| 31129 |
var indicatorRef = listener.indicatorRef; |
| 31130 |
var reset = listener.reset; |
| 31131 |
var remove = listener.remove; |
| 31132 |
var runAction = listener.runAction; |
| 31133 |
react.useEffect(function() { |
| 31134 |
reset(); |
| 31135 |
return remove(); |
| 31136 |
}, []); |
| 31137 |
return /*#__PURE__*/ react.createElement(react.Fragment, null, children, /*#__PURE__*/ react.createElement("input", { |
| 31138 |
style: { |
| 31139 |
width: 0, |
| 31140 |
height: 0, |
| 31141 |
padding: 0, |
| 31142 |
margin: 0, |
| 31143 |
outline: 0, |
| 31144 |
border: 0, |
| 31145 |
opacity: 0, |
| 31146 |
position: "fixed" |
| 31147 |
}, |
| 31148 |
onFocus: remove, |
| 31149 |
onBlur: function onBlur() { |
| 31150 |
return runAction(onFocusOut); |
| 31151 |
}, |
| 31152 |
ref: indicatorRef |
| 31153 |
})); |
| 31154 |
} |
| 31155 |
function useFocusOutListener() { |
| 31156 |
var focusOutTimeout = react.useRef(null); |
| 31157 |
var indicatorRef = react.useRef(null); |
| 31158 |
return { |
| 31159 |
indicatorRef, |
| 31160 |
reset: function reset() { |
| 31161 |
var _indicatorRef$current; |
| 31162 |
return (_indicatorRef$current = indicatorRef.current) === null || _indicatorRef$current === void 0 ? void 0 : _indicatorRef$current.focus(); |
| 31163 |
}, |
| 31164 |
remove: function remove() { |
| 31165 |
return clearTimeout(focusOutTimeout.current); |
| 31166 |
}, |
| 31167 |
runAction: function runAction(callback) { |
| 31168 |
focusOutTimeout.current = setTimeout(callback, 250); |
| 31169 |
} |
| 31170 |
}; |
| 31171 |
} |
| 31172 |
FocusOutListener.propTypes = { |
| 31173 |
children: import_prop_types$8.default.node, |
| 31174 |
listener: import_prop_types$8.default.object, |
| 31175 |
onFocusOut: import_prop_types$8.default.func |
| 31176 |
}; |
| 31177 |
|
| 31178 |
//#endregion |
| 31179 |
//#region modules/ai/assets/js/editor/components/ai-promotion-infotip-wrapper.js |
| 31180 |
init_use_introduction(); |
| 31181 |
var AiPromotionInfotipWrapper = function AiPromotionInfotipWrapper(_ref) { |
| 31182 |
var anchor = _ref.anchor; |
| 31183 |
var header = _ref.header; |
| 31184 |
var contentText = _ref.contentText; |
| 31185 |
var controlType = _ref.controlType; |
| 31186 |
var unmountAction = _ref.unmountAction; |
| 31187 |
var colorScheme = _ref.colorScheme; |
| 31188 |
var isRTL = _ref.isRTL; |
| 31189 |
var clickAction = _ref.clickAction; |
| 31190 |
var placement = _ref.placement; |
| 31191 |
var offset = _ref.offset; |
| 31192 |
var mainActionText = _ref.mainActionText; |
| 31193 |
var source = _ref.source; |
| 31194 |
var _onFocusOut = _ref.onFocusOut; |
| 31195 |
var focusOutListener = useFocusOutListener(); |
| 31196 |
var _useIntroduction = useIntroduction("ai_get_started_introduction_".concat(controlType, "_").concat(source)); |
| 31197 |
var isViewed = _useIntroduction.isViewed; |
| 31198 |
var markAsViewed = _useIntroduction.markAsViewed; |
| 31199 |
if (isViewed) return; |
| 31200 |
return /*#__PURE__*/ react.default.createElement(_elementor_ui.DirectionProvider, { rtl: isRTL }, /*#__PURE__*/ react.default.createElement(_elementor_ui.ThemeProvider, { colorScheme }, /*#__PURE__*/ react.default.createElement(FocusOutListener, { |
| 31201 |
listener: focusOutListener, |
| 31202 |
onFocusOut: function onFocusOut() { |
| 31203 |
if (_onFocusOut) _onFocusOut(); |
| 31204 |
else { |
| 31205 |
markAsViewed(); |
| 31206 |
unmountAction(); |
| 31207 |
} |
| 31208 |
} |
| 31209 |
}, /*#__PURE__*/ react.default.createElement(AiPromotionInfotip, { |
| 31210 |
anchor, |
| 31211 |
focusOutListener, |
| 31212 |
placement, |
| 31213 |
offset, |
| 31214 |
content: /*#__PURE__*/ react.default.createElement(AiPromotionInfotipContent, { |
| 31215 |
focusOutListener, |
| 31216 |
header, |
| 31217 |
contentText, |
| 31218 |
mainActionText, |
| 31219 |
onClose: function onClose() { |
| 31220 |
markAsViewed(); |
| 31221 |
focusOutListener.remove(); |
| 31222 |
unmountAction(); |
| 31223 |
}, |
| 31224 |
onClick: function onClick() { |
| 31225 |
markAsViewed(); |
| 31226 |
focusOutListener.remove(); |
| 31227 |
unmountAction(); |
| 31228 |
if (clickAction) clickAction(); |
| 31229 |
else anchor.click(); |
| 31230 |
} |
| 31231 |
}) |
| 31232 |
})))); |
| 31233 |
}; |
| 31234 |
AiPromotionInfotipWrapper.propTypes = { |
| 31235 |
anchor: import_prop_types$8.default.object, |
| 31236 |
header: import_prop_types$8.default.string, |
| 31237 |
contentText: import_prop_types$8.default.string, |
| 31238 |
controlType: import_prop_types$8.default.string, |
| 31239 |
unmountAction: import_prop_types$8.default.func, |
| 31240 |
colorScheme: import_prop_types$8.default.string, |
| 31241 |
isRTL: import_prop_types$8.default.bool, |
| 31242 |
clickAction: import_prop_types$8.default.func, |
| 31243 |
placement: import_prop_types$8.default.string, |
| 31244 |
offset: import_prop_types$8.default.object, |
| 31245 |
mainActionText: import_prop_types$8.default.string, |
| 31246 |
source: import_prop_types$8.default.string, |
| 31247 |
onFocusOut: import_prop_types$8.default.func |
| 31248 |
}; |
| 31249 |
|
| 31250 |
//#endregion |
| 31251 |
//#region modules/ai/assets/js/editor/ai-get-started-connect.js |
| 31252 |
init_asyncToGenerator(); |
| 31253 |
init_slicedToArray(); |
| 31254 |
init_loader(); |
| 31255 |
init_api(); |
| 31256 |
function isElementInViewport(el) { |
| 31257 |
var rect = el.getBoundingClientRect(); |
| 31258 |
return rect.top >= 0 && rect.left >= 0 && rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && rect.right <= (window.innerWidth || document.documentElement.clientWidth); |
| 31259 |
} |
| 31260 |
var AiGetStartedConnect = function AiGetStartedConnect(_ref) { |
| 31261 |
var onClose = _ref.onClose; |
| 31262 |
var source = _ref.source; |
| 31263 |
var newHashOnConnect = _ref.newHashOnConnect; |
| 31264 |
var _useUserInfo = useUserInfo(); |
| 31265 |
var isLoading = _useUserInfo.isLoading; |
| 31266 |
var isConnected = _useUserInfo.isConnected; |
| 31267 |
var isGetStarted = _useUserInfo.isGetStarted; |
| 31268 |
var connectUrl = _useUserInfo.connectUrl; |
| 31269 |
var fetchData = _useUserInfo.fetchData; |
| 31270 |
var _useState2 = _slicedToArray((0, react.useState)(false), 2); |
| 31271 |
var shouldShowPromotion = _useState2[0]; |
| 31272 |
var setShouldShowPromotion = _useState2[1]; |
| 31273 |
(0, react.useEffect)(function() { |
| 31274 |
if (isGetStarted && isConnected) { |
| 31275 |
var element = elementorFrontend.elements.$body[0].querySelector(".e-ai-layout-button"); |
| 31276 |
if (!isElementInViewport(element)) element.scrollIntoView({ behavior: "smooth" }); |
| 31277 |
if (newHashOnConnect) window.location.hash = newHashOnConnect; |
| 31278 |
setTimeout(function() { |
| 31279 |
setShouldShowPromotion(true); |
| 31280 |
}, 1e3); |
| 31281 |
} |
| 31282 |
}, [isGetStarted, isConnected]); |
| 31283 |
if (isLoading) return /*#__PURE__*/ react.default.createElement(WizardDialogWrapper, { onClose }, /*#__PURE__*/ react.default.createElement(Loader, { BoxProps: { sx: { px: 3 } } })); |
| 31284 |
if (!isConnected || !isGetStarted) return /*#__PURE__*/ react.default.createElement(WizardDialogWrapper, { onClose }, /*#__PURE__*/ react.default.createElement(ConnectAndGetStarted, { |
| 31285 |
connectUrl, |
| 31286 |
isConnected, |
| 31287 |
getStartedAction: /*#__PURE__*/ _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee() { |
| 31288 |
return import_regenerator$2.default.wrap(function(_context) { |
| 31289 |
while (1) switch (_context.prev = _context.next) { |
| 31290 |
case 0: |
| 31291 |
_context.next = 1; |
| 31292 |
return setGetStarted(); |
| 31293 |
case 1: fetchData(); |
| 31294 |
case 2: |
| 31295 |
case "end": return _context.stop(); |
| 31296 |
} |
| 31297 |
}, _callee); |
| 31298 |
})), |
| 31299 |
onSuccess: /*#__PURE__*/ function() { |
| 31300 |
var _ref3 = _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee2(data) { |
| 31301 |
return import_regenerator$2.default.wrap(function(_context2) { |
| 31302 |
while (1) switch (_context2.prev = _context2.next) { |
| 31303 |
case 0: |
| 31304 |
onConnect(data); |
| 31305 |
fetchData(); |
| 31306 |
_context2.next = 1; |
| 31307 |
return setGetStarted(); |
| 31308 |
case 1: fetchData(); |
| 31309 |
case 2: |
| 31310 |
case "end": return _context2.stop(); |
| 31311 |
} |
| 31312 |
}, _callee2); |
| 31313 |
})); |
| 31314 |
return function(_x) { |
| 31315 |
return _ref3.apply(this, arguments); |
| 31316 |
}; |
| 31317 |
}() |
| 31318 |
})); |
| 31319 |
if (shouldShowPromotion) { |
| 31320 |
var _elementor; |
| 31321 |
var _elementor$getPrefere; |
| 31322 |
var element = window.elementorFrontend.elements.$body[0].querySelector(".e-ai-layout-button"); |
| 31323 |
var _document$querySelect = document.querySelector("#elementor-preview-iframe").getBoundingClientRect(); |
| 31324 |
var canvasOffsetX = _document$querySelect.x; |
| 31325 |
var canvasOffsetY = _document$querySelect.y; |
| 31326 |
return /*#__PURE__*/ react.default.createElement(AiPromotionInfotipWrapper, { |
| 31327 |
"test-id": "ai-promotion-infotip-wrapper", |
| 31328 |
source, |
| 31329 |
anchor: element, |
| 31330 |
clickAction: function clickAction() { |
| 31331 |
element.click(); |
| 31332 |
}, |
| 31333 |
header: (0, _wordpress_i18n.__)("Create any layout with a prompt", "elementor"), |
| 31334 |
contentText: (0, _wordpress_i18n.__)("Now you can generate any layout or container for your website’s design.", "elementor"), |
| 31335 |
mainActionText: (0, _wordpress_i18n.__)("Try it", "elementor"), |
| 31336 |
controlType: "container", |
| 31337 |
unmountAction: onClose, |
| 31338 |
colorScheme: ((_elementor = elementor) === null || _elementor === void 0 || (_elementor$getPrefere = _elementor.getPreferences) === null || _elementor$getPrefere === void 0 ? void 0 : _elementor$getPrefere.call(_elementor, "ui_theme")) || "auto", |
| 31339 |
isRTL: elementorCommon.config.isRTL, |
| 31340 |
placement: "top", |
| 31341 |
offset: { |
| 31342 |
x: canvasOffsetX, |
| 31343 |
y: canvasOffsetY |
| 31344 |
} |
| 31345 |
}); |
| 31346 |
} |
| 31347 |
}; |
| 31348 |
AiGetStartedConnect.propTypes = { |
| 31349 |
onClose: import_prop_types$8.default.func.isRequired, |
| 31350 |
source: import_prop_types$8.default.string.isRequired, |
| 31351 |
newHashOnConnect: import_prop_types$8.default.string |
| 31352 |
}; |
| 31353 |
|
| 31354 |
//#endregion |
| 31355 |
//#region modules/ai/assets/js/editor/integration/navigator/apply-ai-titles-to-navigator-behaviour.js |
| 31356 |
var ApplyAiTitlesNavigatorBehavior = Marionette.Behavior.extend({ |
| 31357 |
ui: { aiTitlesButton: "#elementor-navigator__ai-titles" }, |
| 31358 |
events: { "click @ui.aiTitlesButton": "aiTitleClickHandler" }, |
| 31359 |
initialize: function initialize() { |
| 31360 |
try { |
| 31361 |
this.getTemplate(); |
| 31362 |
} catch (e) { |
| 31363 |
this.hasTemplate = false; |
| 31364 |
} |
| 31365 |
}, |
| 31366 |
getTemplate: function getTemplate() { |
| 31367 |
var $button = jQuery("<button>", { id: "elementor-navigator__ai-titles" }); |
| 31368 |
$button.html("<i class=\"eicon-ai\"></i>"); |
| 31369 |
return $button[0].outerHTML; |
| 31370 |
}, |
| 31371 |
aiTitleClickHandler: function aiTitleClickHandler() { |
| 31372 |
window.location.hash = "welcome-ai-return-to-ai-titles"; |
| 31373 |
window.addEventListener("hashchange", this.handleHashChange.bind(this)); |
| 31374 |
}, |
| 31375 |
handleHashChange: function handleHashChange() { |
| 31376 |
var _elementorCommon$conf; |
| 31377 |
if ((_elementorCommon$conf = elementorCommon.config.library_connect) !== null && _elementorCommon$conf !== void 0 && _elementorCommon$conf.is_connected && window.location.hash.includes("ai-titles")) { |
| 31378 |
window.location.hash = ""; |
| 31379 |
window.location.reload(); |
| 31380 |
} |
| 31381 |
}, |
| 31382 |
onShow: function onShow() { |
| 31383 |
var _elementorCommon$conf2; |
| 31384 |
if ((_elementorCommon$conf2 = elementorCommon.config.library_connect) !== null && _elementorCommon$conf2 !== void 0 && _elementorCommon$conf2.is_connected) this.ui.aiTitlesButton.remove(); |
| 31385 |
else { |
| 31386 |
var $targetElement = this.view.$el.find("#elementor-navigator__toggle-all"); |
| 31387 |
if ($targetElement.length) $targetElement.after(this.getTemplate()); |
| 31388 |
} |
| 31389 |
} |
| 31390 |
}); |
| 31391 |
|
| 31392 |
//#endregion |
| 31393 |
//#region modules/ai/assets/js/editor/utils/ai-promotion.js |
| 31394 |
var addAiPromotionForSiteLogo = function addAiPromotionForSiteLogo() { |
| 31395 |
var siteLogoControl = document.querySelector(".elementor-control-site_logo"); |
| 31396 |
if (!siteLogoControl) return; |
| 31397 |
var logoButton = siteLogoControl.querySelector(".e-ai-button"); |
| 31398 |
if (!logoButton) return; |
| 31399 |
var rootElement = document.createElement("div"); |
| 31400 |
document.body.append(rootElement); |
| 31401 |
var _getUiConfig = getUiConfig(); |
| 31402 |
var colorScheme = _getUiConfig.colorScheme; |
| 31403 |
var isRTL = _getUiConfig.isRTL; |
| 31404 |
var unmount = react_default.render(/*#__PURE__*/ react.default.createElement(AiPromotionInfotipWrapper, { |
| 31405 |
anchor: logoButton, |
| 31406 |
header: (0, _wordpress_i18n.__)("Create a unique logo with AI", "elementor"), |
| 31407 |
contentText: (0, _wordpress_i18n.__)("Ready to stand out? Let AI turn your vision or idea into a unique, professional vector or logo with just a click.", "elementor"), |
| 31408 |
controlType: "site_logo_with_ai", |
| 31409 |
unmountAction: function unmountAction() { |
| 31410 |
unmount(); |
| 31411 |
rootElement.remove(); |
| 31412 |
}, |
| 31413 |
clickAction: function clickAction() { |
| 31414 |
logoButton.click(); |
| 31415 |
}, |
| 31416 |
onFocusOut: function onFocusOut() {}, |
| 31417 |
colorScheme, |
| 31418 |
isRTL, |
| 31419 |
placement: "right", |
| 31420 |
mainActionText: (0, _wordpress_i18n.__)("Give it a try", "elementor"), |
| 31421 |
source: "site-settings" |
| 31422 |
}), rootElement).unmount; |
| 31423 |
return true; |
| 31424 |
}; |
| 31425 |
|
| 31426 |
//#endregion |
| 31427 |
//#region modules/ai/assets/js/editor/module.js |
| 31428 |
init_objectWithoutProperties$1(); |
| 31429 |
init_defineProperty$1(); |
| 31430 |
init_asyncToGenerator(); |
| 31431 |
init_api(); |
| 31432 |
init_requests_ids(); |
| 31433 |
var _excluded = [ |
| 31434 |
"modalType", |
| 31435 |
"location", |
| 31436 |
"imageId", |
| 31437 |
"imageUrl", |
| 31438 |
"context" |
| 31439 |
]; |
| 31440 |
var _excluded2 = [ |
| 31441 |
"modalType", |
| 31442 |
"location", |
| 31443 |
"imageId", |
| 31444 |
"imageUrl", |
| 31445 |
"context", |
| 31446 |
"isExternalTrigger" |
| 31447 |
]; |
| 31448 |
function ownKeys(e, r) { |
| 31449 |
var t = Object.keys(e); |
| 31450 |
if (Object.getOwnPropertySymbols) { |
| 31451 |
var o = Object.getOwnPropertySymbols(e); |
| 31452 |
r && (o = o.filter(function(r) { |
| 31453 |
return Object.getOwnPropertyDescriptor(e, r).enumerable; |
| 31454 |
})), t.push.apply(t, o); |
| 31455 |
} |
| 31456 |
return t; |
| 31457 |
} |
| 31458 |
function _objectSpread(e) { |
| 31459 |
for (var r = 1; r < arguments.length; r++) { |
| 31460 |
var t = null != arguments[r] ? arguments[r] : {}; |
| 31461 |
r % 2 ? ownKeys(Object(t), !0).forEach(function(r) { |
| 31462 |
_defineProperty$1(e, r, t[r]); |
| 31463 |
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r) { |
| 31464 |
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); |
| 31465 |
}); |
| 31466 |
} |
| 31467 |
return e; |
| 31468 |
} |
| 31469 |
function _callSuper(t, o, e) { |
| 31470 |
return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); |
| 31471 |
} |
| 31472 |
function _isNativeReflectConstruct() { |
| 31473 |
try { |
| 31474 |
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})); |
| 31475 |
} catch (t) {} |
| 31476 |
return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { |
| 31477 |
return !!t; |
| 31478 |
})(); |
| 31479 |
} |
| 31480 |
setTimeout(/*#__PURE__*/ _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee() { |
| 31481 |
var _window$ElementorAiCo; |
| 31482 |
var config; |
| 31483 |
var script; |
| 31484 |
var _t; |
| 31485 |
return import_regenerator$2.default.wrap(function(_context) { |
| 31486 |
while (1) switch (_context.prev = _context.next) { |
| 31487 |
case 0: |
| 31488 |
if (!("1" !== ((_window$ElementorAiCo = window.ElementorAiConfig) === null || _window$ElementorAiCo === void 0 ? void 0 : _window$ElementorAiCo.is_get_started))) { |
| 31489 |
_context.next = 1; |
| 31490 |
break; |
| 31491 |
} |
| 31492 |
return _context.abrupt("return"); |
| 31493 |
case 1: |
| 31494 |
window.EDITOR_SESSION_ID = window.EDITOR_SESSION_ID || getUniqueId("elementor-editor-session"); |
| 31495 |
_context.prev = 2; |
| 31496 |
_context.next = 3; |
| 31497 |
return getRemoteFrontendConfig({ |
| 31498 |
client_name: "elementor-editor-loading", |
| 31499 |
client_version: elementorCommon.config.version, |
| 31500 |
client_session_id: window.EDITOR_SESSION_ID |
| 31501 |
}, true); |
| 31502 |
case 3: |
| 31503 |
config = _context.sent; |
| 31504 |
window.ElementorAIRemoteConfigData = config; |
| 31505 |
if (config !== null && config !== void 0 && config.remoteIntegrationUrl) { |
| 31506 |
script = document.createElement("script"); |
| 31507 |
script.type = "module"; |
| 31508 |
script.src = config.remoteIntegrationUrl; |
| 31509 |
document.head.appendChild(script); |
| 31510 |
} |
| 31511 |
_context.next = 5; |
| 31512 |
break; |
| 31513 |
case 4: |
| 31514 |
_context.prev = 4; |
| 31515 |
_t = _context["catch"](2); |
| 31516 |
console.error("Elementor AI Integration Loader", _t); |
| 31517 |
case 5: |
| 31518 |
case "end": return _context.stop(); |
| 31519 |
} |
| 31520 |
}, _callee, null, [[2, 4]]); |
| 31521 |
})), 0); |
| 31522 |
var Module = /*#__PURE__*/ function(_elementorModules$edi) { |
| 31523 |
function Module() { |
| 31524 |
_classCallCheck(this, Module); |
| 31525 |
return _callSuper(this, Module, arguments); |
| 31526 |
} |
| 31527 |
_inherits(Module, _elementorModules$edi); |
| 31528 |
return _createClass(Module, [ |
| 31529 |
{ |
| 31530 |
key: "onElementorInit", |
| 31531 |
value: function onElementorInit() { |
| 31532 |
elementor.hooks.addFilter("controls/base/behaviors", this.registerControlBehavior.bind(this)); |
| 31533 |
elementor.hooks.addFilter("navigator/layout/behaviors", this.registerNavigatorBehavior.bind(this)); |
| 31534 |
window.addEventListener(AI_EVENTS.SHOW_MODAL, this.handleAIModalEvent.bind(this)); |
| 31535 |
$e.routes.on("run:after", function(component, route) { |
| 31536 |
if ("panel/global/settings-site-identity" === route) addAiPromotionForSiteLogo(); |
| 31537 |
}); |
| 31538 |
window.addEventListener("hashchange", function(e) { |
| 31539 |
if (e.newURL.includes("welcome-ai")) { |
| 31540 |
var source = e.newURL.includes("welcome-ai-whats-new") ? "whats-new" : "connect"; |
| 31541 |
var returnTo = e.newURL.includes("return-to") ? e.newURL.split("return-to-")[1] : ""; |
| 31542 |
window.location.hash = ""; |
| 31543 |
setTimeout(function() { |
| 31544 |
var rootElement = document.createElement("div"); |
| 31545 |
document.body.append(rootElement); |
| 31546 |
var _getUiConfig = getUiConfig(); |
| 31547 |
var colorScheme = _getUiConfig.colorScheme; |
| 31548 |
var isRTL = _getUiConfig.isRTL; |
| 31549 |
var unmount = react_default.render(/*#__PURE__*/ react.default.createElement(LayoutAppWrapper, { |
| 31550 |
isRTL, |
| 31551 |
colorScheme |
| 31552 |
}, /*#__PURE__*/ react.default.createElement(AiGetStartedConnect, { |
| 31553 |
onClose: function onClose() { |
| 31554 |
unmount(); |
| 31555 |
rootElement.remove(); |
| 31556 |
}, |
| 31557 |
newHashOnConnect: returnTo, |
| 31558 |
source |
| 31559 |
})), rootElement).unmount; |
| 31560 |
}, 1e3); |
| 31561 |
} |
| 31562 |
}); |
| 31563 |
} |
| 31564 |
}, |
| 31565 |
{ |
| 31566 |
key: "registerNavigatorBehavior", |
| 31567 |
value: function registerNavigatorBehavior(behaviors) { |
| 31568 |
behaviors.ai = { behaviorClass: ApplyAiTitlesNavigatorBehavior }; |
| 31569 |
return behaviors; |
| 31570 |
} |
| 31571 |
}, |
| 31572 |
{ |
| 31573 |
key: "registerControlBehavior", |
| 31574 |
value: function registerControlBehavior(behaviors, view) { |
| 31575 |
var aiOptions = view.options.model.get("ai"); |
| 31576 |
if (!(aiOptions !== null && aiOptions !== void 0 && aiOptions.active)) return behaviors; |
| 31577 |
var controlType = view.options.model.get("type"); |
| 31578 |
if (["text", "textarea"].includes(aiOptions.type)) behaviors.ai = { |
| 31579 |
behaviorClass: AiBehavior, |
| 31580 |
controlType, |
| 31581 |
type: aiOptions.type, |
| 31582 |
getControlValue: view.getControlValue.bind(view), |
| 31583 |
setControlValue: function setControlValue(value) { |
| 31584 |
if ("wysiwyg" === controlType) value = value.replaceAll("\n", "<br>"); |
| 31585 |
view.setSettingsModel(value); |
| 31586 |
view.applySavedValue(); |
| 31587 |
}, |
| 31588 |
isLabelBlock: view.options.model.get("label_block"), |
| 31589 |
additionalOptions: { defaultValue: view.options.model.get("default") }, |
| 31590 |
context: this.getContextData(view, controlType) |
| 31591 |
}; |
| 31592 |
if (["code"].includes(aiOptions.type)) { |
| 31593 |
var _view$options; |
| 31594 |
var htmlMarkup = (_view$options = view.options) !== null && _view$options !== void 0 && (_view$options = _view$options.container) !== null && _view$options !== void 0 && (_view$options = _view$options.view) !== null && _view$options !== void 0 && _view$options.$el ? view.options.container.view.$el[0].outerHTML : ""; |
| 31595 |
behaviors.ai = { |
| 31596 |
behaviorClass: AiBehavior, |
| 31597 |
type: aiOptions.type, |
| 31598 |
additionalOptions: { |
| 31599 |
codeLanguage: (aiOptions === null || aiOptions === void 0 ? void 0 : aiOptions.language) || view.options.model.get("language"), |
| 31600 |
htmlMarkup, |
| 31601 |
elementId: view.options.container.id |
| 31602 |
}, |
| 31603 |
buttonLabel: (0, _wordpress_i18n.__)("Code with AI", "elementor"), |
| 31604 |
isLabelBlock: view.options.model.get("label_block"), |
| 31605 |
getControlValue: view.getControlValue.bind(view), |
| 31606 |
setControlValue: function setControlValue(value) { |
| 31607 |
return view.editor.setValue(value, -1); |
| 31608 |
}, |
| 31609 |
context: this.getContextData(view, controlType) |
| 31610 |
}; |
| 31611 |
} |
| 31612 |
if (["media"].includes(aiOptions.type)) { |
| 31613 |
var mediaTypes = view.options.model.get("media_types"); |
| 31614 |
var type = view.options.model.get("type"); |
| 31615 |
if (this.isAiImageGenerationEnabled(mediaTypes, type)) behaviors.ai = { |
| 31616 |
behaviorClass: AiBehavior, |
| 31617 |
type: aiOptions.type, |
| 31618 |
buttonLabel: (0, _wordpress_i18n.__)("Create with AI", "elementor"), |
| 31619 |
getControlValue: view.getControlValue.bind(view), |
| 31620 |
setControlValue: function setControlValue(image) { |
| 31621 |
view.setSettingsModel(image); |
| 31622 |
view.applySavedValue(); |
| 31623 |
}, |
| 31624 |
controlView: view, |
| 31625 |
additionalOptions: { |
| 31626 |
defaultValue: view.options.model.get("default"), |
| 31627 |
defaultImageType: (aiOptions === null || aiOptions === void 0 ? void 0 : aiOptions.category) || Object.keys(IMAGE_PROMPT_CATEGORIES)[1] |
| 31628 |
}, |
| 31629 |
context: this.getContextData(view, controlType) |
| 31630 |
}; |
| 31631 |
} |
| 31632 |
if ("excerpt" === aiOptions.type) behaviors.ai = { |
| 31633 |
behaviorClass: AiBehavior, |
| 31634 |
type: aiOptions.type, |
| 31635 |
getControlValue: view.getControlValue.bind(view), |
| 31636 |
setControlValue: function setControlValue(value) { |
| 31637 |
if ("wysiwyg" === controlType) value = value.replaceAll("\n", "<br>"); |
| 31638 |
view.setSettingsModel(value); |
| 31639 |
view.applySavedValue(); |
| 31640 |
}, |
| 31641 |
isLabelBlock: view.options.model.get("label_block"), |
| 31642 |
additionalOptions: { defaultValue: view.options.model.get("default") }, |
| 31643 |
context: this.getContextData(view, controlType) |
| 31644 |
}; |
| 31645 |
if (["animation", "hover_animation"].includes(aiOptions.type)) { |
| 31646 |
var _view$options$contain; |
| 31647 |
var widgetType = (_view$options$contain = view.options.container.model.get("widgetType")) !== null && _view$options$contain !== void 0 ? _view$options$contain : "container"; |
| 31648 |
behaviors = { ai: { |
| 31649 |
behaviorClass: AiBehavior, |
| 31650 |
type: aiOptions.type, |
| 31651 |
getControlValue: function getControlValue() { |
| 31652 |
var _elementor$widgetsCac; |
| 31653 |
var _elementor; |
| 31654 |
return Object.values((_elementor$widgetsCac = (_elementor = elementor) === null || _elementor === void 0 || (_elementor = _elementor.widgetsCache) === null || _elementor === void 0 || (_elementor = _elementor[widgetType]) === null || _elementor === void 0 ? void 0 : _elementor.controls) !== null && _elementor$widgetsCac !== void 0 ? _elementor$widgetsCac : []).filter(function(control) { |
| 31655 |
return "hover_animation" === aiOptions.type ? "_tab_positioning_hover" === control.inner_tab : "section_effects" === control.section; |
| 31656 |
}).map(function(control) { |
| 31657 |
return _defineProperty$1({}, control.name, view.options.container.settings.get(control.name)); |
| 31658 |
}).reduce(function(acc, control) { |
| 31659 |
return _objectSpread(_objectSpread({}, acc), control); |
| 31660 |
}, {}); |
| 31661 |
}, |
| 31662 |
buttonLabel: (0, _wordpress_i18n.__)("Animate with AI", "elementor"), |
| 31663 |
setControlValue: function setControlValue(settings) { |
| 31664 |
$e.run("document/elements/settings", { |
| 31665 |
container: view.container, |
| 31666 |
settings, |
| 31667 |
options: { external: true } |
| 31668 |
}); |
| 31669 |
}, |
| 31670 |
isLabelBlock: true, |
| 31671 |
additionalOptions: { |
| 31672 |
animationType: aiOptions.type, |
| 31673 |
widgetType, |
| 31674 |
buttonBorder: true |
| 31675 |
}, |
| 31676 |
context: this.getContextData(view, controlType) |
| 31677 |
} }; |
| 31678 |
} |
| 31679 |
return behaviors; |
| 31680 |
} |
| 31681 |
}, |
| 31682 |
{ |
| 31683 |
key: "getContextData", |
| 31684 |
value: function getContextData(view, controlType) { |
| 31685 |
var controlName = view.options.model.get("name"); |
| 31686 |
if (!view.options.container) return { |
| 31687 |
controlName, |
| 31688 |
controlType |
| 31689 |
}; |
| 31690 |
return { |
| 31691 |
documentType: view.options.container.document.config.type, |
| 31692 |
elementType: view.options.container.args.model.get("elType"), |
| 31693 |
elementId: view.options.container.id, |
| 31694 |
widgetType: view.options.container.args.model.get("widgetType"), |
| 31695 |
controlName, |
| 31696 |
controlType, |
| 31697 |
controlValue: view.options.container.settings.get(controlName) |
| 31698 |
}; |
| 31699 |
} |
| 31700 |
}, |
| 31701 |
{ |
| 31702 |
key: "isAiImageGenerationEnabled", |
| 31703 |
value: function isAiImageGenerationEnabled(mediaTypes, controlType) { |
| 31704 |
return mediaTypes.length && mediaTypes.includes("image") && !controlType.includes("media-preview"); |
| 31705 |
} |
| 31706 |
}, |
| 31707 |
{ |
| 31708 |
key: "handleAIModalEvent", |
| 31709 |
value: function handleAIModalEvent(event) { |
| 31710 |
var _event$detail = event.detail; |
| 31711 |
var modalType = _event$detail.modalType; |
| 31712 |
var location = _event$detail.location; |
| 31713 |
var imageId = _event$detail.imageId; |
| 31714 |
var imageUrl = _event$detail.imageUrl; |
| 31715 |
var context = _event$detail.context; |
| 31716 |
var additionalParams = _objectWithoutProperties$1(_event$detail, _excluded); |
| 31717 |
var targetLocation = location || modalType; |
| 31718 |
this.showAIModal(_objectSpread({ |
| 31719 |
modalType, |
| 31720 |
location: targetLocation, |
| 31721 |
imageId, |
| 31722 |
imageUrl, |
| 31723 |
context, |
| 31724 |
isExternalTrigger: true |
| 31725 |
}, additionalParams)); |
| 31726 |
} |
| 31727 |
}, |
| 31728 |
{ |
| 31729 |
key: "showAIModal", |
| 31730 |
value: function() { |
| 31731 |
var _showAIModal = _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee2(_ref3) { |
| 31732 |
var _location$toUpperCase; |
| 31733 |
var modalType; |
| 31734 |
var location; |
| 31735 |
var imageId; |
| 31736 |
var imageUrl; |
| 31737 |
var isExternalTrigger; |
| 31738 |
var additionalParams; |
| 31739 |
var aiBehavior; |
| 31740 |
return import_regenerator$2.default.wrap(function(_context2) { |
| 31741 |
while (1) switch (_context2.prev = _context2.next) { |
| 31742 |
case 0: |
| 31743 |
modalType = _ref3.modalType, location = _ref3.location, imageId = _ref3.imageId, imageUrl = _ref3.imageUrl, _ref3.context, isExternalTrigger = _ref3.isExternalTrigger, additionalParams = _objectWithoutProperties$1(_ref3, _excluded2); |
| 31744 |
aiBehavior = new AiBehavior({ |
| 31745 |
type: "media", |
| 31746 |
controlType: "media", |
| 31747 |
onCloseCallback: function onCloseCallback() { |
| 31748 |
window.dispatchEvent(new CustomEvent(AI_EVENTS.MODAL_CLOSED, { detail: { |
| 31749 |
success: false, |
| 31750 |
error: "User closed the modal manually without selecting an image" |
| 31751 |
} })); |
| 31752 |
}, |
| 31753 |
getControlValue: function getControlValue() { |
| 31754 |
if (imageId || imageUrl) return { |
| 31755 |
id: imageId ? parseInt(imageId, 10) : "", |
| 31756 |
url: imageUrl || "", |
| 31757 |
source: imageId ? "id" : "url" |
| 31758 |
}; |
| 31759 |
}, |
| 31760 |
setControlValue: function setControlValue(image) { |
| 31761 |
window.dispatchEvent(new CustomEvent(AI_EVENTS.MODAL_CLOSED, { detail: _objectSpread({ |
| 31762 |
modalType, |
| 31763 |
location, |
| 31764 |
success: true |
| 31765 |
}, image) })); |
| 31766 |
}, |
| 31767 |
additionalOptions: _objectSpread({ |
| 31768 |
defaultImageType: Object.keys(IMAGE_PROMPT_CATEGORIES)[1], |
| 31769 |
location: LOCATIONS[location === null || location === void 0 || (_location$toUpperCase = location.toUpperCase()) === null || _location$toUpperCase === void 0 ? void 0 : _location$toUpperCase.replace("-", "_")] || location, |
| 31770 |
isExternalTrigger, |
| 31771 |
hideBackButton: isExternalTrigger, |
| 31772 |
withoutHistory: isExternalTrigger, |
| 31773 |
hideAiBetaLogo: isExternalTrigger |
| 31774 |
}, additionalParams) |
| 31775 |
}); |
| 31776 |
aiBehavior.onAiButtonClick({ stopPropagation: function stopPropagation() {} }); |
| 31777 |
case 1: |
| 31778 |
case "end": return _context2.stop(); |
| 31779 |
} |
| 31780 |
}, _callee2); |
| 31781 |
})); |
| 31782 |
function showAIModal(_x) { |
| 31783 |
return _showAIModal.apply(this, arguments); |
| 31784 |
} |
| 31785 |
return showAIModal; |
| 31786 |
}() |
| 31787 |
} |
| 31788 |
]); |
| 31789 |
}(elementorModules.editor.utils.Module); |
| 31790 |
|
| 31791 |
//#endregion |
| 31792 |
//#region modules/ai/assets/js/editor/index.js |
| 31793 |
new Module(); |
| 31794 |
|
| 31795 |
//#endregion |
| 31796 |
})(ReactDOM, React, elementorV2.ui, wp.i18n, elementorV2.icons, elementorV2.ui['TextField']); |
| 31797 |
//# sourceMappingURL=ai.js.map |