1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[461],{1461:(e,t,i)=>{i.d(t,{Bb:()=>h,TF:()=>C,ob:()=>A});var s,n=["bottom","height","left","right","top","width"],r=new Map,o=function e(){var t=[];r.forEach(function(e,i){var s,r,o=i.getBoundingClientRect();s=o,r=e.rect,void 0===s&&(s={}),void 0===r&&(r={}),n.some(function(e){return s[e]!==r[e]})&&(e.rect=o,t.push(e))}),t.forEach(function(e){e.callbacks.forEach(function(t){return t(e.rect)})}),s=window.requestAnimationFrame(e)},a=class e{static CSS_VAR_Z_INDEX="--directus-visual-editing--overlay--z-index";static CSS_VAR_BORDER_SPACING="--directus-visual-editing--rect--border-spacing";static CSS_VAR_BORDER_WIDTH="--directus-visual-editing--rect--border-width";static CSS_VAR_BORDER_COLOR="--directus-visual-editing--rect--border-color";static CSS_VAR_BORDER_RADIUS="--directus-visual-editing--rect--border-radius";static CSS_VAR_HOVER_OPACITY="--directus-visual-editing--rect-hover--opacity";static CSS_VAR_HIGHLIGHT_OPACITY="--directus-visual-editing--rect-highlight--opacity";static CSS_VAR_ACTIONS_GAP="--directus-visual-editing--actions--gap";static CSS_VAR_ACTIONS_OFFSET="--directus-visual-editing--actions--offset";static CSS_VAR_FOCUS_RING_COLOR="--directus-visual-editing--actions--focus-ring-color";static CSS_VAR_FOCUS_RING_WIDTH="--directus-visual-editing--actions--focus-ring-width";static CSS_VAR_FOCUS_RING_OFFSET="--directus-visual-editing--actions--focus-ring-offset";static CSS_VAR_BUTTON_WIDTH="--directus-visual-editing--edit-btn--width";static CSS_VAR_BUTTON_HEIGHT="--directus-visual-editing--edit-btn--height";static CSS_VAR_BUTTON_RADIUS="--directus-visual-editing--edit-btn--radius";static CSS_VAR_EDIT_BUTTON_BG_COLOR="--directus-visual-editing--edit-btn--bg-color";static CSS_VAR_EDIT_BUTTON_HOVER_BG_COLOR="--directus-visual-editing--edit-btn-hover--bg-color";static CSS_VAR_EDIT_BUTTON_ICON_BG_IMAGE="--directus-visual-editing--edit-btn--icon-bg-image";static CSS_VAR_EDIT_BUTTON_ICON_BG_SIZE="--directus-visual-editing--edit-btn--icon-bg-size";static CSS_VAR_AI_BUTTON_BG_COLOR="--directus-visual-editing--ai-btn--bg-color";static CSS_VAR_AI_BUTTON_HOVER_BG_COLOR="--directus-visual-editing--ai-btn-hover--bg-color";static CSS_VAR_AI_BUTTON_ICON_BG_IMAGE="--directus-visual-editing--ai-btn--icon-bg-image";static CSS_VAR_AI_BUTTON_ICON_BG_SIZE="--directus-visual-editing--ai-btn--icon-bg-size";static ICON_EDIT='url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="%23ffffff"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M14.06 9.02l.92.92L5.92 19H5v-.92l9.06-9.06M17.66 3c-.25 0-.51.1-.7.29l-1.83 1.83 3.75 3.75 1.83-1.83c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.2-.2-.45-.29-.71-.29zm-3.6 3.19L3 17.25V21h3.75L17.81 9.94l-3.75-3.75z"/></svg>\')';static ICON_AI='url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px"><path fill="%23ffffff" d="M10 14.175L11 12l2.175-1L11 10l-1-2.175L9 10l-2.175 1L9 12l1 2.175ZM10 19l-2.5-5.5L2 11l5.5-2.5L10 3l2.5 5.5L18 11l-5.5 2.5L10 19Zm8 2l-1.25-2.75L14 17l2.75-1.25L18 13l1.25 2.75L22 17l-2.75 1.25L18 21Zm-8-10Z"/></svg>\')';static OVERLAY_ID="directus-visual-editing";static STYLE_ID="directus-visual-editing-style";static CONTAINER_RECT_CLASS_NAME="directus-visual-editing-overlay";static RECT_CLASS_NAME="directus-visual-editing-rect";static RECT_HIGHLIGHT_CLASS_NAME="directus-visual-editing-rect-highlight";static RECT_HIGHLIGHT_ACTIVE_CLASS_NAME="directus-visual-editing-rect-highlight-active";static RECT_PARENT_HOVER_CLASS_NAME="directus-visual-editing-rect-parent-hover";static RECT_HOVER_CLASS_NAME="directus-visual-editing-rect-hover";static RECT_INNER_CLASS_NAME="directus-visual-editing-rect-inner";static RECT_BUTTON_CLASS_NAME="directus-visual-editing-button";static RECT_EDIT_BUTTON_CLASS_NAME="directus-visual-editing-edit-button";static RECT_AI_BUTTON_CLASS_NAME="directus-visual-editing-ai-button";static RECT_ACTIONS_FLIPPED_CLASS_NAME="directus-visual-editing-actions-flipped";static getGlobalOverlay(){let t=document.getElementById(e.OVERLAY_ID);if(t)return t;let i=document.createElement("div");return i.id=e.OVERLAY_ID,document.body.insertAdjacentElement("afterend",i),i}static addStyles(){if(document.getElementById(e.STYLE_ID))return;let t=document.createElement("style");t.id=e.STYLE_ID;let i=new d().getTheme(),s={primaryColor:i?.primaryColor?.trim()||"#6644ff",primaryAccentColor:i?.primaryAccentColor?.trim()||"color-mix(in srgb, #6644ff, #2e3C43 25%)",borderRadius:i?.borderRadius?.trim()||"6px",buttonSize:i?.buttonSize?.trim()||"24px",focusRingWidth:i?.focusRingWidth?.trim()||"2px",focusRingOffset:i?.focusRingOffset?.trim()||"2px"},n=`var(${e.CSS_VAR_ACTIONS_GAP}, 4px)`,r=`var(${e.CSS_VAR_ACTIONS_OFFSET}, 4px)`,o=`var(${e.CSS_VAR_EDIT_BUTTON_BG_COLOR}, ${s.primaryColor})`,a=`var(${e.CSS_VAR_AI_BUTTON_BG_COLOR}, ${s.primaryColor})`,l=`var(${e.CSS_VAR_EDIT_BUTTON_HOVER_BG_COLOR}, ${s.primaryAccentColor})`,c=`var(${e.CSS_VAR_AI_BUTTON_HOVER_BG_COLOR}, ${s.primaryAccentColor})`,_=`var(${e.CSS_VAR_BUTTON_WIDTH}, ${s.buttonSize})`,E=`var(${e.CSS_VAR_BUTTON_HEIGHT}, ${s.buttonSize})`,h=`var(${e.CSS_VAR_BUTTON_RADIUS}, ${s.borderRadius})`,C=`var(${e.CSS_VAR_BORDER_SPACING}, 8px)`,A=`var(${e.CSS_VAR_BORDER_WIDTH}, ${s.focusRingWidth})`,S=`var(${e.CSS_VAR_BORDER_COLOR}, ${s.primaryColor})`,T=`var(${e.CSS_VAR_BORDER_RADIUS}, ${s.borderRadius})`,u=`var(${e.CSS_VAR_FOCUS_RING_COLOR}, ${s.primaryColor})`,g=`var(${e.CSS_VAR_FOCUS_RING_WIDTH}, ${s.focusRingWidth})`,v=`var(${e.CSS_VAR_FOCUS_RING_OFFSET}, ${s.focusRingOffset})`;t.appendChild(document.createTextNode(` 2 #${e.OVERLAY_ID} { 3 display: contents; 4 } 5 .${e.CONTAINER_RECT_CLASS_NAME} { 6 pointer-events: none; 7 position: fixed; 8 inset: 0; 9 z-index: var(${e.CSS_VAR_Z_INDEX}, 999999999); 10 } 11 .${e.RECT_CLASS_NAME} { 12 position: absolute; 13 /* Use non-logical properties to correctly position the rect with transform translate in RTL mode */ 14 top: 0; 15 left: 0; 16 } 17 .${e.RECT_INNER_CLASS_NAME} { 18 position: absolute; 19 box-sizing: border-box; 20 inset-block-start: calc(-1 * ${C}); 21 inset-inline-start: calc(-1 * ${C}); 22 inset-inline-end: calc(-1 * ${C}); 23 inset-block-end: calc(-1 * ${C}); 24 border: ${A} solid ${S}; 25 border-radius: ${T}; 26 opacity: 0; 27 } 28 .${e.RECT_CLASS_NAME}.${e.RECT_HOVER_CLASS_NAME} .${e.RECT_INNER_CLASS_NAME} { 29 --hover-opacity: var(${e.CSS_VAR_HOVER_OPACITY}, 0.333); 30 opacity: var(--hover-opacity); 31 } 32 .${e.RECT_CLASS_NAME}.${e.RECT_PARENT_HOVER_CLASS_NAME} .${e.RECT_INNER_CLASS_NAME} { 33 opacity: calc(var(--hover-opacity) / 3); 34 } 35 .${e.RECT_HIGHLIGHT_CLASS_NAME} { 36 pointer-events: all; 37 cursor: pointer; 38 } 39 .${e.RECT_HIGHLIGHT_CLASS_NAME} .${e.RECT_INNER_CLASS_NAME} { 40 opacity: var(${e.CSS_VAR_HIGHLIGHT_OPACITY}, 0.333); 41 } 42 .${e.RECT_BUTTON_CLASS_NAME}:visited, 43 .${e.RECT_BUTTON_CLASS_NAME}:active, 44 .${e.RECT_BUTTON_CLASS_NAME}:hover, 45 .${e.RECT_BUTTON_CLASS_NAME}:focus, 46 .${e.RECT_BUTTON_CLASS_NAME} { 47 all: initial; 48 pointer-events: all; 49 cursor: pointer; 50 position: absolute; 51 z-index: 1; 52 inset-block-end: 100%; 53 margin-block-end: calc((${C} + ${r})); 54 inline-size: ${_}; 55 block-size: ${E}; 56 border-radius: ${h}; 57 background-position: center; 58 background-repeat: no-repeat; 59 opacity: 0; 60 } 61 .${e.RECT_BUTTON_CLASS_NAME}::after { 62 content: ''; 63 position: absolute; 64 inset-inline: calc(-1 * ${n} / 2); 65 inset-block-start: 0; 66 inset-block-end: calc(-1 * ${r}); 67 } 68 .${e.RECT_BUTTON_CLASS_NAME}.${e.RECT_EDIT_BUTTON_CLASS_NAME} { 69 inset-inline-start: calc(-1 * ${C}); 70 background-color: ${o}; 71 background-image: var(${e.CSS_VAR_EDIT_BUTTON_ICON_BG_IMAGE}, ${e.ICON_EDIT}); 72 background-size: var(${e.CSS_VAR_EDIT_BUTTON_ICON_BG_SIZE}, 66.6%); 73 } 74 .${e.RECT_BUTTON_CLASS_NAME}.${e.RECT_AI_BUTTON_CLASS_NAME} { 75 inset-inline-start: calc(-1 * ${C} + ${_} + ${n}); 76 background-color: ${a}; 77 background-image: var(${e.CSS_VAR_AI_BUTTON_ICON_BG_IMAGE}, ${e.ICON_AI}); 78 background-size: var(${e.CSS_VAR_AI_BUTTON_ICON_BG_SIZE}, 66.6%); 79 } 80 .${e.RECT_CLASS_NAME}.${e.RECT_HOVER_CLASS_NAME}:not(.${e.RECT_PARENT_HOVER_CLASS_NAME}) .${e.RECT_BUTTON_CLASS_NAME}, 81 .${e.RECT_HIGHLIGHT_ACTIVE_CLASS_NAME} .${e.RECT_INNER_CLASS_NAME}, 82 .${e.RECT_HIGHLIGHT_CLASS_NAME}:hover .${e.RECT_BUTTON_CLASS_NAME}, 83 .${e.RECT_BUTTON_CLASS_NAME}:hover, 84 .${e.RECT_BUTTON_CLASS_NAME}:hover ~ .${e.RECT_INNER_CLASS_NAME}, 85 .${e.RECT_HIGHLIGHT_CLASS_NAME}:hover .${e.RECT_INNER_CLASS_NAME}, 86 .${e.RECT_CLASS_NAME}:has(.${e.RECT_BUTTON_CLASS_NAME}:hover) .${e.RECT_BUTTON_CLASS_NAME}, 87 .${e.RECT_HIGHLIGHT_CLASS_NAME}:focus-within .${e.RECT_BUTTON_CLASS_NAME}, 88 .${e.RECT_BUTTON_CLASS_NAME}:focus-visible, 89 .${e.RECT_BUTTON_CLASS_NAME}:focus-visible ~ .${e.RECT_INNER_CLASS_NAME}, 90 .${e.RECT_HIGHLIGHT_CLASS_NAME}:focus-within .${e.RECT_INNER_CLASS_NAME}, 91 .${e.RECT_CLASS_NAME}:has(.${e.RECT_BUTTON_CLASS_NAME}:focus-within) .${e.RECT_BUTTON_CLASS_NAME} { 92 opacity: 1; 93 } 94 .${e.RECT_BUTTON_CLASS_NAME}.${e.RECT_EDIT_BUTTON_CLASS_NAME}:hover { 95 background-color: ${l}; 96 } 97 .${e.RECT_BUTTON_CLASS_NAME}.${e.RECT_AI_BUTTON_CLASS_NAME}:hover { 98 background-color: ${c}; 99 } 100 .${e.RECT_CLASS_NAME}.${e.RECT_ACTIONS_FLIPPED_CLASS_NAME} .${e.RECT_BUTTON_CLASS_NAME} { 101 inset-block-end: auto; 102 inset-block-start: 100%; 103 margin-block-start: calc(${C} + ${r}); 104 } 105 .${e.RECT_CLASS_NAME}.${e.RECT_ACTIONS_FLIPPED_CLASS_NAME} .${e.RECT_BUTTON_CLASS_NAME}::after { 106 inset-block-start: calc(-1 * ${r}); 107 inset-block-end: 0; 108 } 109 .${e.RECT_BUTTON_CLASS_NAME}:focus-visible { 110 outline: ${g} solid ${u}; 111 outline-offset: ${v}; 112 } 113 `)),document.head.appendChild(t)}},l=class e{static NEAR_TOP_THRESHOLD=54;hasNoDimensions=!1;element;container;editButton;aiButton;constructor(){this.container=this.createContainer(),this.element=this.createElement(),this.editButton=this.createEditButton();let e=new d;this.aiButton=e.isAiEnabled()?this.createAiButton():null,this.setMessages(e.getMessages()),this.createRectElement(),a.getGlobalOverlay().appendChild(this.container),_.highlightOverlayElements&&this.toggleHighlight(!0),this.element.addEventListener("click",e=>{let t=e.target;t&&(this.editButton.contains(t)||this.aiButton?.contains(t))||this.editButton.click()})}createContainer(){let e=document.createElement("div");return e.classList.add(a.CONTAINER_RECT_CLASS_NAME),e}createElement(){let e=document.createElement("div");return e.classList.add(a.RECT_CLASS_NAME),this.container.appendChild(e),e}createRectElement(){let e=document.createElement("div");e.classList.add(a.RECT_INNER_CLASS_NAME),this.element.appendChild(e)}createEditButton(){let e=document.createElement("button");return e.type="button",e.classList.add(a.RECT_BUTTON_CLASS_NAME),e.classList.add(a.RECT_EDIT_BUTTON_CLASS_NAME),this.element.appendChild(e),e}createAiButton(){let e=document.createElement("button");return e.type="button",e.classList.add(a.RECT_BUTTON_CLASS_NAME),e.classList.add(a.RECT_AI_BUTTON_CLASS_NAME),this.element.appendChild(e),e}setMessages(e){e&&(this.editButton.title=e.edit,this.editButton.setAttribute("aria-label",e.edit),this.aiButton&&(this.aiButton.title=e.addToContext,this.aiButton.setAttribute("aria-label",e.addToContext)))}updateRect(t){let i=0!==t.width&&0!==t.height;if(!this.hasNoDimensions&&!i){this.hasNoDimensions=!0,this.disable();return}this.hasNoDimensions&&i&&(this.hasNoDimensions=!1,this.enable()),this.element.style.width=`${t.width}px`,this.element.style.height=`${t.height}px`,this.element.style.transform=`translate(${t.left}px,${t.top}px)`,this.element.classList.toggle(a.RECT_ACTIONS_FLIPPED_CLASS_NAME,t.top<e.NEAR_TOP_THRESHOLD)}setCustomClass(e){void 0!==e&&/^[a-zA-Z_][\w-]*$/.test(e)&&this.container.classList.add(e)}toggleHover(e){this.element.classList.toggle(a.RECT_HOVER_CLASS_NAME,e)}toggleParentHover(e){this.element.classList.toggle(a.RECT_PARENT_HOVER_CLASS_NAME,e)}toggleHighlight(e){this.element.classList.toggle(a.RECT_HIGHLIGHT_CLASS_NAME,e)}toggleHighlightActive(e){this.element.classList.toggle(a.RECT_HIGHLIGHT_ACTIVE_CLASS_NAME,e)}disable(){this.element.style.display="none"}enable(){this.element.style.removeProperty("display")}remove(){this.container.remove()}},c=class e{static DATASET="directus";static DATA_ATTRIBUTE_VALID_KEYS=["collection","item","fields","mode"];activated=!1;optionsWritable=!0;customClass=void 0;element;key;editConfig;rectObserver;overlayElement;rect;hover=!1;disabled=!1;onSaved=void 0;boundMouseenter;boundMouseleave;constructor(t){this.element=t,this.key=crypto.randomUUID(),this.editConfig=e.editAttrToObject(this.element.dataset[e.DATASET])}activate(){var e,t;this.activated||(this.activated=!0,this.boundMouseenter=this.onMouseenter.bind(this),this.boundMouseleave=this.onMouseleave.bind(this),this.element.addEventListener("mouseenter",this.boundMouseenter),this.element.addEventListener("mouseleave",this.boundMouseleave),this.rect=this.element.getBoundingClientRect(),this.overlayElement=new l,this.overlayElement.setCustomClass(this.customClass),this.overlayElement.updateRect(this.rect),this.overlayElement.editButton.addEventListener("click",this.onClickEdit.bind(this)),this.overlayElement.aiButton?.addEventListener("click",this.onClickAddToContext.bind(this)),this.rectObserver=(e=this.element,t=this.onObserveRect.bind(this),{observe:function(){var i=0===r.size;r.has(e)?r.get(e).callbacks.push(t):r.set(e,{rect:void 0,hasRectChanged:!1,callbacks:[t]}),i&&o()},unobserve:function(){var i=r.get(e);if(i){var n=i.callbacks.indexOf(t);n>=0&&i.callbacks.splice(n,1),i.callbacks.length||r.delete(e),r.size||cancelAnimationFrame(s)}}}),this.rectObserver.observe())}static query(t){return t?(Array.isArray(t)?t:[t]).filter(e=>e instanceof HTMLElement).flatMap(t=>void 0===t.dataset[e.DATASET]?Array.from(t.querySelectorAll(`[data-${e.DATASET}]`)):t).filter(e=>null!==e):Array.from(document.querySelectorAll(`[data-${e.DATASET}]`))}static objectToEditAttr(t){let i=[];for(let[s,n]of Object.entries(t))e.validEditConfigKey(s)&&("fields"===s&&Array.isArray(n)?i.push(`${s}:${n.join(",")}`):i.push(`${s}:${n}`));return i.join(";")}static editAttrToObject(t){let i=t.split(";"),s={};
113return i.forEach(t=>{let i=t.split(":");if(void 0===i[0]||i?.[1]===void 0)return;let n=i[0].trim();if(!e.validEditConfigKey(n))return;let r=i[1];if("fields"===n){s.fields=r.split(",").map(e=>e.trim());return}s[n]=r.trim()}),s}static validEditConfigKey(t){return e.DATA_ATTRIBUTE_VALID_KEYS.includes(t)}applyOptions({customClass:e,onSaved:t},i=!1){this.optionsWritable&&(i&&(this.optionsWritable=!1),void 0!==t&&(this.onSaved=t),this.overlayElement?this.overlayElement.setCustomClass(e):this.customClass=e)}removeHoverListener(){this.boundMouseenter&&(this.element.removeEventListener("mouseenter",this.boundMouseenter),this.element.removeEventListener("mouseleave",this.boundMouseleave))}onClickEdit(){new d().send("edit",{key:this.key,editConfig:this.editConfig,rect:this.rect})}onClickAddToContext(e){e.stopPropagation(),new d().send("addToContext",{key:this.key,editConfig:this.editConfig,rect:this.rect})}onMouseenter(e){this.toggleItemHover(!0,e)}onMouseleave(e){this.toggleItemHover(!1,e)}toggleItemHover(e,t){this.element!==t.currentTarget||this.hover===e||(this.hover=e,this.setParentsHover(),this.overlayElement.toggleHover(e))}setParentsHover(){let e=_.getHoveredItems();e.forEach(t=>{let i=e.filter(e=>e.element!==t.element).some(e=>t.element.contains(e.element));t.overlayElement.toggleParentHover(i)})}onObserveRect(e){this.disabled||(this.rect=e,this.overlayElement?.updateRect(e))}},_=class e{static items=[];static highlightOverlayElements=!1;static highlightedKey=null;static getItem(t){return e.items.find(e=>e.element===t)}static getItemByKey(t){return e.items.find(e=>e.key===t)}static getItemByEditConfig(t,i,s){return e.items.find(e=>{if(e.editConfig.collection!==t||String(e.editConfig.item)!==String(i))return!1;let n=e.editConfig.fields??[],r=s??[];return n.length===r.length&&n.every(e=>r.includes(e))})}static getHoveredItems(){return e.items.filter(e=>e.hover)}static addItem(t){e.items.push(t)}static activateItems(t){e.items.forEach(e=>{t.includes(e.key)&&e.activate()})}static enableItems(t){(t??e.items).forEach(e=>{e.disabled=!1,e.rectObserver?.observe(),e.overlayElement?.enable()})}static disableItems(t){let i=t??e.items.filter(e=>!e.disabled);return i.forEach(e=>{e.disabled=!0,e.hover=!1,e.rectObserver?.unobserve(),e.overlayElement?.disable()}),[...i]}static removeItems(t){let i=t??e.items;i.forEach(e=>{e.rectObserver?.unobserve(),e.overlayElement?.remove(),e.removeHoverListener()}),e.items=e.items.filter(e=>!i.includes(e))}static highlightItems(t){this.highlightOverlayElements!==t&&(this.highlightOverlayElements=t,e.items.forEach(e=>{e.overlayElement?.toggleHighlight(t)}))}static highlightElement(t){let i;if(null!==this.highlightedKey&&e.getItemByKey(this.highlightedKey)?.overlayElement?.toggleHighlightActive(!1),null===t){this.highlightedKey=null;return}(i="key"in t?e.getItemByKey(t.key):e.getItemByEditConfig(t.collection,t.item,t.fields))?(this.highlightedKey=i.key,i.overlayElement?.toggleHighlightActive(!0)):this.highlightedKey=null}},d=class e{static SINGLETON;static ERROR_PARENT_NOT_FOUND="Error sending message to Directus in parent frame:";origin=null;confirmed=!1;aiEnabled=!1;theme=null;messages=null;constructor(){if(e.SINGLETON)return e.SINGLETON;e.SINGLETON=this,window?.addEventListener("message",this.receive.bind(this))}isAiEnabled(){return this.aiEnabled}getTheme(){return this.theme}getMessages(){return this.messages}send(t,i){try{if(!this.origin)throw Error();return window.parent.postMessage({action:t,data:i},this.origin),!0}catch(t){return console.error(e.ERROR_PARENT_NOT_FOUND,t),!1}}connect(e){return this.origin=e,this.send("connect")}receive(e){if(!this.origin||!function(e,t){try{return new URL(e).origin===new URL(t).origin}catch{return!1}}(e.origin,this.origin))return;let{action:t,data:i}=e.data;"confirm"===t&&this.receiveConfirmAction(i),"activateElements"===t&&this.receiveActivateElements(i),"showEditableElements"===t&&this.receiveShowEditableElements(i),"saved"===t&&this.receiveSaved(i),"highlightElement"===t&&this.receiveHighlightElement(i)}receiveConfirm(){let e=0;return new Promise(t=>{let i=()=>
113{if(e>=10)return t(!1);e++,this.confirmed?t(!0):setTimeout(i,100)};i()})}receiveConfirmAction(e){this.confirmed=!0,this.aiEnabled=!!e?.aiEnabled,this.theme=e?.theme??null,this.messages=e?.messages??null}receiveActivateElements(e){let t=Array.isArray(e)?e:[];_.activateItems(t)}receiveShowEditableElements(e){_.highlightItems(!!e)}receiveSaved(e){let{key:t="",collection:i="",item:s=null,payload:n={}}=e,r=_.getItemByKey(t);if(r&&i&&"function"==typeof r.onSaved)return void r.onSaved({collection:i,item:s,payload:n});window.location.reload()}receiveHighlightElement(e){if(!e||"object"!=typeof e)return void _.highlightElement(null);let{key:t,collection:i,item:s,fields:n}=e;null===t?_.highlightElement(null):i&&void 0!==s?_.highlightElement(n?{collection:i,item:s,fields:n}:{collection:i,item:s}):"string"==typeof t&&_.highlightElement({key:t})}},E=class e{static navigationInitialized=!1;static onNavigation(t){if(e.navigationInitialized)return;let i="",s="",n,r=()=>{let e=window.location.href,o=document.title,a=i!==e||s!==o;a&&(clearTimeout(n),n=setTimeout(()=>t({url:e,title:o}),100),i=e,s=o),setTimeout(r,a?50:200)};r(),e.navigationInitialized=!0}};async function h({directusUrl:e,elements:t,customClass:i,onSaved:s}){let n=new d;if(!n.connect(e)||!await n.receiveConfirm())return;E.onNavigation(e=>n.send("navigation",e)),a.addStyles();let r=c.query(t),o=[],l=[];return r.forEach(e=>{let n=_.getItem(e),r=n??new c(e);r.applyOptions({customClass:i,onSaved:s},!!t),o.push(r),n||(_.addItem(r),l.push({key:r.key,collection:r.editConfig.collection,item:r.editConfig.item,fields:r.editConfig.fields??[]}))}),l.length&&n.send("checkFieldAccess",l),{remove(){_.removeItems(o)},enable(){_.enableItems(o)},disable(){_.disableItems(o)}}}function C(){_.removeItems()}function A(e){return c.objectToEditAttr(e)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.