| [ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 var __create = Object.create; 2 var __defProp = Object.defineProperty; 3 var __getOwnPropDesc = Object.getOwnPropertyDescriptor; 4 var __getOwnPropNames = Object.getOwnPropertyNames; 5 var __getProtoOf = Object.getPrototypeOf; 6 var __hasOwnProp = Object.prototype.hasOwnProperty; 7 var __commonJS = (cb, mod) => function __require() { 8 return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; 9 }; 10 var __export = (target, all) => { 11 for (var name in all) 12 __defProp(target, name, { get: all[name], enumerable: true }); 13 }; 14 var __copyProps = (to, from, except, desc) => { 15 if (from && typeof from === "object" || typeof from === "function") { 16 for (let key of __getOwnPropNames(from)) 17 if (!__hasOwnProp.call(to, key) && key !== except) 18 __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); 19 } 20 return to; 21 }; 22 var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( 23 // If the importer is in node compatibility mode or this is not an ESM 24 // file that has been converted to a CommonJS file using a Babel- 25 // compatible transform (i.e. "__esModule" has not been set), then set 26 // "default" to the CommonJS "module.exports" for node compatibility. 27 isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, 28 mod 29 )); 30 31 // package-external:@wordpress/i18n 32 var require_i18n = __commonJS({ 33 "package-external:@wordpress/i18n"(exports, module) { 34 module.exports = window.wp.i18n; 35 } 36 }); 37 38 // package-external:@wordpress/components 39 var require_components = __commonJS({ 40 "package-external:@wordpress/components"(exports, module) { 41 module.exports = window.wp.components; 42 } 43 }); 44 45 // vendor-external:react/jsx-runtime 46 var require_jsx_runtime = __commonJS({ 47 "vendor-external:react/jsx-runtime"(exports, module) { 48 module.exports = window.ReactJSXRuntime; 49 } 50 }); 51 52 // package-external:@wordpress/element 53 var require_element = __commonJS({ 54 "package-external:@wordpress/element"(exports, module) { 55 module.exports = window.wp.element; 56 } 57 }); 58 59 // vendor-external:react 60 var require_react = __commonJS({ 61 "vendor-external:react"(exports, module) { 62 module.exports = window.React; 63 } 64 }); 65 66 // package-external:@wordpress/primitives 67 var require_primitives = __commonJS({ 68 "package-external:@wordpress/primitives"(exports, module) { 69 module.exports = window.wp.primitives; 70 } 71 }); 72 73 // package-external:@wordpress/private-apis 74 var require_private_apis = __commonJS({ 75 "package-external:@wordpress/private-apis"(exports, module) { 76 module.exports = window.wp.privateApis; 77 } 78 }); 79 80 // package-external:@wordpress/data 81 var require_data = __commonJS({ 82 "package-external:@wordpress/data"(exports, module) { 83 module.exports = window.wp.data; 84 } 85 }); 86 87 // package-external:@wordpress/core-data 88 var require_core_data = __commonJS({ 89 "package-external:@wordpress/core-data"(exports, module) { 90 module.exports = window.wp.coreData; 91 } 92 }); 93 94 // package-external:@wordpress/notices 95 var require_notices = __commonJS({ 96 "package-external:@wordpress/notices"(exports, module) { 97 module.exports = window.wp.notices; 98 } 99 }); 100 101 // package-external:@wordpress/url 102 var require_url = __commonJS({ 103 "package-external:@wordpress/url"(exports, module) { 104 module.exports = window.wp.url; 105 } 106 }); 107 108 // node_modules/clsx/dist/clsx.mjs 109 function r(e) { 110 var t, f, n = ""; 111 if ("string" == typeof e || "number" == typeof e) n += e; 112 else if ("object" == typeof e) if (Array.isArray(e)) { 113 var o = e.length; 114 for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f); 115 } else for (f in e) e[f] && (n && (n += " "), n += f); 116 return n; 117 } 118 function clsx() { 119 for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t); 120 return n; 121 } 122 var clsx_default = clsx; 123 124 // packages/admin-ui/build-module/navigable-region/index.mjs 125 var import_element = __toESM(require_element(), 1); 126 var import_jsx_runtime = __toESM(require_jsx_runtime(), 1); 127 var NavigableRegion = (0, import_element.forwardRef)( 128 ({ children, className, ariaLabel, as: Tag = "div", ...props }, ref) => { 129 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)( 130 Tag, 131 { 132 ref, 133 className: clsx_default("admin-ui-navigable-region", className), 134 "aria-label": ariaLabel, 135 role: "region", 136 tabIndex: "-1", 137 ...props, 138 children 139 } 140 ); 141 } 142 ); 143 NavigableRegion.displayName = "NavigableRegion"; 144 var navigable_region_default = NavigableRegion; 145 146 // node_modules/@base-ui/utils/esm/useRefWithInit.js 147 var React2 = __toESM(require_react(), 1); 148 var UNINITIALIZED = {}; 149 function useRefWithInit(init, initArg) { 150 const ref = React2.useRef(UNINITIALIZED); 151 if (ref.current === UNINITIALIZED) { 152 ref.current = init(initArg); 153 } 154 return ref; 155 } 156 157 // node_modules/@base-ui/react/esm/utils/useRenderElement.js 158 var React5 = __toESM(require_react(), 1); 159 160 // node_modules/@base-ui/utils/esm/useMergedRefs.js 161 function useMergedRefs(a, b, c, d) { 162 const forkRef = useRefWithInit(createForkRef).current; 163 if (didChange(forkRef, a, b, c, d)) { 164 update(forkRef, [a, b, c, d]); 165 } 166 return forkRef.callback; 167 } 168 function useMergedRefsN(refs) { 169 const forkRef = useRefWithInit(createForkRef).current; 170 if (didChangeN(forkRef, refs)) { 171 update(forkRef, refs); 172 } 173 return forkRef.callback; 174 } 175 function createForkRef() { 176 return { 177 callback: null, 178 cleanup: null, 179 refs: [] 180 }; 181 } 182 function didChange(forkRef, a, b, c, d) { 183 return forkRef.refs[0] !== a || forkRef.refs[1] !== b || forkRef.refs[2] !== c || forkRef.refs[3] !== d; 184 } 185 function didChangeN(forkRef, newRefs) { 186 return forkRef.refs.length !== newRefs.length || forkRef.refs.some((ref, index) => ref !== newRefs[index]); 187 } 188 function update(forkRef, refs) { 189 forkRef.refs = refs; 190 if (refs.every((ref) => ref == null)) { 191 forkRef.callback = null; 192 return; 193 } 194 forkRef.callback = (instance) => { 195 if (forkRef.cleanup) { 196 forkRef.cleanup(); 197 forkRef.cleanup = null; 198 } 199 if (instance != null) { 200 const cleanupCallbacks = Array(refs.length).fill(null); 201 for (let i = 0; i < refs.length; i += 1) { 202 const ref = refs[i]; 203 if (ref == null) { 204 continue; 205 } 206 switch (typeof ref) { 207 case "function": { 208 const refCleanup = ref(instance); 209 if (typeof refCleanup === "function") { 210 cleanupCallbacks[i] = refCleanup; 211 } 212 break; 213 } 214 case "object": { 215 ref.current = instance; 216 break; 217 } 218 default: 219 } 220 } 221 forkRef.cleanup = () => { 222 for (let i = 0; i < refs.length; i += 1) { 223 const ref = refs[i]; 224 if (ref == null) { 225 continue; 226 } 227 switch (typeof ref) { 228 case "function": { 229 const cleanupCallback = cleanupCallbacks[i]; 230 if (typeof cleanupCallback === "function") { 231 cleanupCallback(); 232 } else { 233 ref(null); 234 } 235 break; 236 } 237 case "object": { 238 ref.current = null; 239 break; 240 } 241 default: 242 } 243 } 244 }; 245 } 246 }; 247 } 248 249 // node_modules/@base-ui/utils/esm/getReactElementRef.js 250 var React4 = __toESM(require_react(), 1); 251 252 // node_modules/@base-ui/utils/esm/reactVersion.js 253 var React3 = __toESM(require_react(), 1); 254 var majorVersion = parseInt(React3.version, 10); 255 function isReactVersionAtLeast(reactVersionToCheck) { 256 return majorVersion >= reactVersionToCheck; 257 } 258 259 // node_modules/@base-ui/utils/esm/getReactElementRef.js 260 function getReactElementRef(element) { 261 if (!/* @__PURE__ */ React4.isValidElement(element)) { 262 return null; 263 } 264 const reactElement = element; 265 const propsWithRef = reactElement.props; 266 return (isReactVersionAtLeast(19) ? propsWithRef?.ref : reactElement.ref) ?? null; 267 } 268 269 // node_modules/@base-ui/utils/esm/mergeObjects.js 270 function mergeObjects(a, b) { 271 if (a && !b) { 272 return a; 273 } 274 if (!a && b) { 275 return b; 276 } 277 if (a || b) { 278 return { 279 ...a, 280 ...b 281 }; 282 } 283 return void 0; 284 } 285 286 // node_modules/@base-ui/react/esm/utils/getStateAttributesProps.js 287 function getStateAttributesProps(state, customMapping) { 288 const props = {}; 289 for (const key in state) { 290 const value = state[key]; 291 if (customMapping?.hasOwnProperty(key)) { 292 const customProps = customMapping[key](value); 293 if (customProps != null) { 294 Object.assign(props, customProps); 295 } 296 continue; 297 } 298 if (value === true) { 299 props[`data-$key.toLowerCase()}`] = ""; 300 } else if (value) { 301 props[`data-$key.toLowerCase()}`] = value.toString(); 302 } 303 } 304 return props; 305 } 306 307 // node_modules/@base-ui/react/esm/utils/resolveClassName.js 308 function resolveClassName(className, state) { 309 return typeof className === "function" ? className(state) : className; 310 } 311 312 // node_modules/@base-ui/react/esm/utils/resolveStyle.js 313 function resolveStyle(style, state) { 314 return typeof style === "function" ? style(state) : style; 315 } 316 317 // node_modules/@base-ui/react/esm/merge-props/mergeProps.js 318 var EMPTY_PROPS = {}; 319 function mergeProps(a, b, c, d, e) { 320 let merged = { 321 ...resolvePropsGetter(a, EMPTY_PROPS) 322 }; 323 if (b) { 324 merged = mergeOne(merged, b); 325 } 326 if (c) { 327 merged = mergeOne(merged, c); 328 } 329 if (d) { 330 merged = mergeOne(merged, d); 331 } 332 if (e) { 333 merged = mergeOne(merged, e); 334 } 335 return merged; 336 } 337 function mergePropsN(props) { 338 if (props.length === 0) { 339 return EMPTY_PROPS; 340 } 341 if (props.length === 1) { 342 return resolvePropsGetter(props[0], EMPTY_PROPS); 343 } 344 let merged = { 345 ...resolvePropsGetter(props[0], EMPTY_PROPS) 346 }; 347 for (let i = 1; i < props.length; i += 1) { 348 merged = mergeOne(merged, props[i]); 349 } 350 return merged; 351 } 352 function mergeOne(merged, inputProps) { 353 if (isPropsGetter(inputProps)) { 354 return inputProps(merged); 355 } 356 return mutablyMergeInto(merged, inputProps); 357 } 358 function mutablyMergeInto(mergedProps, externalProps) { 359 if (!externalProps) { 360 return mergedProps; 361 } 362 for (const propName in externalProps) { 363 const externalPropValue = externalProps[propName]; 364 switch (propName) { 365 case "style": { 366 mergedProps[propName] = mergeObjects(mergedProps.style, externalPropValue); 367 break; 368 } 369 case "className": { 370 mergedProps[propName] = mergeClassNames(mergedProps.className, externalPropValue); 371 break; 372 } 373 default: { 374 if (isEventHandler(propName, externalPropValue)) { 375 mergedProps[propName] = mergeEventHandlers(mergedProps[propName], externalPropValue); 376 } else { 377 mergedProps[propName] = externalPropValue; 378 } 379 } 380 } 381 } 382 return mergedProps; 383 } 384 function isEventHandler(key, value) { 385 const code0 = key.charCodeAt(0); 386 const code1 = key.charCodeAt(1); 387 const code2 = key.charCodeAt(2); 388 return code0 === 111 && code1 === 110 && code2 >= 65 && code2 <= 90 && (typeof value === "function" || typeof value === "undefined"); 389 } 390 function isPropsGetter(inputProps) { 391 return typeof inputProps === "function"; 392 } 393 function resolvePropsGetter(inputProps, previousProps) { 394 if (isPropsGetter(inputProps)) { 395 return inputProps(previousProps); 396 } 397 return inputProps ?? EMPTY_PROPS; 398 } 399 function mergeEventHandlers(ourHandler, theirHandler) { 400 if (!theirHandler) { 401 return ourHandler; 402 } 403 if (!ourHandler) { 404 return theirHandler; 405 } 406 return (event) => { 407 if (isSyntheticEvent(event)) { 408 const baseUIEvent = event; 409 makeEventPreventable(baseUIEvent); 410 const result2 = theirHandler(baseUIEvent); 411 if (!baseUIEvent.baseUIHandlerPrevented) { 412 ourHandler?.(baseUIEvent); 413 } 414 return result2; 415 } 416 const result = theirHandler(event); 417 ourHandler?.(event); 418 return result; 419 }; 420 } 421 function makeEventPreventable(event) { 422 event.preventBaseUIHandler = () => { 423 event.baseUIHandlerPrevented = true; 424 }; 425 return event; 426 } 427 function mergeClassNames(ourClassName, theirClassName) { 428 if (theirClassName) { 429 if (ourClassName) { 430 return theirClassName + " " + ourClassName; 431 } 432 return theirClassName; 433 } 434 return ourClassName; 435 } 436 function isSyntheticEvent(event) { 437 return event != null && typeof event === "object" && "nativeEvent" in event; 438 } 439 440 // node_modules/@base-ui/utils/esm/empty.js 441 var EMPTY_ARRAY = Object.freeze([]); 442 var EMPTY_OBJECT = Object.freeze({}); 443 444 // node_modules/@base-ui/react/esm/utils/useRenderElement.js 445 var import_react = __toESM(require_react(), 1); 446 function useRenderElement(element, componentProps, params = {}) { 447 const renderProp = componentProps.render; 448 const outProps = useRenderElementProps(componentProps, params); 449 if (params.enabled === false) { 450 return null; 451 } 452 const state = params.state ?? EMPTY_OBJECT; 453 return evaluateRenderProp(element, renderProp, outProps, state); 454 } 455 function useRenderElementProps(componentProps, params = {}) { 456 const { 457 className: classNameProp, 458 style: styleProp, 459 render: renderProp 460 } = componentProps; 461 const { 462 state = EMPTY_OBJECT, 463 ref, 464 props, 465 stateAttributesMapping, 466 enabled = true 467 } = params; 468 const className = enabled ? resolveClassName(classNameProp, state) : void 0; 469 const style = enabled ? resolveStyle(styleProp, state) : void 0; 470 const stateProps = enabled ? getStateAttributesProps(state, stateAttributesMapping) : EMPTY_OBJECT; 471 const outProps = enabled ? mergeObjects(stateProps, Array.isArray(props) ? mergePropsN(props) : props) ?? EMPTY_OBJECT : EMPTY_OBJECT; 472 if (typeof document !== "undefined") { 473 if (!enabled) { 474 useMergedRefs(null, null); 475 } else if (Array.isArray(ref)) { 476 outProps.ref = useMergedRefsN([outProps.ref, getReactElementRef(renderProp), ...ref]); 477 } else { 478 outProps.ref = useMergedRefs(outProps.ref, getReactElementRef(renderProp), ref); 479 } 480 } 481 if (!enabled) { 482 return EMPTY_OBJECT; 483 } 484 if (className !== void 0) { 485 outProps.className = mergeClassNames(outProps.className, className); 486 } 487 if (style !== void 0) { 488 outProps.style = mergeObjects(outProps.style, style); 489 } 490 return outProps; 491 } 492 function evaluateRenderProp(element, render, props, state) { 493 if (render) { 494 if (typeof render === "function") { 495 return render(props, state); 496 } 497 const mergedProps = mergeProps(props, render.props); 498 mergedProps.ref = props.ref; 499 return /* @__PURE__ */ React5.cloneElement(render, mergedProps); 500 } 501 if (element) { 502 if (typeof element === "string") { 503 return renderTag(element, props); 504 } 505 } 506 throw new Error(true ? "Base UI: Render element or function are not defined." : formatErrorMessage(8)); 507 } 508 function renderTag(Tag, props) { 509 if (Tag === "button") { 510 return /* @__PURE__ */ (0, import_react.createElement)("button", { 511 type: "button", 512 ...props, 513 key: props.key 514 }); 515 } 516 if (Tag === "img") { 517 return /* @__PURE__ */ (0, import_react.createElement)("img", { 518 alt: "", 519 ...props, 520 key: props.key 521 }); 522 } 523 return /* @__PURE__ */ React5.createElement(Tag, props); 524 } 525 526 // node_modules/@base-ui/react/esm/use-render/useRender.js 527 function useRender(params) { 528 return useRenderElement(params.defaultTagName ?? "div", params, params); 529 } 530 531 // packages/ui/build-module/badge/badge.mjs 532 var import_element2 = __toESM(require_element(), 1); 533 if (typeof document !== "undefined" && !document.head.querySelector("style[data-wp-hash='244b5c59c0']")) { 534 const style = document.createElement("style"); 535 style.setAttribute("data-wp-hash", "244b5c59c0"); 536 style.appendChild(document.createTextNode('@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._96e6251aad1a6136__badge{border-radius:var(--wpds-border-radius-lg,8px);font-family:var(--wpds-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-font-size-sm,12px);font-weight:var(--wpds-font-weight-regular,400);line-height:var(--wpds-font-line-height-xs,16px);padding-block:var(--wpds-dimension-padding-xs,4px);padding-inline:var(--wpds-dimension-padding-sm,8px)}._99f7158cb520f750__is-high-intent{background-color:var(--wpds-color-bg-surface-error,#f6e6e3);color:var(--wpds-color-fg-content-error,#470000)}.c20ebef2365bc8b7__is-medium-intent{background-color:var(--wpds-color-bg-surface-warning,#fde6bd);color:var(--wpds-color-fg-content-warning,#2e1900)}._365e1626c6202e52__is-low-intent{background-color:var(--wpds-color-bg-surface-caution,#fee994);color:var(--wpds-color-fg-content-caution,#281d00)}._33f8198127ddf4ef__is-stable-intent{background-color:var(--wpds-color-bg-surface-success,#c5f7cc);color:var(--wpds-color-fg-content-success,#002900)}._04c1aca8fc449412__is-informational-intent{background-color:var(--wpds-color-bg-surface-info,#deebfa);color:var(--wpds-color-fg-content-info,#001b4f)}._90726e69d495ec19__is-draft-intent{background-color:var(--wpds-color-bg-surface-neutral-weak,#f0f0f0);color:var(--wpds-color-fg-content-neutral,#1e1e1e)}._898f4a544993bd39__is-none-intent{background-color:var(--wpds-color-bg-surface-neutral,#f8f8f8);color:var(--wpds-color-fg-content-neutral-weak,#6d6d6d)}}')); 537 document.head.appendChild(style); 538 } 539 var style_default = { "badge": "_96e6251aad1a6136__badge", "is-high-intent": "_99f7158cb520f750__is-high-intent", "is-medium-intent": "c20ebef2365bc8b7__is-medium-intent", "is-low-intent": "_365e1626c6202e52__is-low-intent", "is-stable-intent": "_33f8198127ddf4ef__is-stable-intent", "is-informational-intent": "_04c1aca8fc449412__is-informational-intent", "is-draft-intent": "_90726e69d495ec19__is-draft-intent", "is-none-intent": "_898f4a544993bd39__is-none-intent" }; 540 var Badge = (0, import_element2.forwardRef)(function Badge2({ children, intent = "none", render, className, ...props }, ref) { 541 const element = useRender({ 542 render, 543 defaultTagName: "span", 544 ref, 545 props: mergeProps(props, { 546 className: clsx_default( 547 style_default.badge, 548 style_default[`is-$intent}-intent`], 549 className 550 ), 551 children 552 }) 553 }); 554 return element; 555 }); 556 557 // packages/ui/build-module/icon/icon.mjs 558 var import_element3 = __toESM(require_element(), 1); 559 var import_primitives = __toESM(require_primitives(), 1); 560 var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1); 561 var Icon = (0, import_element3.forwardRef)(function Icon2({ icon, size = 24, ...restProps }, ref) { 562 return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)( 563 import_primitives.SVG, 564 { 565 ref, 566 fill: "currentColor", 567 ...icon.props, 568 ...restProps, 569 width: size, 570 height: size 571 } 572 ); 573 }); 574 575 // packages/icons/build-module/library/caution.mjs 576 var import_primitives2 = __toESM(require_primitives(), 1); 577 var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1); 578 var caution_default = /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_primitives2.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_primitives2.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M5.5 12a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0ZM12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Zm-.75 12v-1.5h1.5V16h-1.5Zm0-8v5h1.5V8h-1.5Z" }) }); 579 580 // packages/icons/build-module/library/error.mjs 581 var import_primitives3 = __toESM(require_primitives(), 1); 582 var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1); 583 var error_default = /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_primitives3.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_primitives3.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M12.218 5.377a.25.25 0 0 0-.436 0l-7.29 12.96a.25.25 0 0 0 .218.373h14.58a.25.25 0 0 0 .218-.372l-7.29-12.96Zm-1.743-.735c.669-1.19 2.381-1.19 3.05 0l7.29 12.96a1.75 1.75 0 0 1-1.525 2.608H4.71a1.75 1.75 0 0 1-1.525-2.608l7.29-12.96ZM12.75 17.46h-1.5v-1.5h1.5v1.5Zm-1.5-3h1.5v-5h-1.5v5Z" }) }); 584 585 // packages/icons/build-module/library/info.mjs 586 var import_primitives4 = __toESM(require_primitives(), 1); 587 var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1); 588 var info_default = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_primitives4.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_primitives4.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M5.5 12a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0ZM12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Zm.75 4v1.5h-1.5V8h1.5Zm0 8v-5h-1.5v5h1.5Z" }) }); 589 590 // packages/icons/build-module/library/published.mjs 591 var import_primitives5 = __toESM(require_primitives(), 1); 592 var import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1); 593 var published_default = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_primitives5.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_primitives5.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm11.53-1.47-1.06-1.06L11 12.94l-1.47-1.47-1.06 1.06L11 15.06l4.53-4.53Z" }) }); 594 595 // packages/ui/build-module/stack/stack.mjs 596 var import_element4 = __toESM(require_element(), 1); 597 if (typeof document !== "undefined" && !document.head.querySelector("style[data-wp-hash='71d20935c2']")) { 598 const style = document.createElement("style"); 599 style.setAttribute("data-wp-hash", "71d20935c2"); 600 style.appendChild(document.createTextNode("@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._19ce0419607e1896__stack{display:flex}}")); 601 document.head.appendChild(style); 602 } 603 var style_default2 = { "stack": "_19ce0419607e1896__stack" }; 604 var gapTokens = { 605 xs: "var(--wpds-dimension-gap-xs, 4px)", 606 sm: "var(--wpds-dimension-gap-sm, 8px)", 607 md: "var(--wpds-dimension-gap-md, 12px)", 608 lg: "var(--wpds-dimension-gap-lg, 16px)", 609 xl: "var(--wpds-dimension-gap-xl, 24px)", 610 "2xl": "var(--wpds-dimension-gap-2xl, 32px)", 611 "3xl": "var(--wpds-dimension-gap-3xl, 40px)" 612 }; 613 var Stack = (0, import_element4.forwardRef)(function Stack2({ direction, gap, align, justify, wrap, render, ...props }, ref) { 614 const style = { 615 gap: gap && gapTokens[gap], 616 alignItems: align, 617 justifyContent: justify, 618 flexDirection: direction, 619 flexWrap: wrap 620 }; 621 const element = useRender({ 622 render, 623 ref, 624 props: mergeProps(props, { style, className: style_default2.stack }) 625 }); 626 return element; 627 }); 628 629 // packages/ui/build-module/notice/index.mjs 630 var notice_exports = {}; 631 __export(notice_exports, { 632 Description: () => Description, 633 Root: () => Root 634 }); 635 636 // packages/ui/build-module/notice/root.mjs 637 var import_element5 = __toESM(require_element(), 1); 638 import { speak } from "@wordpress/a11y"; 639 var import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1); 640 if (typeof document !== "undefined" && !document.head.querySelector("style[data-wp-hash='671ebfc62d']")) { 641 const style = document.createElement("style"); 642 style.setAttribute("data-wp-hash", "671ebfc62d"); 643 style.appendChild(document.createTextNode("@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}")); 644 document.head.appendChild(style); 645 } 646 var resets_default = { "box-sizing": "_336cd3e4e743482f__box-sizing" }; 647 if (typeof document !== "undefined" && !document.head.querySelector("style[data-wp-hash='a66a881fc5']")) { 648 const style = document.createElement("style"); 649 style.setAttribute("data-wp-hash", "a66a881fc5"); 650 style.appendChild(document.createTextNode("@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._4145abab73d17514__notice{--icon-height:24px;--text-vertical-padding:calc((var(--icon-height) - var(--wpds-font-line-height-sm, 20px))/2);--wp-ui-notice-background-color:var(--wpds-color-bg-surface-neutral-weak,#f0f0f0);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-neutral,#d8d8d8);--wp-ui-notice-text-color:var(--wpds-color-fg-content-neutral,#1e1e1e);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-neutral,#1e1e1e);align-items:start;background-color:var(--wp-ui-notice-background-color);border:1px solid var(--wp-ui-notice-border-color);border-radius:var(--wpds-border-radius-lg,8px);container-type:inline-size;display:grid;grid-template-columns:auto 1fr auto;padding:var(--wpds-dimension-padding-md,12px)}.d0a25570cb528528__icon{color:var(--wp-ui-notice-decorative-icon-color);grid-column:1;grid-row:1;margin-inline-end:var(--wpds-dimension-gap-xs,4px)}._1904b570a89bb815__description{text-wrap:pretty;color:var(--wp-ui-notice-text-color);grid-column:2;padding-block:var(--text-vertical-padding)}._531c140826094795__is-info{--wp-ui-notice-background-color:var(--wpds-color-bg-surface-info-weak,#f2f9ff);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-info,#9fbcdc);--wp-ui-notice-text-color:var(--wpds-color-fg-content-info,#001b4f);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-info-weak,#006bd7)}.ae2e1004697cce95__is-warning{--wp-ui-notice-background-color:var(--wpds-color-bg-surface-warning-weak,#fff7e0);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-warning,#d0b381);--wp-ui-notice-text-color:var(--wpds-color-fg-content-warning,#2e1900);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-warning-weak,#926300)}._2e614a76af494837__is-success{--wp-ui-notice-background-color:var(--wpds-color-bg-surface-success-weak,#eaffed);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-success,#8ac894);--wp-ui-notice-text-color:var(--wpds-color-fg-content-success,#002900);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-success-weak,#007f30)}.af00331ae17a0065__is-error{--wp-ui-notice-background-color:var(--wpds-color-bg-surface-error-weak,#fff6f4);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-error,#daa39b);--wp-ui-notice-text-color:var(--wpds-color-fg-content-error,#470000);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-error-weak,#cc1818)}}")); 651 document.head.appendChild(style); 652 } 653 var style_default3 = { "notice": "_4145abab73d17514__notice", "icon": "d0a25570cb528528__icon", "description": "_1904b570a89bb815__description", "is-info": "_531c140826094795__is-info", "is-warning": "ae2e1004697cce95__is-warning", "is-success": "_2e614a76af494837__is-success", "is-error": "af00331ae17a0065__is-error" }; 654 var icons = { 655 neutral: null, 656 info: info_default, 657 warning: caution_default, 658 success: published_default, 659 error: error_default 660 }; 661 function getDefaultPoliteness(intent) { 662 return intent === "error" ? "assertive" : "polite"; 663 } 664 function safeRenderToString(message) { 665 if (!message) { 666 return void 0; 667 } 668 if (typeof message === "string") { 669 return message; 670 } 671 try { 672 return (0, import_element5.renderToString)(message); 673 } catch { 674 return void 0; 675 } 676 } 677 function useSpokenMessage(message, politeness) { 678 const spokenMessage = safeRenderToString(message); 679 (0, import_element5.useEffect)(() => { 680 if (spokenMessage) { 681 speak(spokenMessage, politeness); 682 } 683 }, [spokenMessage, politeness]); 684 } 685 var Root = (0, import_element5.forwardRef)(function Notice({ 686 intent = "neutral", 687 children, 688 icon, 689 spokenMessage = children, 690 politeness = getDefaultPoliteness(intent), 691 render, 692 ...restProps 693 }, ref) { 694 useSpokenMessage(spokenMessage, politeness); 695 const iconElement = icon === null ? null : icon ?? icons[intent]; 696 const mergedClassName = clsx_default( 697 style_default3.notice, 698 style_default3[`is-$intent}`], 699 resets_default["box-sizing"] 700 ); 701 const element = useRender({ 702 defaultTagName: "div", 703 render, 704 ref, 705 props: mergeProps( 706 { 707 className: mergedClassName, 708 children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [ 709 children, 710 iconElement && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)( 711 Icon, 712 { 713 className: style_default3.icon, 714 icon: iconElement 715 } 716 ) 717 ] }) 718 }, 719 restProps 720 ) 721 }); 722 return element; 723 }); 724 725 // packages/ui/build-module/notice/description.mjs 726 var import_element7 = __toESM(require_element(), 1); 727 728 // packages/ui/build-module/text/text.mjs 729 var import_element6 = __toESM(require_element(), 1); 730 if (typeof document !== "undefined" && !document.head.querySelector("style[data-wp-hash='6675f7d310']")) { 731 const style = document.createElement("style"); 732 style.setAttribute("data-wp-hash", "6675f7d310"); 733 style.appendChild(document.createTextNode('@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._83ed8a8da5dd50ea__text{margin:0}._14437cfb77831647__heading-2xl{font-size:var(--wpds-font-size-2xl,32px);line-height:var(--wpds-font-line-height-2xl,40px)}._14437cfb77831647__heading-2xl,._3c78b7fa9b4072dd__heading-xl{font-family:var(--wpds-font-family-heading,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-font-weight-medium,499)}._3c78b7fa9b4072dd__heading-xl{font-size:var(--wpds-font-size-xl,20px);line-height:var(--wpds-font-line-height-md,24px)}.aa58f227716bcde2__heading-lg{font-size:var(--wpds-font-size-lg,15px)}.aa58f227716bcde2__heading-lg,.fc4da56d8dfe52c4__heading-md{font-family:var(--wpds-font-family-heading,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-font-weight-medium,499);line-height:var(--wpds-font-line-height-sm,20px)}.fc4da56d8dfe52c4__heading-md{font-size:var(--wpds-font-size-md,13px)}.a9b78c7c82e8dff7__heading-sm{font-family:var(--wpds-font-family-heading,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-font-size-xs,11px);font-weight:var(--wpds-font-weight-medium,499);line-height:var(--wpds-font-line-height-xs,16px);text-transform:uppercase}._305ff559e52180d5__body-xl{font-size:var(--wpds-font-size-xl,20px);line-height:var(--wpds-font-line-height-xl,32px)}._305ff559e52180d5__body-xl,.ca1aa3fc2029e958__body-lg{font-family:var(--wpds-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-font-weight-regular,400)}.ca1aa3fc2029e958__body-lg{font-size:var(--wpds-font-size-lg,15px);line-height:var(--wpds-font-line-height-md,24px)}._131101940be12424__body-md{font-size:var(--wpds-font-size-md,13px);line-height:var(--wpds-font-line-height-sm,20px)}._0e8d87a42c1f75fa__body-sm,._131101940be12424__body-md{font-family:var(--wpds-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-font-weight-regular,400)}._0e8d87a42c1f75fa__body-sm{font-size:var(--wpds-font-size-sm,12px);line-height:var(--wpds-font-line-height-xs,16px)}}')); 734 document.head.appendChild(style); 735 } 736 var style_default4 = { "text": "_83ed8a8da5dd50ea__text", "heading-2xl": "_14437cfb77831647__heading-2xl", "heading-xl": "_3c78b7fa9b4072dd__heading-xl", "heading-lg": "aa58f227716bcde2__heading-lg", "heading-md": "fc4da56d8dfe52c4__heading-md", "heading-sm": "a9b78c7c82e8dff7__heading-sm", "body-xl": "_305ff559e52180d5__body-xl", "body-lg": "ca1aa3fc2029e958__body-lg", "body-md": "_131101940be12424__body-md", "body-sm": "_0e8d87a42c1f75fa__body-sm" }; 737 var Text = (0, import_element6.forwardRef)(function Text2({ variant = "body-md", render, className, ...props }, ref) { 738 const element = useRender({ 739 render, 740 defaultTagName: "span", 741 ref, 742 props: mergeProps(props, { 743 className: clsx_default(style_default4.text, style_default4[variant], className) 744 }) 745 }); 746 return element; 747 }); 748 749 // packages/ui/build-module/notice/description.mjs 750 var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1); 751 if (typeof document !== "undefined" && !document.head.querySelector("style[data-wp-hash='a66a881fc5']")) { 752 const style = document.createElement("style"); 753 style.setAttribute("data-wp-hash", "a66a881fc5"); 754 style.appendChild(document.createTextNode("@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._4145abab73d17514__notice{--icon-height:24px;--text-vertical-padding:calc((var(--icon-height) - var(--wpds-font-line-height-sm, 20px))/2);--wp-ui-notice-background-color:var(--wpds-color-bg-surface-neutral-weak,#f0f0f0);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-neutral,#d8d8d8);--wp-ui-notice-text-color:var(--wpds-color-fg-content-neutral,#1e1e1e);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-neutral,#1e1e1e);align-items:start;background-color:var(--wp-ui-notice-background-color);border:1px solid var(--wp-ui-notice-border-color);border-radius:var(--wpds-border-radius-lg,8px);container-type:inline-size;display:grid;grid-template-columns:auto 1fr auto;padding:var(--wpds-dimension-padding-md,12px)}.d0a25570cb528528__icon{color:var(--wp-ui-notice-decorative-icon-color);grid-column:1;grid-row:1;margin-inline-end:var(--wpds-dimension-gap-xs,4px)}._1904b570a89bb815__description{text-wrap:pretty;color:var(--wp-ui-notice-text-color);grid-column:2;padding-block:var(--text-vertical-padding)}._531c140826094795__is-info{--wp-ui-notice-background-color:var(--wpds-color-bg-surface-info-weak,#f2f9ff);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-info,#9fbcdc);--wp-ui-notice-text-color:var(--wpds-color-fg-content-info,#001b4f);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-info-weak,#006bd7)}.ae2e1004697cce95__is-warning{--wp-ui-notice-background-color:var(--wpds-color-bg-surface-warning-weak,#fff7e0);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-warning,#d0b381);--wp-ui-notice-text-color:var(--wpds-color-fg-content-warning,#2e1900);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-warning-weak,#926300)}._2e614a76af494837__is-success{--wp-ui-notice-background-color:var(--wpds-color-bg-surface-success-weak,#eaffed);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-success,#8ac894);--wp-ui-notice-text-color:var(--wpds-color-fg-content-success,#002900);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-success-weak,#007f30)}.af00331ae17a0065__is-error{--wp-ui-notice-background-color:var(--wpds-color-bg-surface-error-weak,#fff6f4);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-error,#daa39b);--wp-ui-notice-text-color:var(--wpds-color-fg-content-error,#470000);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-error-weak,#cc1818)}}")); 755 document.head.appendChild(style); 756 } 757 var style_default5 = { "notice": "_4145abab73d17514__notice", "icon": "d0a25570cb528528__icon", "description": "_1904b570a89bb815__description", "is-info": "_531c140826094795__is-info", "is-warning": "ae2e1004697cce95__is-warning", "is-success": "_2e614a76af494837__is-success", "is-error": "af00331ae17a0065__is-error" }; 758 var Description = (0, import_element7.forwardRef)( 759 function NoticeDescription({ className, ...props }, ref) { 760 return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)( 761 Text, 762 { 763 ref, 764 variant: "body-md", 765 className: clsx_default(style_default5.description, className), 766 ...props 767 } 768 ); 769 } 770 ); 771 772 // packages/admin-ui/build-module/page/sidebar-toggle-slot.mjs 773 var import_components = __toESM(require_components(), 1); 774 var { Fill: SidebarToggleFill, Slot: SidebarToggleSlot } = (0, import_components.createSlotFill)("SidebarToggle"); 775 776 // packages/admin-ui/build-module/page/header.mjs 777 var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1); 778 function Header({ 779 headingLevel = 1, 780 breadcrumbs, 781 badges, 782 title, 783 subTitle, 784 actions, 785 showSidebarToggle = true 786 }) { 787 const HeadingTag = `h$headingLevel}`; 788 return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Stack, { direction: "column", className: "admin-ui-page__header", children: [ 789 /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Stack, { direction: "row", justify: "space-between", gap: "sm", children: [ 790 /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Stack, { direction: "row", gap: "sm", align: "center", justify: "start", children: [ 791 showSidebarToggle && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)( 792 SidebarToggleSlot, 793 { 794 bubblesVirtually: true, 795 className: "admin-ui-page__sidebar-toggle-slot" 796 } 797 ), 798 title && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(HeadingTag, { className: "admin-ui-page__header-title", children: title }), 799 breadcrumbs, 800 badges 801 ] }), 802 /* @__PURE__ */ (0, import_jsx_runtime9.jsx)( 803 Stack, 804 { 805 direction: "row", 806 gap: "sm", 807 style: { width: "auto", flexShrink: 0 }, 808 className: "admin-ui-page__header-actions", 809 align: "center", 810 children: actions 811 } 812 ) 813 ] }), 814 subTitle && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "admin-ui-page__header-subtitle", children: subTitle }) 815 ] }); 816 } 817 818 // packages/admin-ui/build-module/page/index.mjs 819 var import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1); 820 function Page({ 821 headingLevel, 822 breadcrumbs, 823 badges, 824 title, 825 subTitle, 826 children, 827 className, 828 actions, 829 hasPadding = false, 830 showSidebarToggle = true 831 }) { 832 const classes = clsx_default("admin-ui-page", className); 833 return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(navigable_region_default, { className: classes, ariaLabel: title, children: [ 834 (title || breadcrumbs || badges) && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)( 835 Header, 836 { 837 headingLevel, 838 breadcrumbs, 839 badges, 840 title, 841 subTitle, 842 actions, 843 showSidebarToggle 844 } 845 ), 846 hasPadding ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "admin-ui-page__content has-padding", children }) : children 847 ] }); 848 } 849 Page.SidebarToggleFill = SidebarToggleFill; 850 var page_default = Page; 851 852 // routes/connectors-home/stage.tsx 853 var import_components4 = __toESM(require_components()); 854 var import_data4 = __toESM(require_data()); 855 var import_element11 = __toESM(require_element()); 856 var import_i18n4 = __toESM(require_i18n()); 857 var import_core_data3 = __toESM(require_core_data()); 858 import { 859 privateApis as connectorsPrivateApis2 860 } from "@wordpress/connectors"; 861 862 // routes/connectors-home/style.scss 863 if (typeof document !== "undefined" && !document.head.querySelector("style[data-wp-hash='eb5f96e519']")) { 864 const style = document.createElement("style"); 865 style.setAttribute("data-wp-hash", "eb5f96e519"); 866 style.appendChild(document.createTextNode(".connectors-page{box-sizing:border-box;margin:0 auto;max-width:680px;padding:24px;width:100%}.connectors-page .components-item{background:#fff;border:1px solid #ddd;border-radius:8px;overflow:hidden;padding:20px;scroll-margin-top:120px}.connectors-page .connector-settings__error{color:#cc1818}.connectors-page .connector-settings .components-text-control__input{font-family:monospace;scroll-margin-top:120px}.connectors-page__file-mods-notice{margin-bottom:16px}.connectors-page--empty{align-items:center;display:flex;flex-direction:column;flex-grow:1;gap:32px;justify-content:center;text-align:center}.connectors-page .ai-plugin-callout{background-color:#e7d4e4;background-image:radial-gradient(ellipse 70% 120% at 18% 115%,#ca9ec6bf 0,#ca9ec600 60%),radial-gradient(ellipse 55% 110% at 92% -15%,#d0afd9b3 0,#d0afd900 65%),radial-gradient(ellipse 40% 85% at 58% -10%,#aa82b873 0,#aa82b800 70%);border-radius:8px;overflow:hidden;padding:24px;padding-inline-end:150px;position:relative}[dir=rtl] .connectors-page .ai-plugin-callout{background-image:radial-gradient(ellipse 70% 120% at 82% 115%,#ca9ec6bf 0,#ca9ec600 60%),radial-gradient(ellipse 55% 110% at 8% -15%,#d0afd9b3 0,#d0afd900 65%),radial-gradient(ellipse 40% 85% at 42% -10%,#aa82b873 0,#aa82b800 70%)}.connectors-page .ai-plugin-callout__content{align-items:flex-start;display:flex;flex-direction:column;gap:12px;padding-top:2px}.connectors-page .ai-plugin-callout__content p{font-size:13px;line-height:20px;margin:0}.connectors-page .ai-plugin-callout__decoration{height:110px;inset-inline-end:16px;position:absolute;top:12px;width:110px}.connectors-page>p{color:#949494}@media (max-width:680px){.connectors-page .ai-plugin-callout{padding:12px;padding-inline-end:100px}.connectors-page .ai-plugin-callout__decoration{height:75px;inset-inline-end:8px;top:8px;width:75px}}@media (max-width:480px){.connectors-page{padding:8px}.connectors-page .ai-plugin-callout{padding-inline-end:130px}.connectors-page .components-item{padding:12px}.connectors-page .components-item>.components-v-stack>.components-h-stack:first-child svg{height:32px;width:32px}.connectors-page .components-item>.components-v-stack>.components-h-stack:first-child>.components-h-stack:last-child{align-items:flex-end;flex-direction:column}}")); 867 document.head.appendChild(style); 868 } 869 870 // routes/connectors-home/ai-plugin-callout.tsx 871 var import_components3 = __toESM(require_components()); 872 var import_core_data2 = __toESM(require_core_data()); 873 var import_data3 = __toESM(require_data()); 874 var import_element10 = __toESM(require_element()); 875 var import_i18n3 = __toESM(require_i18n()); 876 var import_notices2 = __toESM(require_notices()); 877 var import_url = __toESM(require_url()); 878 879 // routes/connectors-home/default-connectors.tsx 880 var import_components2 = __toESM(require_components()); 881 var import_element9 = __toESM(require_element()); 882 var import_data2 = __toESM(require_data()); 883 var import_i18n2 = __toESM(require_i18n()); 884 import { 885 __experimentalRegisterConnector as registerConnector, 886 __experimentalConnectorItem as ConnectorItem, 887 __experimentalDefaultConnectorSettings as DefaultConnectorSettings, 888 privateApis as connectorsPrivateApis 889 } from "@wordpress/connectors"; 890 891 // routes/lock-unlock.ts 892 var import_private_apis = __toESM(require_private_apis()); 893 var { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( 894 "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", 895 "@wordpress/routes" 896 ); 897 898 // routes/connectors-home/use-connector-plugin.ts 899 var import_core_data = __toESM(require_core_data()); 900 var import_data = __toESM(require_data()); 901 var import_element8 = __toESM(require_element()); 902 var import_i18n = __toESM(require_i18n()); 903 var import_notices = __toESM(require_notices()); 904 function useConnectorPlugin({ 905 file: pluginFileFromServer, 906 settingName, 907 connectorName, 908 isInstalled, 909 isActivated, 910 keySource = "none", 911 initialIsConnected = false 912 }) { 913 const [isExpanded, setIsExpanded] = (0, import_element8.useState)(false); 914 const [isBusy, setIsBusy] = (0, import_element8.useState)(false); 915 const [connectedState, setConnectedState] = (0, import_element8.useState)(initialIsConnected); 916 const [pluginStatusOverride, setPluginStatusOverride] = (0, import_element8.useState)(null); 917 const pluginBasename = pluginFileFromServer?.replace(/\.php$/, ""); 918 const pluginSlug = pluginBasename?.includes("/") ? pluginBasename.split("/")[0] : pluginBasename; 919 const { 920 derivedPluginStatus, 921 canManagePlugins, 922 currentApiKey, 923 canInstallPlugins 924 } = (0, import_data.useSelect)( 925 (select2) => { 926 const store2 = select2(import_core_data.store); 927 const siteSettings = store2.getEntityRecord("root", "site"); 928 const apiKey = siteSettings?.[settingName] ?? ""; 929 const canCreate = !!store2.canUser("create", { 930 kind: "root", 931 name: "plugin" 932 }); 933 if (!pluginFileFromServer) { 934 const hasLoaded = store2.hasFinishedResolution( 935 "getEntityRecord", 936 ["root", "site"] 937 ); 938 return { 939 derivedPluginStatus: hasLoaded ? "active" : "checking", 940 canManagePlugins: void 0, 941 currentApiKey: apiKey, 942 canInstallPlugins: canCreate 943 }; 944 } 945 const plugin = store2.getEntityRecord( 946 "root", 947 "plugin", 948 pluginBasename 949 ); 950 const hasFinished = store2.hasFinishedResolution( 951 "getEntityRecord", 952 ["root", "plugin", pluginBasename] 953 ); 954 if (!hasFinished) { 955 return { 956 derivedPluginStatus: "checking", 957 canManagePlugins: void 0, 958 currentApiKey: apiKey, 959 canInstallPlugins: canCreate 960 }; 961 } 962 if (plugin) { 963 const isPluginActive = plugin.status === "active" || plugin.status === "network-active"; 964 return { 965 derivedPluginStatus: isPluginActive ? "active" : "inactive", 966 canManagePlugins: true, 967 currentApiKey: apiKey, 968 canInstallPlugins: canCreate 969 }; 970 } 971 let status = "not-installed"; 972 if (isActivated) { 973 status = "active"; 974 } else if (isInstalled) { 975 status = "inactive"; 976 } 977 return { 978 derivedPluginStatus: status, 979 canManagePlugins: false, 980 currentApiKey: apiKey, 981 canInstallPlugins: canCreate 982 }; 983 }, 984 [pluginBasename, settingName, isInstalled, isActivated] 985 ); 986 const pluginStatus = pluginStatusOverride ?? derivedPluginStatus; 987 const canActivatePlugins = canManagePlugins; 988 const isConnected = pluginStatus === "active" && connectedState || // After install/activate, if settings re-fetch reveals an existing key, 989 // update connected state (mirrors what the server would report on page load). 990 pluginStatusOverride === "active" && !!currentApiKey; 991 const { saveEntityRecord, invalidateResolution } = (0, import_data.useDispatch)(import_core_data.store); 992 const { createSuccessNotice, createErrorNotice } = (0, import_data.useDispatch)(import_notices.store); 993 const installPlugin = async () => { 994 if (!pluginSlug) { 995 return; 996 } 997 setIsBusy(true); 998 try { 999 await saveEntityRecord( 1000 "root", 1001 "plugin", 1002 { slug: pluginSlug, status: "active" }, 1003 { throwOnError: true } 1004 ); 1005 setPluginStatusOverride("active"); 1006 invalidateResolution("getEntityRecord", ["root", "site"]); 1007 setIsExpanded(true); 1008 createSuccessNotice( 1009 (0, import_i18n.sprintf)( 1010 /* translators: %s: Name of the connector (e.g. "OpenAI"). */ 1011 (0, import_i18n.__)("Plugin for %s installed and activated successfully."), 1012 connectorName 1013 ), 1014 { 1015 id: "connector-plugin-install-success", 1016 type: "snackbar" 1017 } 1018 ); 1019 } catch { 1020 createErrorNotice( 1021 (0, import_i18n.sprintf)( 1022 /* translators: %s: Name of the connector (e.g. "OpenAI"). */ 1023 (0, import_i18n.__)("Failed to install plugin for %s."), 1024 connectorName 1025 ), 1026 { 1027 id: "connector-plugin-install-error", 1028 type: "snackbar" 1029 } 1030 ); 1031 } finally { 1032 setIsBusy(false); 1033 } 1034 }; 1035 const activatePlugin = async () => { 1036 if (!pluginFileFromServer) { 1037 return; 1038 } 1039 setIsBusy(true); 1040 try { 1041 await saveEntityRecord( 1042 "root", 1043 "plugin", 1044 { 1045 plugin: pluginBasename, 1046 status: "active" 1047 }, 1048 { throwOnError: true } 1049 ); 1050 setPluginStatusOverride("active"); 1051 invalidateResolution("getEntityRecord", ["root", "site"]); 1052 setIsExpanded(true); 1053 createSuccessNotice( 1054 (0, import_i18n.sprintf)( 1055 /* translators: %s: Name of the connector (e.g. "OpenAI"). */ 1056 (0, import_i18n.__)("Plugin for %s activated successfully."), 1057 connectorName 1058 ), 1059 { 1060 id: "connector-plugin-activate-success", 1061 type: "snackbar" 1062 } 1063 ); 1064 } catch { 1065 createErrorNotice( 1066 (0, import_i18n.sprintf)( 1067 /* translators: %s: Name of the connector (e.g. "OpenAI"). */ 1068 (0, import_i18n.__)("Failed to activate plugin for %s."), 1069 connectorName 1070 ), 1071 { 1072 id: "connector-plugin-activate-error", 1073 type: "snackbar" 1074 } 1075 ); 1076 } finally { 1077 setIsBusy(false); 1078 } 1079 }; 1080 const handleButtonClick = () => { 1081 if (pluginStatus === "not-installed") { 1082 if (canInstallPlugins === false) { 1083 return; 1084 } 1085 installPlugin(); 1086 } else if (pluginStatus === "inactive") { 1087 if (canActivatePlugins === false) { 1088 return; 1089 } 1090 activatePlugin(); 1091 } else { 1092 setIsExpanded(!isExpanded); 1093 } 1094 }; 1095 const getButtonLabel = () => { 1096 if (isBusy) { 1097 return pluginStatus === "not-installed" ? (0, import_i18n.__)("Installing\u2026") : (0, import_i18n.__)("Activating\u2026"); 1098 } 1099 if (isExpanded) { 1100 return (0, import_i18n.__)("Cancel"); 1101 } 1102 if (isConnected) { 1103 return (0, import_i18n.__)("Edit"); 1104 } 1105 switch (pluginStatus) { 1106 case "checking": 1107 return (0, import_i18n.__)("Checking\u2026"); 1108 case "not-installed": 1109 return (0, import_i18n.__)("Install"); 1110 case "inactive": 1111 return (0, import_i18n.__)("Activate"); 1112 case "active": 1113 return (0, import_i18n.__)("Set up"); 1114 } 1115 }; 1116 const saveApiKey = async (apiKey) => { 1117 const previousApiKey = currentApiKey; 1118 try { 1119 const updatedRecord = await saveEntityRecord( 1120 "root", 1121 "site", 1122 { [settingName]: apiKey }, 1123 { throwOnError: true } 1124 ); 1125 const record = updatedRecord; 1126 const returnedKey = record?.[settingName]; 1127 if (apiKey && (returnedKey === previousApiKey || !returnedKey)) { 1128 throw new Error( 1129 "It was not possible to connect to the provider using this key." 1130 ); 1131 } 1132 setConnectedState(true); 1133 createSuccessNotice( 1134 (0, import_i18n.sprintf)( 1135 /* translators: %s: Name of the connector (e.g. "OpenAI"). */ 1136 (0, import_i18n.__)("%s connected successfully."), 1137 connectorName 1138 ), 1139 { 1140 id: "connector-connect-success", 1141 type: "snackbar" 1142 } 1143 ); 1144 } catch (error) { 1145 console.error("Failed to save API key:", error); 1146 throw error; 1147 } 1148 }; 1149 const removeApiKey = async () => { 1150 try { 1151 await saveEntityRecord( 1152 "root", 1153 "site", 1154 { [settingName]: "" }, 1155 { throwOnError: true } 1156 ); 1157 setConnectedState(false); 1158 createSuccessNotice( 1159 (0, import_i18n.sprintf)( 1160 /* translators: %s: Name of the connector (e.g. "OpenAI"). */ 1161 (0, import_i18n.__)("%s disconnected."), 1162 connectorName 1163 ), 1164 { 1165 id: "connector-disconnect-success", 1166 type: "snackbar" 1167 } 1168 ); 1169 } catch (error) { 1170 console.error("Failed to remove API key:", error); 1171 createErrorNotice( 1172 (0, import_i18n.sprintf)( 1173 /* translators: %s: Name of the connector (e.g. "OpenAI"). */ 1174 (0, import_i18n.__)("Failed to disconnect %s."), 1175 connectorName 1176 ), 1177 { 1178 id: "connector-disconnect-error", 1179 type: "snackbar" 1180 } 1181 ); 1182 throw error; 1183 } 1184 }; 1185 return { 1186 pluginStatus, 1187 canInstallPlugins, 1188 canActivatePlugins, 1189 isExpanded, 1190 setIsExpanded, 1191 isBusy, 1192 isConnected, 1193 currentApiKey, 1194 keySource, 1195 handleButtonClick, 1196 getButtonLabel, 1197 saveApiKey, 1198 removeApiKey 1199 }; 1200 } 1201 1202 // routes/connectors-home/logos.tsx 1203 var OpenAILogo = () => /* @__PURE__ */ React.createElement( 1204 "svg", 1205 { 1206 width: "40", 1207 height: "40", 1208 viewBox: "0 0 24 24", 1209 fill: "none", 1210 xmlns: "http://www.w3.org/2000/svg", 1211 "aria-hidden": "true" 1212 }, 1213 /* @__PURE__ */ React.createElement( 1214 "path", 1215 { 1216 d: "M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364l2.0201-1.1685a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.4043-.6813zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z", 1217 fill: "currentColor" 1218 } 1219 ) 1220 ); 1221 var ClaudeLogo = () => /* @__PURE__ */ React.createElement( 1222 "svg", 1223 { 1224 width: "40", 1225 height: "40", 1226 viewBox: "0 0 32 32", 1227 fill: "none", 1228 xmlns: "http://www.w3.org/2000/svg", 1229 "aria-hidden": "true" 1230 }, 1231 /* @__PURE__ */ React.createElement( 1232 "path", 1233 { 1234 d: "M6.2 21.024L12.416 17.536L12.52 17.232L12.416 17.064H12.112L11.072 17L7.52 16.904L4.44 16.776L1.456 16.616L0.704 16.456L0 15.528L0.072 15.064L0.704 14.64L1.608 14.72L3.608 14.856L6.608 15.064L8.784 15.192L12.008 15.528H12.52L12.592 15.32L12.416 15.192L12.28 15.064L9.176 12.96L5.816 10.736L4.056 9.456L3.104 8.808L2.624 8.2L2.416 6.872L3.28 5.92L4.44 6L4.736 6.08L5.912 6.984L8.424 8.928L11.704 11.344L12.184 11.744L12.376 11.608L12.4 11.512L12.184 11.152L10.4 7.928L8.496 4.648L7.648 3.288L7.424 2.472C7.344 2.136 7.288 1.856 7.288 1.512L8.272 0.176L8.816 0L10.128 0.176L10.68 0.656L11.496 2.52L12.816 5.456L14.864 9.448L15.464 10.632L15.784 11.728L15.904 12.064H16.112V11.872L16.28 9.624L16.592 6.864L16.896 3.312L17 2.312L17.496 1.112L18.48 0.464L19.248 0.832L19.88 1.736L19.792 2.32L19.416 4.76L18.68 8.584L18.2 11.144H18.48L18.8 10.824L20.096 9.104L22.272 6.384L23.232 5.304L24.352 4.112L25.072 3.544H26.432L27.432 5.032L26.984 6.568L25.584 8.344L24.424 9.848L22.76 12.088L21.72 13.88L21.816 14.024L22.064 14L25.824 13.2L27.856 12.832L30.28 12.416L31.376 12.928L31.496 13.448L31.064 14.512L28.472 15.152L25.432 15.76L20.904 16.832L20.848 16.872L20.912 16.952L22.952 17.144L23.824 17.192H25.96L29.936 17.488L30.976 18.176L31.6 19.016L31.496 19.656L29.896 20.472L27.736 19.96L22.696 18.76L20.968 18.328H20.728V18.472L22.168 19.88L24.808 22.264L28.112 25.336L28.28 26.096L27.856 26.696L27.408 26.632L24.504 24.448L23.384 23.464L20.848 21.328H20.68V21.552L21.264 22.408L24.352 27.048L24.512 28.472L24.288 28.936L23.488 29.216L22.608 29.056L20.8 26.52L18.936 23.664L17.432 21.104L17.248 21.208L16.36 30.768L15.944 31.256L14.984 31.624L14.184 31.016L13.76 30.032L14.184 28.088L14.696 25.552L15.112 23.536L15.488 21.032L15.712 20.2L15.696 20.144L15.512 20.168L13.624 22.76L10.752 26.64L8.48 29.072L7.936 29.288L6.992 28.8L7.08 27.928L7.608 27.152L10.752 23.152L12.648 20.672L13.872 19.24L13.864 19.032H13.792L5.44 24.456L3.952 24.648L3.312 24.048L3.392 23.064L3.696 22.744L6.208 21.016L6.2 21.024Z", 1235 fill: "#D97757" 1236 } 1237 ) 1238 ); 1239 var DefaultConnectorLogo = () => /* @__PURE__ */ React.createElement( 1240 "svg", 1241 { 1242 width: "40", 1243 height: "40", 1244 viewBox: "0 0 32 32", 1245 fill: "none", 1246 xmlns: "http://www.w3.org/2000/svg", 1247 "aria-hidden": "true" 1248 }, 1249 /* @__PURE__ */ React.createElement( 1250 "path", 1251 { 1252 d: "M0 4C0 1.79086 1.79086 0 4 0H28C30.2091 0 32 1.79086 32 4V28C32 30.2091 30.2091 32 28 32H4C1.79086 32 0 30.2091 0 28V4Z", 1253 fill: "#F0F0F0" 1254 } 1255 ), 1256 /* @__PURE__ */ React.createElement( 1257 "path", 1258 { 1259 d: "M14.5 8V12H17.5V8H19V12H20.5C20.7652 12 21.0196 12.1054 21.2071 12.2929C21.3946 12.4804 21.5 12.7348 21.5 13V17L18.5 21V23C18.5 23.2652 18.3946 23.5196 18.2071 23.7071C18.0196 23.8946 17.7652 24 17.5 24H14.5C14.2348 24 13.9804 23.8946 13.7929 23.7071C13.6054 23.5196 13.5 23.2652 13.5 23V21L10.5 17V13C10.5 12.7348 10.6054 12.4804 10.7929 12.2929C10.9804 12.1054 11.2348 12 11.5 12H13V8H14.5ZM15 20.5V22.5H17V20.5L20 16.5V13.5H12V16.5L15 20.5Z", 1260 fill: "#949494" 1261 } 1262 ) 1263 ); 1264 var AkismetLogo = () => /* @__PURE__ */ React.createElement( 1265 "svg", 1266 { 1267 width: "40", 1268 height: "40", 1269 viewBox: "0 0 44 44", 1270 fill: "none", 1271 xmlns: "http://www.w3.org/2000/svg", 1272 "aria-hidden": "true" 1273 }, 1274 /* @__PURE__ */ React.createElement("rect", { width: "44", height: "44", fill: "#357B49", rx: "6" }), 1275 /* @__PURE__ */ React.createElement( 1276 "path", 1277 { 1278 fill: "#fff", 1279 fillRule: "evenodd", 1280 d: "m29.746 28.31-6.392-16.797c-.152-.397-.305-.672-.789-.675-.673 0-1.408.611-1.746 1.316l-7.378 16.154c-.072.16-.143.311-.214.454-.5.995-1.045 1.546-2.357 1.626a.399.399 0 0 0-.16.033l-.01.004a.399.399 0 0 0-.23.392v.01c0 .054.01.106.03.155l.004.01a.416.416 0 0 0 .394.252h6.212a.417.417 0 0 0 .307-.12.416.416 0 0 0 .124-.305.398.398 0 0 0-.105-.302.399.399 0 0 0-.294-.127c-.757 0-2.197-.062-2.197-1.164.02-.318.103-.63.245-.916l1.399-3.152c.52-1.163 1.654-1.163 2.572-1.163h5.843c.023 0 .044 0 .062.003.13.014.16.081.214.242l1.534 4.07a2.857 2.857 0 0 1 .216 1.04c0 .054-.003.104-.01.153-.09.726-.831.887-1.49.887a.4.4 0 0 0-.294.127l-.007.008-.007.008a.401.401 0 0 0-.092.286v.01c0 .054.01.106.03.155l.005.01a.42.42 0 0 0 .395.252h7.011a.413.413 0 0 0 .279-.13.412.412 0 0 0 .11-.297.387.387 0 0 0-.09-.294.388.388 0 0 0-.277-.135c-1.448-.122-2.295-.643-2.847-2.08Zm-11.985-5.844 2.847-6.304c.361-.728.659-1.486.889-2.265 0-.06.03-.092.06-.092s.061.032.061.091c.02.122.045.247.073.374.197.888.584 1.878.914 2.723l.176.453 1.684 4.529a.927.927 0 0 1 .092.4.473.473 0 0 1-.009.094c-.041.202-.228.272-.602.272h-6.063c-.122 0-.184-.03-.184-.092a.36.36 0 0 1 .062-.183Zm17.107-.721c0 .786-.446 1.231-1.25 1.231-.806 0-1.125-.409-1.125-1.034 0-.786.465-1.231 1.25-1.231.785 0 1.125.427 1.125 1.034ZM9.629 23.002c.803 0 1.25-.447 1.25-1.231 0-.607-.343-1.036-1.128-1.036-.785 0-1.25.447-1.25 1.231 0 .625.325 1.036 1.128 1.036Z", 1281 clipRule: "evenodd" 1282 } 1283 ) 1284 ); 1285 var GeminiLogo = () => /* @__PURE__ */ React.createElement( 1286 "svg", 1287 { 1288 width: "40", 1289 height: "40", 1290 style: { flex: "none", lineHeight: 1 }, 1291 viewBox: "0 0 24 24", 1292 xmlns: "http://www.w3.org/2000/svg", 1293 "aria-hidden": "true" 1294 }, 1295 /* @__PURE__ */ React.createElement( 1296 "path", 1297 { 1298 d: "M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z", 1299 fill: "#3186FF" 1300 } 1301 ), 1302 /* @__PURE__ */ React.createElement( 1303 "path", 1304 { 1305 d: "M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z", 1306 fill: "url(#lobe-icons-gemini-fill-0)" 1307 } 1308 ), 1309 /* @__PURE__ */ React.createElement( 1310 "path", 1311 { 1312 d: "M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z", 1313 fill: "url(#lobe-icons-gemini-fill-1)" 1314 } 1315 ), 1316 /* @__PURE__ */ React.createElement( 1317 "path", 1318 { 1319 d: "M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z", 1320 fill: "url(#lobe-icons-gemini-fill-2)" 1321 } 1322 ), 1323 /* @__PURE__ */ React.createElement("defs", null, /* @__PURE__ */ React.createElement( 1324 "linearGradient", 1325 { 1326 gradientUnits: "userSpaceOnUse", 1327 id: "lobe-icons-gemini-fill-0", 1328 x1: "7", 1329 x2: "11", 1330 y1: "15.5", 1331 y2: "12" 1332 }, 1333 /* @__PURE__ */ React.createElement("stop", { stopColor: "#08B962" }), 1334 /* @__PURE__ */ React.createElement("stop", { offset: "1", stopColor: "#08B962", stopOpacity: "0" }) 1335 ), /* @__PURE__ */ React.createElement( 1336 "linearGradient", 1337 { 1338 gradientUnits: "userSpaceOnUse", 1339 id: "lobe-icons-gemini-fill-1", 1340 x1: "8", 1341 x2: "11.5", 1342 y1: "5.5", 1343 y2: "11" 1344 }, 1345 /* @__PURE__ */ React.createElement("stop", { stopColor: "#F94543" }), 1346 /* @__PURE__ */ React.createElement("stop", { offset: "1", stopColor: "#F94543", stopOpacity: "0" }) 1347 ), /* @__PURE__ */ React.createElement( 1348 "linearGradient", 1349 { 1350 gradientUnits: "userSpaceOnUse", 1351 id: "lobe-icons-gemini-fill-2", 1352 x1: "3.5", 1353 x2: "17.5", 1354 y1: "13.5", 1355 y2: "12" 1356 }, 1357 /* @__PURE__ */ React.createElement("stop", { stopColor: "#FABC12" }), 1358 /* @__PURE__ */ React.createElement("stop", { offset: ".46", stopColor: "#FABC12", stopOpacity: "0" }) 1359 )) 1360 ); 1361 1362 // routes/connectors-home/default-connectors.tsx 1363 var { store: connectorsStore } = unlock(connectorsPrivateApis); 1364 function getConnectorScriptModuleData() { 1365 try { 1366 return JSON.parse( 1367 document.getElementById( 1368 "wp-script-module-data-options-connectors-wp-admin" 1369 )?.textContent ?? "{}" 1370 ); 1371 } catch { 1372 return {}; 1373 } 1374 } 1375 function getConnectorData() { 1376 return getConnectorScriptModuleData().connectors ?? {}; 1377 } 1378 function getIsFileModDisabled() { 1379 return !!getConnectorScriptModuleData().isFileModDisabled; 1380 } 1381 var CONNECTOR_LOGOS = { 1382 google: GeminiLogo, 1383 openai: OpenAILogo, 1384 anthropic: ClaudeLogo, 1385 akismet: AkismetLogo 1386 }; 1387 function getConnectorLogo(connectorId, logoUrl) { 1388 if (logoUrl) { 1389 return /* @__PURE__ */ React.createElement("img", { src: logoUrl, alt: "", width: 40, height: 40 }); 1390 } 1391 const Logo = CONNECTOR_LOGOS[connectorId]; 1392 if (Logo) { 1393 return /* @__PURE__ */ React.createElement(Logo, null); 1394 } 1395 return /* @__PURE__ */ React.createElement(DefaultConnectorLogo, null); 1396 } 1397 var ConnectedBadge = () => /* @__PURE__ */ React.createElement( 1398 "span", 1399 { 1400 style: { 1401 color: "#345b37", 1402 backgroundColor: "#eff8f0", 1403 padding: "4px 12px", 1404 borderRadius: "2px", 1405 fontSize: "13px", 1406 fontWeight: 500, 1407 whiteSpace: "nowrap" 1408 } 1409 }, 1410 (0, import_i18n2.__)("Connected") 1411 ); 1412 var PluginDirectoryLink = ({ slug }) => /* @__PURE__ */ React.createElement( 1413 import_components2.ExternalLink, 1414 { 1415 href: (0, import_i18n2.sprintf)( 1416 /* translators: %s: plugin slug. */ 1417 (0, import_i18n2.__)("https://wordpress.org/plugins/%s/"), 1418 slug 1419 ) 1420 }, 1421 (0, import_i18n2.__)("Learn more") 1422 ); 1423 var UnavailableActionBadge = () => /* @__PURE__ */ React.createElement(Badge, null, (0, import_i18n2.__)("Not available")); 1424 function ApiKeyConnector({ 1425 name, 1426 description, 1427 logo, 1428 authentication, 1429 plugin 1430 }) { 1431 const auth = authentication?.method === "api_key" ? authentication : void 0; 1432 const settingName = auth?.settingName ?? ""; 1433 const helpUrl = auth?.credentialsUrl ?? void 0; 1434 const pluginFile = plugin?.file?.replace(/\.php$/, ""); 1435 const pluginSlug = pluginFile?.includes("/") ? pluginFile.split("/")[0] : pluginFile; 1436 let helpLabel; 1437 try { 1438 if (helpUrl) { 1439 helpLabel = new URL(helpUrl).hostname; 1440 } 1441 } catch { 1442 } 1443 const { 1444 pluginStatus, 1445 canInstallPlugins, 1446 canActivatePlugins, 1447 isExpanded, 1448 setIsExpanded, 1449 isBusy, 1450 isConnected, 1451 currentApiKey, 1452 keySource, 1453 handleButtonClick, 1454 getButtonLabel, 1455 saveApiKey, 1456 removeApiKey 1457 } = useConnectorPlugin({ 1458 file: plugin?.file, 1459 settingName, 1460 connectorName: name, 1461 isInstalled: plugin?.isInstalled, 1462 isActivated: plugin?.isActivated, 1463 keySource: auth?.keySource, 1464 initialIsConnected: auth?.isConnected 1465 }); 1466 const isExternallyConfigured = keySource === "env" || keySource === "constant"; 1467 const showUnavailableBadge = pluginStatus === "not-installed" && canInstallPlugins === false || pluginStatus === "inactive" && canActivatePlugins === false; 1468 const showActionButton = !showUnavailableBadge; 1469 const actionButtonRef = (0, import_element9.useRef)(null); 1470 return /* @__PURE__ */ React.createElement( 1471 ConnectorItem, 1472 { 1473 className: pluginSlug ? `connector-item--$pluginSlug}` : void 0, 1474 logo, 1475 name, 1476 description, 1477 actionArea: /* @__PURE__ */ React.createElement(import_components2.__experimentalHStack, { spacing: 3, expanded: false }, isConnected && /* @__PURE__ */ React.createElement(ConnectedBadge, null), showUnavailableBadge && (pluginSlug ? /* @__PURE__ */ React.createElement(PluginDirectoryLink, { slug: pluginSlug }) : /* @__PURE__ */ React.createElement(UnavailableActionBadge, null)), showActionButton && /* @__PURE__ */ React.createElement( 1478 import_components2.Button, 1479 { 1480 ref: actionButtonRef, 1481 variant: isExpanded || isConnected ? "tertiary" : "secondary", 1482 size: "compact", 1483 onClick: handleButtonClick, 1484 disabled: pluginStatus === "checking" || isBusy, 1485 isBusy, 1486 accessibleWhenDisabled: true 1487 }, 1488 getButtonLabel() 1489 )) 1490 }, 1491 isExpanded && pluginStatus === "active" && /* @__PURE__ */ React.createElement( 1492 DefaultConnectorSettings, 1493 { 1494 key: isConnected ? "connected" : "setup", 1495 initialValue: isExternallyConfigured ? "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022" : currentApiKey, 1496 helpUrl, 1497 helpLabel, 1498 readOnly: isConnected || isExternallyConfigured, 1499 keySource, 1500 onRemove: isExternallyConfigured ? void 0 : async () => { 1501 await removeApiKey(); 1502 actionButtonRef.current?.focus(); 1503 }, 1504 onSave: async (apiKey) => { 1505 await saveApiKey(apiKey); 1506 setIsExpanded(false); 1507 actionButtonRef.current?.focus(); 1508 } 1509 } 1510 ) 1511 ); 1512 } 1513 function registerDefaultConnectors() { 1514 const connectors = getConnectorData(); 1515 const sanitize = (s) => s.replace(/[^a-z0-9-_]/gi, "-"); 1516 for (const [connectorId, data] of Object.entries(connectors)) { 1517 if (connectorId === "akismet" && !data.plugin?.isInstalled) { 1518 continue; 1519 } 1520 const { authentication } = data; 1521 const connectorName = sanitize(connectorId); 1522 const args = { 1523 name: data.name, 1524 description: data.description, 1525 type: data.type, 1526 logo: getConnectorLogo(connectorId, data.logoUrl), 1527 authentication, 1528 plugin: data.plugin 1529 }; 1530 const existing = unlock((0, import_data2.select)(connectorsStore)).getConnector( 1531 connectorName 1532 ); 1533 if (authentication.method === "api_key" && !existing?.render) { 1534 args.render = ApiKeyConnector; 1535 } 1536 registerConnector(connectorName, args); 1537 } 1538 } 1539 1540 // routes/connectors-home/wp-logo-decoration.tsx 1541 function WpLogoDecoration() { 1542 return /* @__PURE__ */ React.createElement("div", { className: "ai-plugin-callout__decoration", "aria-hidden": "true" }, /* @__PURE__ */ React.createElement( 1543 "svg", 1544 { 1545 viewBox: "0 0 248 248", 1546 xmlns: "http://www.w3.org/2000/svg", 1547 xmlnsXlink: "http://www.w3.org/1999/xlink", 1548 focusable: "false", 1549 style: { width: "100%", height: "100%" } 1550 }, 1551 /* @__PURE__ */ React.createElement( 1552 "image", 1553 { 1554 href: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAAEsCAYAAAB5fY51AAAQAElEQVR4AezdC3ojWW5tYflOzPbIbI/M9sh8+WdrdZ+KpiiKL5FB5KedwN7AeSFIpHRYmfX/PubXVGAqMBV4kQpMw3qRBzXbnApMBT4+pmHNq2AqMBV4mQpMw3qZR3X9RmeGqcCrV2Aa1qs/wdn/VOCNKjAN640e9hx1KvDqFZiG9epPcPY/FThWgZ1q07B2+mDnWFOBPVZgGtYen+qcaSqw0wpMw9rpg51jTQX2WIFpWMee6mhTganAU1ZgGtZTPpbZ1FRgKnCsAtOwjlVltKnAVOApKzAN6ykfy2zqcRWYlV6pAtOwXulpzV6nAm9egWlYb/4CmONPBV6pAtOwXulpve9e//Nw9P/7xL8d7Hy9aQWubFhvWrU59qMr8D+HBc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VceP/ejiE641b/ypwE0qMA3rJmXc1STuUPxTJttDuWsRW3X8WMM6Nn4dN/5U4KIKTMO6qGwzaCowFfiNCkzD+o2q72nNOctU4IEVmIb1wGLPUlOBqcB1FZiGdV39ZvRUYCrwwApMw3pgsWepqcBrV+D3dz8N6/efwexgKjAVOLMC07DOLNSkTQWmAr9fgWlYv/8MZgdTganAmRWYhnVmoa5PmxmmAlOBayswDevaCs74qcBU4GEVmIb1sFLPQlOBqcC1FZiGdW0FZ/xU4J8rMMqdKjAN606FnWmnAlOB21dgGtbtazozTgWmAneqwDSsOxV2pp0KTAVuX4H/DwAA//9sB2hHAAAABklEQVQDAB9QlitZA9bLAAAAAElFTkSuQmCC", 1555 width: "248", 1556 height: "248", 1557 style: { mixBlendMode: "multiply" } 1558 } 1559 ) 1560 )); 1561 } 1562 1563 // routes/connectors-home/ai-plugin-callout.tsx 1564 var AI_PLUGIN_SLUG = "ai"; 1565 var AI_PLUGIN_PAGE_SLUG = "ai-wp-admin"; 1566 var AI_PLUGIN_ID = "ai/ai"; 1567 var AI_PLUGIN_URL = "https://wordpress.org/plugins/ai/"; 1568 var connectorDataValues = Object.values(getConnectorData()); 1569 var hasAiProviders = connectorDataValues.some( 1570 (c) => c.type === "ai_provider" 1571 ); 1572 var aiProviderSettingNames = []; 1573 for (const c of connectorDataValues) { 1574 if (c.type === "ai_provider" && c.authentication.method === "api_key") { 1575 aiProviderSettingNames.push(c.authentication.settingName); 1576 } 1577 } 1578 function AiPluginCallout() { 1579 const [isBusy, setIsBusy] = (0, import_element10.useState)(false); 1580 const [justActivated, setJustActivated] = (0, import_element10.useState)(false); 1581 const actionButtonRef = (0, import_element10.useRef)(null); 1582 (0, import_element10.useEffect)(() => { 1583 if (justActivated) { 1584 actionButtonRef.current?.focus(); 1585 } 1586 }, [justActivated]); 1587 const initialHasConnectedProvider = (0, import_element10.useRef)( 1588 connectorDataValues.some( 1589 (c) => c.type === "ai_provider" && c.authentication.method === "api_key" && c.authentication.isConnected 1590 ) 1591 ).current; 1592 const { 1593 pluginStatus, 1594 canInstallPlugins, 1595 canManagePlugins, 1596 hasConnectedProvider 1597 } = (0, import_data3.useSelect)((select2) => { 1598 const store2 = select2(import_core_data2.store); 1599 const canCreate = !!store2.canUser("create", { 1600 kind: "root", 1601 name: "plugin" 1602 }); 1603 const siteSettings = store2.getEntityRecord("root", "site"); 1604 const hasConnected = initialHasConnectedProvider || aiProviderSettingNames.some( 1605 (name) => !!siteSettings?.[name] 1606 ); 1607 const plugin = store2.getEntityRecord( 1608 "root", 1609 "plugin", 1610 AI_PLUGIN_ID 1611 ); 1612 const hasFinished = store2.hasFinishedResolution("getEntityRecord", [ 1613 "root", 1614 "plugin", 1615 AI_PLUGIN_ID 1616 ]); 1617 if (!hasFinished) { 1618 return { 1619 pluginStatus: "checking", 1620 canInstallPlugins: canCreate, 1621 canManagePlugins: void 0, 1622 hasConnectedProvider: hasConnected 1623 }; 1624 } 1625 if (!plugin) { 1626 return { 1627 pluginStatus: "not-installed", 1628 canInstallPlugins: canCreate, 1629 canManagePlugins: canCreate, 1630 hasConnectedProvider: hasConnected 1631 }; 1632 } 1633 return { 1634 pluginStatus: plugin.status === "active" ? "active" : "inactive", 1635 canInstallPlugins: canCreate, 1636 canManagePlugins: true, 1637 hasConnectedProvider: hasConnected 1638 }; 1639 }, []); 1640 const { saveEntityRecord } = (0, import_data3.useDispatch)(import_core_data2.store); 1641 const { createSuccessNotice, createErrorNotice } = (0, import_data3.useDispatch)(import_notices2.store); 1642 const installPlugin = async () => { 1643 setIsBusy(true); 1644 try { 1645 await saveEntityRecord( 1646 "root", 1647 "plugin", 1648 { slug: AI_PLUGIN_SLUG, status: "active" }, 1649 { throwOnError: true } 1650 ); 1651 setJustActivated(true); 1652 createSuccessNotice( 1653 (0, import_i18n3.__)("AI plugin installed and activated successfully."), 1654 { 1655 id: "ai-plugin-install-success", 1656 type: "snackbar" 1657 } 1658 ); 1659 } catch { 1660 createErrorNotice((0, import_i18n3.__)("Failed to install the AI plugin."), { 1661 id: "ai-plugin-install-error", 1662 type: "snackbar" 1663 }); 1664 } finally { 1665 setIsBusy(false); 1666 } 1667 }; 1668 const activatePlugin = async () => { 1669 setIsBusy(true); 1670 try { 1671 await saveEntityRecord( 1672 "root", 1673 "plugin", 1674 { plugin: AI_PLUGIN_ID, status: "active" }, 1675 { throwOnError: true } 1676 ); 1677 setJustActivated(true); 1678 createSuccessNotice((0, import_i18n3.__)("AI plugin activated successfully."), { 1679 id: "ai-plugin-activate-success", 1680 type: "snackbar" 1681 }); 1682 } catch { 1683 createErrorNotice((0, import_i18n3.__)("Failed to activate the AI plugin."), { 1684 id: "ai-plugin-activate-error", 1685 type: "snackbar" 1686 }); 1687 } finally { 1688 setIsBusy(false); 1689 } 1690 }; 1691 if (!hasAiProviders) { 1692 return null; 1693 } 1694 if (pluginStatus === "checking") { 1695 return null; 1696 } 1697 if (pluginStatus === "active" && initialHasConnectedProvider && !justActivated) { 1698 return null; 1699 } 1700 if (pluginStatus === "inactive" && canManagePlugins === false) { 1701 return null; 1702 } 1703 const isActiveNoProvider = pluginStatus === "active" && !hasConnectedProvider; 1704 const isJustConnected = pluginStatus === "active" && hasConnectedProvider && (!initialHasConnectedProvider || justActivated); 1705 const showInstallActivate = pluginStatus === "not-installed" || pluginStatus === "inactive"; 1706 const hideButtons = pluginStatus === "not-installed" && canInstallPlugins === false; 1707 const getMessage = () => { 1708 if (isJustConnected) { 1709 return (0, import_i18n3.__)( 1710 "The <strong>AI plugin</strong> is ready to use. You can use it to generate featured images, alt text, titles, excerpts and more. <a>Learn more</a>" 1711 ); 1712 } 1713 if (isActiveNoProvider) { 1714 return (0, import_i18n3.__)( 1715 "The <strong>AI plugin</strong> is installed. Connect an AI provider below to generate featured images, alt text, titles, excerpts, and more. <a>Learn more</a>" 1716 ); 1717 } 1718 return (0, import_i18n3.__)( 1719 "The <strong>AI plugin</strong> can use your AI connectors to generate featured images, alt text, titles, excerpts and more. <a>Learn more</a>" 1720 ); 1721 }; 1722 const getPrimaryButtonProps = () => { 1723 if (pluginStatus === "not-installed") { 1724 return { 1725 label: isBusy ? (0, import_i18n3.__)("Installing\u2026") : (0, import_i18n3.__)("Install the AI plugin"), 1726 disabled: isBusy, 1727 onClick: isBusy ? void 0 : installPlugin 1728 }; 1729 } 1730 return { 1731 label: isBusy ? (0, import_i18n3.__)("Activating\u2026") : (0, import_i18n3.__)("Activate the AI plugin"), 1732 disabled: isBusy, 1733 onClick: isBusy ? void 0 : activatePlugin 1734 }; 1735 }; 1736 return /* @__PURE__ */ React.createElement("div", { className: "ai-plugin-callout" }, /* @__PURE__ */ React.createElement("div", { className: "ai-plugin-callout__content" }, /* @__PURE__ */ React.createElement("p", null, (0, import_element10.createInterpolateElement)(getMessage(), { 1737 strong: /* @__PURE__ */ React.createElement("strong", null), 1738 // @ts-ignore children are injected by createInterpolateElement at runtime. 1739 a: /* @__PURE__ */ React.createElement(import_components3.ExternalLink, { href: AI_PLUGIN_URL }) 1740 })), !hideButtons && (showInstallActivate ? /* @__PURE__ */ React.createElement( 1741 import_components3.Button, 1742 { 1743 variant: "primary", 1744 size: "compact", 1745 isBusy, 1746 disabled: getPrimaryButtonProps().disabled, 1747 accessibleWhenDisabled: true, 1748 onClick: getPrimaryButtonProps().onClick 1749 }, 1750 getPrimaryButtonProps().label 1751 ) : /* @__PURE__ */ React.createElement( 1752 import_components3.Button, 1753 { 1754 ref: actionButtonRef, 1755 variant: "secondary", 1756 size: "compact", 1757 href: (0, import_url.addQueryArgs)("options-general.php", { 1758 page: AI_PLUGIN_PAGE_SLUG 1759 }) 1760 }, 1761 (0, import_i18n3.__)("Control features in the AI plugin") 1762 ))), /* @__PURE__ */ React.createElement(WpLogoDecoration, null)); 1763 } 1764 1765 // routes/connectors-home/stage.tsx 1766 var { store } = unlock(connectorsPrivateApis2); 1767 registerDefaultConnectors(); 1768 function ConnectorsPage() { 1769 const isFileModDisabled = getIsFileModDisabled(); 1770 const { connectors, canInstallPlugins, isAiPluginInstalled } = (0, import_data4.useSelect)( 1771 (select2) => { 1772 const coreSelect = select2(import_core_data3.store); 1773 const aiPlugin = coreSelect.getEntityRecord( 1774 "root", 1775 "plugin", 1776 "ai/ai" 1777 ); 1778 return { 1779 connectors: unlock(select2(store)).getConnectors(), 1780 canInstallPlugins: coreSelect.canUser("create", { 1781 kind: "root", 1782 name: "plugin" 1783 }), 1784 isAiPluginInstalled: !!aiPlugin 1785 }; 1786 }, 1787 [] 1788 ); 1789 const renderableConnectors = connectors.filter( 1790 (connector) => connector.render 1791 ); 1792 const aiProviderPluginSlugs = Array.from( 1793 new Set( 1794 connectors.filter( 1795 (connector) => connector.type === "ai_provider" 1796 ).map( 1797 (connector) => connector.plugin?.file?.split("/")[0] 1798 ).filter((slug) => !!slug) 1799 ) 1800 ).sort(); 1801 const installedPluginSlugs = new Set( 1802 connectors.filter( 1803 (connector) => connector.plugin?.isInstalled 1804 ).map( 1805 (connector) => connector.plugin?.file?.split("/")[0] 1806 ).filter((slug) => !!slug) 1807 ); 1808 if (isAiPluginInstalled) { 1809 installedPluginSlugs.add("ai"); 1810 } 1811 const manualInstallPluginSlugs = ["ai", ...aiProviderPluginSlugs].filter( 1812 (slug) => !installedPluginSlugs.has(slug) 1813 ); 1814 const isEmpty = renderableConnectors.length === 0; 1815 const showFileModsNotice = manualInstallPluginSlugs.length > 0 && (isFileModDisabled || !canInstallPlugins); 1816 const fileModsNoticeMessage = isFileModDisabled ? (0, import_i18n4.__)( 1817 "Plugins cannot be installed here due to your site configuration. Install them manually using your normal deployment workflow." 1818 ) : (0, import_i18n4.__)( 1819 "You do not have permission to install plugins. Please ask a site administrator to install them for you." 1820 ); 1821 return /* @__PURE__ */ React.createElement( 1822 page_default, 1823 { 1824 title: (0, import_i18n4.__)("Connectors"), 1825 subTitle: (0, import_i18n4.__)( 1826 "All of your API keys and credentials are stored here and shared across plugins. Configure once and use everywhere." 1827 ) 1828 }, 1829 /* @__PURE__ */ React.createElement( 1830 "div", 1831 { 1832 className: `connectors-page$isEmpty ? " connectors-page--empty" : ""}` 1833 }, 1834 showFileModsNotice && /* @__PURE__ */ React.createElement( 1835 notice_exports.Root, 1836 { 1837 intent: "info", 1838 className: "connectors-page__file-mods-notice" 1839 }, 1840 /* @__PURE__ */ React.createElement(notice_exports.Description, null, fileModsNoticeMessage) 1841 ), 1842 isEmpty ? /* @__PURE__ */ React.createElement( 1843 import_components4.__experimentalVStack, 1844 { 1845 alignment: "center", 1846 spacing: 3, 1847 style: { maxWidth: 480 } 1848 }, 1849 /* @__PURE__ */ React.createElement(import_components4.__experimentalVStack, { alignment: "center", spacing: 2 }, /* @__PURE__ */ React.createElement(import_components4.__experimentalHeading, { level: 2, size: 15, weight: 600 }, (0, import_i18n4.__)("No connectors yet")), /* @__PURE__ */ React.createElement(import_components4.__experimentalText, { size: 12 }, (0, import_i18n4.__)( 1850 "Connectors appear here when you install plugins that use external services. Each plugin registers the API keys it needs, and you manage them all in one place." 1851 ))), 1852 /* @__PURE__ */ React.createElement(import_components4.Button, { variant: "secondary", href: "plugin-install.php" }, (0, import_i18n4.__)("Learn more")) 1853 ) : /* @__PURE__ */ React.createElement(import_components4.__experimentalVStack, { spacing: 3 }, /* @__PURE__ */ React.createElement(AiPluginCallout, null), /* @__PURE__ */ React.createElement(import_components4.__experimentalVStack, { spacing: 3, role: "list" }, connectors.map( 1854 (connector) => { 1855 if (connector.render) { 1856 return /* @__PURE__ */ React.createElement( 1857 connector.render, 1858 { 1859 key: connector.slug, 1860 slug: connector.slug, 1861 name: connector.name, 1862 description: connector.description, 1863 type: connector.type, 1864 logo: connector.logo, 1865 authentication: connector.authentication, 1866 plugin: connector.plugin 1867 } 1868 ); 1869 } 1870 return null; 1871 } 1872 ))), 1873 canInstallPlugins && !isFileModDisabled && /* @__PURE__ */ React.createElement("p", null, (0, import_element11.createInterpolateElement)( 1874 (0, import_i18n4.__)( 1875 "If the connector you need is not listed, <a>search the plugin directory</a> to see if a connector is available." 1876 ), 1877 { 1878 a: ( 1879 // eslint-disable-next-line jsx-a11y/anchor-has-content 1880 /* @__PURE__ */ React.createElement("a", { href: "plugin-install.php?s=connector&tab=search&type=tag" }) 1881 ) 1882 } 1883 )) 1884 ) 1885 ); 1886 } 1887 function Stage() { 1888 return /* @__PURE__ */ React.createElement(ConnectorsPage, null); 1889 } 1890 var stage = Stage; 1891 export { 1892 stage 1893 };
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated : Sat Jun 13 09:38:55 2026 | Cross-referenced by PHPXref |