function e(e,t){const n=self.Runtime.cachedResources[t]||"";n||console.error(t+" not preloaded. Check module.json");let o=createElement("style");o.textContent=n,e.appendChild(o);const r=self.UI.themeSupport.themeStyleSheet(t,n);r&&(o=createElement("style"),o.textContent=r+"\n"+Root.Runtime.resolveSourceURL(t+".theme"),e.appendChild(o))}function t(e){const t=e.target&&e.target.ownerDocument,n=t?t.deepActiveElement():null;!function(e){for(;e&&!e.__widget;)e=e.parentNodeOrShadowHost();if(!e)return;let t=e.__widget;for(;t._parentWidget;)t._parentWidget._defaultFocusedChild=t,t=t._parentWidget}(n),function(e){e=e&&e.parentNodeOrShadowHost();const t=customElements.get("x-widget");let n=null;for(;e;)e instanceof t&&(n&&(e._defaultFocusedElement=n),n=e),e=e.parentNodeOrShadowHost()}(n),UI._keyboardFocus&&function(e){e.setAttribute("data-keyboard-focus","true"),e.addEventListener("blur",()=>e.removeAttribute("data-keyboard-focus"),{once:!0,capture:!0})}(n)}function n(t){e(t,"ui/inspectorCommon.css"),e(t,"ui/textButton.css"),self.UI.themeSupport.injectHighlightStyleSheets(t),self.UI.themeSupport.injectCustomStyleSheets(t)}function o(o,r,s){const d=o.attachShadow({mode:"open",delegatesFocus:s});return n(d),r&&e(d,r),d.addEventListener("focus",t.bind(UI),!0),d}let r;function s(e){if("number"==typeof r)return r;if(!e)return 16;const t=e.createElement("div"),n=e.createElement("div");return t.setAttribute("style","display: block; width: 100px; height: 100px; overflow: scroll;"),n.setAttribute("style","height: 200px"),t.appendChild(n),e.body.appendChild(t),r=t.offsetWidth-t.clientWidth,e.body.removeChild(t),r}function d(e,t,n){return self.customElements.define(t,class extends n{constructor(){super(),this.setAttribute("is",t)}},{extends:e}),()=>createElement(e,t)}export{e as appendStyle,o as createShadowRootWithCoreStyles,t as focusChanged,n as injectCoreStyles,s as measuredScrollbarWidth,d as registerCustomElement};
