diff --git a/build/es6/node_modules/@lrnwebcomponents/clean-one/clean-one.js b/build/es6/node_modules/@lrnwebcomponents/clean-one/clean-one.js index 1baa0906462..99c0328a47b 100644 --- a/build/es6/node_modules/@lrnwebcomponents/clean-one/clean-one.js +++ b/build/es6/node_modules/@lrnwebcomponents/clean-one/clean-one.js @@ -754,7 +754,7 @@ import{html as e,css as t}from"../../lit/index.js";import{HAXCMSLitElementTheme .part="${this.editMode?"edit-mode-active":""}" > - `}searchChanged(e){e.detail.value?import("../haxcms-elements/lib/ui-components/site/site-search.js").then((()=>{this.searchTerm=e.detail.value})):this.searchTerm=""}static get properties(){return{...super.properties,searchTerm:{type:String}}}static get tag(){return"clean-one"}constructor(){super(),this.HAXCMSThemeSettings.autoScroll=!0,import("../haxcms-elements/lib/ui-components/navigation/site-menu-button.js"),import("../haxcms-elements/lib/ui-components/site/site-print-button.js"),import("../haxcms-elements/lib/ui-components/site/site-rss-button.js"),import("../haxcms-elements/lib/ui-components/active-item/site-git-corner.js"),this.__disposer=this.__disposer?this.__disposer:[],c((e=>{this.activeManifestIndex=m(l.activeManifestIndex),this.searchTerm="",this.__disposer.push(e)}))}firstUpdated(e){super.firstUpdated&&super.firstUpdated(e),document.body.style.overflow="hidden",this.HAXCMSThemeSettings.scrollTarget=this.shadowRoot.querySelector("#body"),window.AbsolutePositionStateManager.requestAvailability().scrollTarget=this.HAXCMSThemeSettings.scrollTarget,this.shadowRoot.querySelector("scroll-button").target=this.shadowRoot.querySelector("#haxcms-theme-top")}HAXCMSGlobalStyleSheetContent(){return[...super.HAXCMSGlobalStyleSheetContent(),t` + `}searchChanged(e){e.detail.value?import("../haxcms-elements/lib/ui-components/site/site-search.js").then((()=>{"search"!==l.getInternalRoute()&&window.history.replaceState({},null,"x/search"),this.searchTerm=e.detail.value})):this.searchTerm=""}static get properties(){return{...super.properties,searchTerm:{type:String}}}static get tag(){return"clean-one"}constructor(){super(),this.searchTerm="",this.HAXCMSThemeSettings.autoScroll=!0,import("../haxcms-elements/lib/ui-components/navigation/site-menu-button.js"),import("../haxcms-elements/lib/ui-components/site/site-print-button.js"),import("../haxcms-elements/lib/ui-components/site/site-rss-button.js"),import("../haxcms-elements/lib/ui-components/active-item/site-git-corner.js"),this.__disposer=this.__disposer?this.__disposer:[],c((e=>{this.activeManifestIndex=m(l.activeManifestIndex),this.searchTerm="",this.__disposer.push(e)}))}firstUpdated(e){super.firstUpdated&&super.firstUpdated(e),document.body.style.overflow="hidden",this.HAXCMSThemeSettings.scrollTarget=this.shadowRoot.querySelector("#body"),window.AbsolutePositionStateManager.requestAvailability().scrollTarget=this.HAXCMSThemeSettings.scrollTarget,this.shadowRoot.querySelector("scroll-button").target=this.shadowRoot.querySelector("#haxcms-theme-top");const t=new URLSearchParams(l.currentRouterLocation.search);"search"===l.getInternalRoute()&&t.get("search")&&import("../haxcms-elements/lib/ui-components/site/site-search.js").then((()=>{this.searchTerm=t.get("search"),this.shadowRoot.querySelector("clean-one-search-box").focus(),setTimeout((()=>{this.shadowRoot.querySelector("clean-one-search-box").select()}),0)}))}HAXCMSGlobalStyleSheetContent(){return[...super.HAXCMSGlobalStyleSheetContent(),t` clean-one a { text-decoration-thickness: 3px; } diff --git a/build/es6/node_modules/@lrnwebcomponents/clean-one/lib/clean-one-search-box.js b/build/es6/node_modules/@lrnwebcomponents/clean-one/lib/clean-one-search-box.js index 99dc5266aec..6366b8982da 100644 --- a/build/es6/node_modules/@lrnwebcomponents/clean-one/lib/clean-one-search-box.js +++ b/build/es6/node_modules/@lrnwebcomponents/clean-one/lib/clean-one-search-box.js @@ -1,4 +1,4 @@ -import{LitElement as e,html as t,css as n}from"../../../lit/index.js";import{I18NMixin as a}from"../../i18n-manager/lib/I18NMixin.js";export class CleanOneSearchBox extends(a(e)){static get tag(){return"clean-one-search-box"}static get styles(){return[n` +import{LitElement as e,html as t,css as o}from"../../../lit/index.js";import{I18NMixin as a}from"../../i18n-manager/lib/I18NMixin.js";export class CleanOneSearchBox extends(a(e)){static get tag(){return"clean-one-search-box"}static get styles(){return[o` :host { display: block; } @@ -19,7 +19,7 @@ import{LitElement as e,html as t,css as n}from"../../../lit/index.js";import{I18 padding: 7px 7px; color: inherit; } - `]}constructor(){super(),this.value="",this.t={searchSiteContent:"Search site content",typeToSearch:"Type to search"},this.registerLocalization({context:this,namespace:"clean-one",localesPath:new URL("../locales",import.meta.url).href,locales:["es","fr","de","ja"]})}render(){return t` + `]}constructor(){super(),this.value="",this.t={searchSiteContent:"Search site content",typeToSearch:"Type to search"},this.registerLocalization({context:this,namespace:"clean-one",localesPath:new URL("../locales",import.meta.url).href,locales:["es","fr","de","ja"]})}focus(){this.shadowRoot&&this.shadowRoot.querySelector("input")&&this.shadowRoot.querySelector("input").focus()}select(){this.shadowRoot&&this.shadowRoot.querySelector("input")&&this.shadowRoot.querySelector("input").select()}render(){return t` {this.searchTerm=t.value})):this.searchTerm=""}render(){return e` + `]}firstUpdated(e){super.firstUpdated&&super.firstUpdated(e),document.body.style.overflow="hidden",this.HAXCMSThemeSettings.scrollTarget=this.shadowRoot.querySelector(".body-wrapper"),window.AbsolutePositionStateManager.requestAvailability().scrollTarget=this.HAXCMSThemeSettings.scrollTarget,c.internalRoutes.search.callback=this.siteModalForceClick}searchItemSelected(e){this.searchTerm=""}searchChanged(e){var t=h(e)[0];t.value?import("../haxcms-elements/lib/ui-components/site/site-search.js").then((()=>{this.searchTerm=t.value})):this.searchTerm=""}render(){return e`
${this.HAXCMSMobileMenu()}
@@ -569,6 +585,10 @@ import{html as e,css as t}from"../../lit/index.js";import{HAXCMSLitElementTheme
+
`:""}
- `}__prevPageLabelChanged(e){this.prevPage=e.detail.value}__nextPageLabelChanged(e){this.nextPage=e.detail.value}static get properties(){let e={};return super.properties&&(e=super.properties),{...e,searchTerm:{type:String},prevPage:{type:String},nextPage:{type:String},pageTimestamp:{type:Number}}}static get tag(){return"clean-two"}constructor(){super(),this.HAXCMSThemeSettings.autoScroll=!0,this.searchTerm="",this.__disposer=this.__disposer?this.__disposer:[],c((e=>{this.activeManifestIndex=m(p.activeManifestIndex),this.__disposer.push(e)})),c((()=>{if(!1===m(p.badDevice)){const e=document.createElement("link");e.setAttribute("href","https://fonts.googleapis.com/css2?family=Open+Sans&display=swap"),e.setAttribute("rel","stylesheet"),e.setAttribute("fetchpriority","low"),document.head.appendChild(e)}})),c((e=>{p.activeItem&&p.activeItem.metadata&&p.activeItem.metadata.updated&&(this.pageTimestamp=m(p.activeItem.metadata.updated)),this.__disposer.push(e)})),import("../haxcms-elements/lib/ui-components/layout/site-modal.js"),import("../haxcms-elements/lib/ui-components/navigation/site-menu-content.js")}siteModalClick(e){import("../haxcms-elements/lib/ui-components/site/site-search.js").then((e=>{window.SimpleModal.requestAvailability().querySelector("site-search").shadowRoot.querySelector("simple-fields-field").focus()}))}disconnectedCallback(){for(var e in this.__disposer)this.__disposer[e].dispose();super.disconnectedCallback()}}customElements.define(CleanTwo.tag,CleanTwo);export{CleanTwo}; \ No newline at end of file + `}__prevPageLabelChanged(e){this.prevPage=e.detail.value}__nextPageLabelChanged(e){this.nextPage=e.detail.value}static get properties(){let e={};return super.properties&&(e=super.properties),{...e,searchTerm:{type:String},prevPage:{type:String},nextPage:{type:String},pageTimestamp:{type:Number}}}static get tag(){return"clean-two"}constructor(){super(),this.HAXCMSThemeSettings.autoScroll=!0,this.searchTerm="",this.__disposer=this.__disposer?this.__disposer:[],d((e=>{this.activeManifestIndex=m(c.activeManifestIndex),this.__disposer.push(e)})),d((()=>{if(!1===m(c.badDevice)){const e=document.createElement("link");e.setAttribute("href","https://fonts.googleapis.com/css2?family=Open+Sans&display=swap"),e.setAttribute("rel","stylesheet"),e.setAttribute("fetchpriority","low"),document.head.appendChild(e)}})),d((e=>{c.activeItem&&c.activeItem.metadata&&c.activeItem.metadata.updated&&(this.pageTimestamp=m(c.activeItem.metadata.updated)),this.__disposer.push(e)}))}siteModalForceClick(e){setTimeout((()=>{const e=document.querySelector("clean-two");e&&e.shadowRoot&&e.shadowRoot.querySelector("site-modal")&&e.shadowRoot.querySelector("site-modal").shadowRoot&&e.shadowRoot.querySelector("site-modal").shadowRoot.querySelector("simple-icon-button-lite")&&e.shadowRoot.querySelector("site-modal").shadowRoot.querySelector("simple-icon-button-lite").click()}),500)}siteModalClick(e){import("../haxcms-elements/lib/ui-components/site/site-search.js").then((e=>{"search"!==c.getInternalRoute()&&window.history.replaceState({},null,"x/search");const t=new URLSearchParams(c.currentRouterLocation.search),i=window.SimpleModal.requestAvailability().querySelector("site-search").shadowRoot.querySelector("simple-fields-field");i.focus(),t.get("search")&&(i.value=t.get("search"),setTimeout((()=>{i.select()}),0))}))}disconnectedCallback(){for(var e in this.__disposer)this.__disposer[e].dispose();super.disconnectedCallback()}}customElements.define(CleanTwo.tag,CleanTwo);export{CleanTwo}; \ No newline at end of file diff --git a/build/es6/node_modules/@lrnwebcomponents/hax-body/lib/hax-store.js b/build/es6/node_modules/@lrnwebcomponents/hax-body/lib/hax-store.js index 98445075e4e..6ad5564a2f3 100644 --- a/build/es6/node_modules/@lrnwebcomponents/hax-body/lib/hax-store.js +++ b/build/es6/node_modules/@lrnwebcomponents/hax-body/lib/hax-store.js @@ -1,4 +1,4 @@ -import{LitElement as e,html as t,nothing as i}from"../../../lit/index.js";import{SimpleTourManager as a}from"../../simple-popover/lib/simple-tour.js";import{HaxSchematizer as o,HaxElementizer as n}from"../../hax-body-behaviors/lib/HAXFields.js";import{winEventsElement as r,getRange as s,stripMSWord as l,nodeToHaxElement as d,haxElementToNode as c,validURL as h,camelToDash as p,htmlEntities as m,localStorageGet as u,localStorageSet as g}from"../../utils/utils.js";import{observable as x,makeObservable as v,computed as f,configure as b,autorun as y,toJS as w}from"../../../mobx/dist/mobx.esm.js";b({enforceActions:!1});import{HAXElement as S}from"../../hax-body-behaviors/hax-body-behaviors.js";import{I18NMixin as H,I18NManagerStore as T}from"../../i18n-manager/lib/I18NMixin.js";import{enableServices as N}from"../../micro-frontend-registry/lib/microServices.js";import{SuperDaemonInstance as C}from"../../super-daemon/super-daemon.js";import"../../media-behaviors/media-behaviors.js";import"../../simple-toast/simple-toast.js";import"../../editable-table/editable-table.js";import"../../iframe-loader/iframe-loader.js";import{learningComponentTypes as E}from"../../course-design/lib/learning-component.js";import"../../hax-iconset/lib/hax-iconset-manifest.js";import"./hax-app.js";function sessionStorageGet(e){try{return sessionStorage.getItem(e)}catch(e){return!1}}function sessionStorageSet(e,t){try{return sessionStorage.setItem(e,t)}catch(e){return!1}}const A={attribute:"data-style-decoration",title:"Decoration",description:"Some built in styles to highlight material",inputMethod:"select",options:{"":"","mark-blue":"Marker - blue","mark-brown":"Marker - gray","mark-pink":"Marker - pink","mark-red":"Marker - purple","mark-teal":"Marker - green","mark-yellow":"Marker - yellow"}},_={attribute:"data-style-block-decoration",title:"Block Decoration",description:"Some built in styles to offset material",inputMethod:"select",options:{"":"","callout-blue":"Callout - blue","callout-brown":"Callout - brown","callout-pink":"Callout - pink","callout-red":"Callout - purple","callout-teal":"Callout - green","callout-yellow":"Callout - yellow"}},L=[{attribute:"data-instructional-action",title:"Type",description:"Indicates instructional context to users visually",inputMethod:"select",options:{"":"-- none --",...E}},{attribute:"data-id-emphasize",title:"Alternate visual treatment",description:"Apply a different visual treatment to the element but with same meaning",inputMethod:"boolean"}];class HaxStore extends(H(r(S(e)))){testHook(e,t){return!!(e&&e.tagName&&this.HTMLPrimativeTest(e)&&this.primativeHooks[e.tagName.toLowerCase()]&&this.primativeHooks[e.tagName.toLowerCase()][t])||e&&"function"==typeof e.haxHooks&&e.haxHooks()[t]}async runHook(e,t,i=[]){return!!this.testHook(e,t)&&(this.HTMLPrimativeTest(e)?await this.primativeHooks[e.tagName.toLowerCase()][t](...i):await e[e.haxHooks()[t]](...i))}getSelection(){if(this.activeHaxBody&&this.activeHaxBody.parentNode){if(this.activeHaxBody.parentNode.getSelection)return this.activeHaxBody.parentNode.getSelection();try{if(s(this.activeHaxBody.parentNode))return s(this.activeHaxBody.parentNode)}catch(e){}}return window.getSelection()}getRange(){let e=this.getSelection();return e&&e.getRangeAt&&e.rangeCount?e.getRangeAt(0):e||!1}guessGizmo(e,t,i=!1,a=!1){var o=[],n=[];if(void 0!==e&&this.validGizmoTypes.includes(e))for(let r in this.gizmoList){let s=this.gizmoList[r],l=t.innerHTML?{innerHTML:t.innerHTML}:{},d=!1;if(s&&s.handles)for(let r=0;r{t&&t.type&&""!=t.type&&(e[t.type.toLowerCase()]=!0)})),[...s.tags].forEach((t=>{t&&""!=t&&(e[t.toLowerCase()]=!0)})),s.keywords=Object.keys(e),n.includes(s.tag)||(o.push(this.haxElementPrototype(s,l,"")),n.push(s.tag))}}}}return o}insertLogicFromValues(e,t,i=!1,a=!1){let o=this.guessGizmoType(e),n=o,r=!0;if("*"==o){if(i)return!1;r=!1,n="link"}let s=this.guessGizmo(o,e,!1,r);return s.length>0?(1===s.length||a?1===s.length&&void 0!==s[0].tag?t.dispatchEvent(new CustomEvent("hax-insert-content",{bubbles:!0,cancelable:!0,composed:!0,detail:s[0]})):a&&t.dispatchEvent(new CustomEvent("hax-insert-content",{bubbles:!0,cancelable:!0,composed:!0,detail:s.find((e=>"a"==e.tag))})):this.haxAppPicker.presentOptions(s,o,"Pick how to present this "+n,"gizmo"),!0):(this.toast("Sorry, HAX doesn't know how to handle that type of link yet."),!1)}write(e,t,i){i&&i.dispatchEvent(new CustomEvent("hax-store-write",{composed:!0,bubbles:!0,cancelable:!1,detail:{property:e,value:t,owner:i}}))}mimeTypeToGizmoType(e){let t=e.split("/");switch(t[0]){case"audio":return"audio";case"image":return"svg+xml"==t[1]?"svg":"image";case"video":return"video";case"text":return["csv","html","markdown"].includes(t[1])?t[1]:"document";case"application":return"pdf"==t[1]?"pdf":["zip","gzip","x-tar"].includes(t[1])?"archive":"document"}}guessGizmoType(e){if(void 0!==e.source){const t=e.source.toLowerCase();if(-1!=t.indexOf(".mp3")||-1!=t.indexOf(".midi")||-1!=t.indexOf(".mid"))return"audio";if(-1!=t.indexOf(".png")||-1!=t.indexOf(".jpg")||-1!=t.indexOf(".jpeg"))return"image";if(-1!=t.indexOf(".gif"))return"gif";if(-1!=t.indexOf(".pdf"))return"pdf";if(-1!=t.indexOf(".svg"))return"svg";if(-1!=t.indexOf(".csv"))return"csv";if(-1!=t.indexOf(".md"))return"markdown";if(-1!=t.indexOf(".html")||-1!=t.indexOf(".htm"))return"html";if(-1!=t.indexOf(".txt")||-1!=t.indexOf(".doc")||-1!=t.indexOf(".docx")||-1!=t.indexOf(".xls")||-1!=t.indexOf(".xlsx")||-1!=t.indexOf(".vtt")||-1!=t.indexOf(".ppt"))return"document";if(-1!=t.indexOf(".zip")||-1!=t.indexOf(".tar.gz")||-1!=t.indexOf(".tar"))return"archive";if("external"!=window.MediaBehaviors.Video.getVideoType(t))return"video"}return"*"}render(){return t` `}static get tag(){return"hax-store"}toast(e,t=2e3,i={},a="capsule",o=this.t.close,n=null,r=null){window.dispatchEvent(new CustomEvent(this.toastShowEventName,{bubbles:!0,composed:!0,cancelable:!0,detail:{text:e,duration:t,classStyle:a,closeText:o,eventCallback:n,slot:r,...i}}))}static get properties(){return{...super.properties,skipHAXConfirmation:{type:Boolean,reflect:!0,attribute:"skip-hax-confirmation"},storageData:{type:Object},haxTray:{type:Object},haxCancel:{type:Object},haxAutoloader:{type:Object},haxBodies:{type:Array},activePlaceHolder:{type:Object},appStore:{type:Object},sessionObject:{type:Object},skipExitTrap:{type:Boolean},elementList:{type:Object},staxList:{type:Array},validTagList:{type:Array},validGridTagList:{type:Array},validGizmoTypes:{type:Array},_isSandboxed:{type:Boolean},__appStoreData:{type:Object},ready:{type:Boolean},connectionRewrites:{type:Object}}}_storageDataChanged(e){e&&this.ready&&this.__storageDataProcessed&&(u("haxConfirm",!1)?g("haxUserData",e):sessionStorageGet("haxConfirm")&&sessionStorageSet("haxUserData",e))}isSingleSlotElement(e){let t=Object.keys(this.slotsSchemaFromNode(e));return 1==t.length&&0===t[0].length}isTextElement(e){let t;return null!=e&&e.tagName?t=e.tagName.toLowerCase():null!=e&&e.tag&&(t=e.tag.toLowerCase()),!!(t&&this.validTagList.includes(t)&&["p","ol","ul","li","a","h1","h2","h3","h4","h5","h6","strike","u","b","sub","sup","span","mark","abbr","i","bold","em","strong","blockquote","code","figure"].includes(t))}isInlineElement(e){let t;return null!=e&&e.tagName?t=e.tagName.toLowerCase():null!=e&&e.tag&&(t=e.tag.toLowerCase()),!!(t&&this.validTagList.includes(t)&&(this.haxSchemaFromTag(t)&&this.haxSchemaFromTag(t).meta&&this.haxSchemaFromTag(t).meta.inlineOnly||["a","strike","u","b","sub","sup","span","code","mark","abbr","i","bold","em","strong"].includes(t)))}isGridPlateElement(e){let t;return e&&e.tagName?t=e.tagName.toLowerCase():e&&e.tag&&(t=e.tag.toLowerCase()),!(!t||!this.validGridTagList.includes(t))}isLayoutElement(e){let t=e&&e.tagName&&this.haxSchemaFromTag(e.tagName)||{};return t.type&&"grid"===t.type}isLayoutSlot(e){return!(!e||!e.parentNode)&&this.isLayoutElement(e.parentNode)}isOriginalGridPlate(e){return!!e&&"GRID-PLATE"===e.tagName}activeSchema(){return this.activeNode?this.haxSchemaFromTag(this.activeNode.tagName):void 0}activeParentSchema(){return this.activeNode&&this.activeNode.parentNode?this.haxSchemaFromTag(this.activeNode.parentNode.tagName):void 0}slottedContentByNode(e){let t={...this.slotsSchemaFromNode(e)||{}};return e?([...e.children||[]].forEach((e=>{e.slot&&""!==e.slot&&t[e.slot]?(t[e.slot].items=t[e.slot].items||[],t[e.slot].items.push(e)):e.slot&&""!==e.slot||!t[""]||(t[""].items=t[""].items||[],t[""].items.push(e))})),t):t}slotsSchemaFromNode(e){if(!e||!e.tagName)return{};let t={},i=this.haxSchemaFromTag(e.tagName||{}),a=this.slotsFromSchema(i);if(this.isOriginalGridPlate(e)){(e.layout||"1-1-1-1").split("-").map(((e,t)=>{a.push({slot:`col-${t+1}`,title:`Column ${t+1}`,excludedSlotWrappers:["grid-plate"]})}))}return a.forEach((a=>{a.items=void 0,a.label=a.title||a.slot,a.editMode={...i.editMode,...a.editMode},a.grid=e,(a.slot||""===a.slot)&&(t[a.slot]=a)})),t}schemaBySlotId(e,t){return(this.slotsSchemaFromNode(e)||{})[t]}_appStoreChanged(e,t){e&&t&&(e.url&&!e.apps&&this.shadowRoot?this.loadAppStoreFromRemote():this.__appStoreData=e)}async _loadAppStoreData(e){if(null!=e){var t={};if(void 0!==e.autoloader){e.autoloader=Object.assign({},e.autoloader);for(let i in e.autoloader){let a=i,o=e.autoloader[i];isNaN(a)||(a=e.autoloader[i],o=`@lrnwebcomponents/${a}/${a}.js`),"string"!=typeof o&&(o.haxProperties&&this.setHaxProperties(e.autoloader[i].haxProperties,a),o=e.autoloader[i].import),this.validTagList.push(a),t[a]=o}}if(void 0!==e.apps){var i=e.apps;for(let e=0;e{window.customElements.get(a)&&window.customElements.get(a).haxProperties?this.setHaxProperties(window.customElements.get(a).haxProperties,a):t.appendChild(document.createElement(a))})).catch((e=>{console.warn(e),t.appendChild(document.createElement(a))}))}}isExternalURLImport(e){let t;try{t=new URL(e)}catch(e){return!1}return new URL(t).origin!==location.origin}_editModeChanged(e){e&&!this.appStoreLoaded&&this.__appStoreData&&this.haxAutoloader&&(clearTimeout(this.__readyToProcessAppStoreData),this._loadAppStoreData(this.__appStoreData))}async _globalPreferencesChanged(e){if(this.__storageDataProcessed&&e&&this.ready){let t=this.storageData;"string"==typeof t&&(t=JSON.parse(t)),t.globalPreferences=e,this.storageData=t,this._storageDataChanged(this.storageData),e.haxLang&&HAXStore.editMode&&(clearTimeout(this._debounceLang),this._debounceLang=setTimeout((async()=>{for(let e in this.elementList){let t=this.elementList[e];t=await this.attemptGizmoTranslation(e,t),this.elementList[e]=t}this.gizmoList.forEach((e=>{this.elementList[e.tag].gizmo.title&&(e.title=this.elementList[e.tag].gizmo.title),this.elementList[e.tag].gizmo.description&&(e.description=this.elementList[e.tag].gizmo.description)}))}),100))}}_haxContextOperation(e){let t=e.detail;if(this.activeNode){let e=!1;switch(t.eventName){case"hax-align-left":this.activeNode.style.float=null,this.activeNode.style.margin=null,this.activeNode.style.display=null,e=!0;break;case"hax-align-center":this.activeNode.style.float=null,this.activeNode.style.margin="0 auto",this.activeNode.style.display="block",e=!0;break;case"hax-align-right":this.activeNode.style.float="right",this.activeNode.style.margin="0 auto",this.activeNode.style.display="block",e=!0;break;case"hax-size-change":100==t.value||t.value>100?this.activeNode.style.width=null:this.activeNode.style.width=t.value+"%",e=!0;break;case"hax-style-setting-change":Object.keys(t.value).forEach((e=>{e.startsWith("__")||(this.activeNode.style.removeProperty(e),"background-color"===e&&this.activeNode.style.removeProperty("color"),setTimeout((()=>{if("background-color"===e)this.activeNode.style[e]=`var(--simple-colors-default-theme-${t.value[e]}-1)`,this.activeNode.style.color=`var(--simple-colors-default-theme-${t.value[e]}-12)`;else if("text-align"===e)this.activeNode.style[e]=t.value[e];else if("font-size"===e)switch(t.value[e]){case"x-small":this.activeNode.style[e]="0.8em";break;case"small":this.activeNode.style[e]="0.9em";break;case"large":this.activeNode.style[e]="1.2em";break;case"x-large":this.activeNode.style[e]="1.4em";break;case"xx-large":this.activeNode.style[e]="2em"}else this.activeNode.style[e]=t.value[e]+"px"}),0))})),e=!0}e&&(clearTimeout(this.__repositionMenu),this.__repositionMenu=setTimeout((()=>{this.activeHaxBody.positionContextMenus()}),0))}}_haxConsentTap(e){g("haxConfirm",!0),g("haxUserData",JSON.stringify(this.storageData))}updated(e){super.updated&&super.updated(e),e.forEach(((e,t)=>{"appStore"==t&&this[t]&&this._appStoreChanged(this[t],e),["ready","__appStoreData","haxAutoloader"].includes(t)&&this.ready&&this.__appStoreData&&this.haxAutoloader&&(clearTimeout(this.__readyToProcessAppStoreData),this.__readyToProcessAppStoreData=setTimeout((()=>{this._loadAppStoreData(this.__appStoreData)}),0)),["haxAutoloader","haxTray","haxCancel"].includes(t)&&(clearTimeout(this.__storeReady),this.__storeReady=setTimeout((()=>{this._storePiecesAllHere(this.haxAutoloader,this.activeHaxBody,this.haxTray,this.haxCancel)}),0))}))}_calculateActiveGizmo(e){if(null==e||!e.tagName)return null;for(let i in this.gizmoList){var t=this.gizmoList[i];if(t.tag===e.tagName.toLowerCase())return t}}loadAppStoreFromRemote(){const e=new URLSearchParams(this.appStore.params);let t=this.appStore.url;e&&(t+=`?${e}`),fetch(t,{method:this.method}).then((e=>{if(e.ok)return e.json()})).then((e=>{this.__appStoreData=e}))}firstUpdated(e){if(super.firstUpdated&&super.firstUpdated(e),this.skipHAXConfirmation&&(sessionStorageSet("haxConfirm",!0),g("haxConfirm",!0)),sessionStorageGet("haxConfirm")||u("haxConfirm"))if(sessionStorageGet("haxConfirm")&&!u("haxConfirm"))try{let e=sessionStorageGet("haxUserData")?JSON.parse(sessionStorageGet("haxUserData")):{};this.storageData=e,this._storageDataChanged(this.storageData)}catch(e){}else try{let e=u("haxUserData",{});this.storageData=e,this._storageDataChanged(this.storageData)}catch(e){}else{sessionStorageSet("haxConfirm",!0);let e="\n The HAX content editor keeps preferences in order to improve your experience.\n This data is stored in your browser and is never sent anywhere.\n Click to accept.\n ";this.toast(e,"-1",{},"fit-bottom","I Accept","hax-consent-tap")}setTimeout((()=>{this.__storageDataProcessed=!0,this.storageData.globalPreferences&&this.write("globalPreferences",this.storageData.globalPreferences,this)}),0)}_storePiecesAllHere(e,t,i,a){if(!this.ready&&t&&e&&i&&a){this.dispatchEvent(new CustomEvent("hax-store-ready",{bubbles:!0,cancelable:!1,composed:!0,detail:!0}));let e=window.RichTextEditorPrompt.requestAvailability();e&&(e.shadowRoot.querySelector("#formfields").schematizer=o,e.shadowRoot.querySelector("#formfields").elementizer=n),i.shadowRoot.querySelector("#haxcancelbutton")&&(a.shadowRoot.querySelector("#dialog").associateEvents(i.shadowRoot.querySelector("#haxcancelbutton")),a.shadowRoot.querySelector("#dialog")&&window.addEventListener("simple-modal-confirmed",this._handleConfirmCancel.bind(this))),this.ready=!0,this._buildPrimitiveDefinitions()}}_handleConfirmCancel(e){e.detail.invokedBy===this.haxTray.shadowRoot.querySelector("#haxcancelbutton")&&(this.editMode=!1,this.dispatchEvent(new CustomEvent("hax-cancel",{bubbles:!0,composed:!0,cancelable:!1,detail:e.detail})))}_positionCursorInNode(e,t=0){this.activeHaxBody.positionContextMenus();var i=document.createRange(),a=this.getSelection();return i.setStart(e,t),i.collapse(!0),a.removeAllRanges(),a.addRange(i),i}_onBeforeUnload(e){if(!this.skipExitTrap&&this.editMode)return"Are you sure you want to leave? Your work will not be saved!"}isBase64(e){try{return btoa(atob(e))==e}catch(e){return!1}}retrieveImageFromClipboardAsBlob(e,t){if(0==e.clipboardData&&"function"==typeof t)return t(void 0);var i=e.clipboardData.items;if(null==i&&"function"==typeof t)return t(void 0);for(let e=0;e\s*?<\/span>/g," "),o=o.replace(/(?:style="(\S+:\s*[^;"]+;\s*)*)+"/g,""),o=o.replace(/
/g,"

"),n=o,this.isBase64(n))return e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),this.retrieveImageFromClipboardAsBlob(e,(t=>{if(t){var i=window.URL||window.webkitURL;let a=document.createElement("img");a.src=i.createObjectURL(t),this.activeNode.parentNode.insertBefore(a,this.activeNode.nextElementSibling);for(let t in e.clipboardData.items)!e.clipboardData.items[t].name&&e.clipboardData.items[t].type&&(e.clipboardData.items[t].name="image-"+Math.floor(Date.now()/1e3)+e.clipboardData.items[t].type.replace("image/","."));return e.dataTransfer=e.clipboardData,e.placeHolderElement=a,this.dispatchEvent(new CustomEvent("place-holder-file-drop",{bubbles:!0,cancelable:!0,composed:!0,detail:e})),a}return!1}));if(e.clipboardData.files.length>0){e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation();let t=this.activeHaxBody.haxInsert("p","",{});e.dataTransfer=e.clipboardData;for(let t in e.clipboardData.files)!e.clipboardData.files[t].name&&e.clipboardData.files[t].type&&(e.clipboardData.files[t].name="image-"+Math.floor(Date.now()/1e3)+e.clipboardData.files[t].type.replace("image/","."));e.placeHolderElement=t,this.dispatchEvent(new CustomEvent("place-holder-file-drop",{bubbles:!0,cancelable:!0,composed:!0,detail:e}))}let r=!1,s="",d=document.createElement("div");d.innerHTML=o;let p=[];if(d.children&&(o=l(o),o=o.replace(/

/g,"

"),o=o.replace(/<\/h1>/g,"

"),o=o.replace(//g,(function(e,t){return``})),p=await this.htmlToHaxElements(o),1!==p.length||this.__validGridTags().includes(p[0].tag)||(p=await this.htmlToHaxElements(p[0].content))),0===p.length&&h(o)){""!=this.activeNode.innerText.trim()&&(r=!0);let e={source:o,title:o};if(!r&&!this.insertLogicFromValues(e,this,!1,!0))return!1}else if(0===p.length){if(r=!0,n==o)return!1;s=o}else if(1===p.length&&"p"===p[0].tag)s=o,r=!0;else if(1===p.length&&"a"===p[0].tag&&p[0].properties.href)if(""!=this.activeNode.innerText.trim())s=p[0].properties.href,r=!0;else{let e={source:p[0].properties.href,title:p[0].content};if(!this.insertLogicFromValues(e,this))return!1}else{if(!this.isGridPlateElement(p[0]))return!1;for(let e in p){"p"==p[e].tag&&["li","ol","ul"].includes(this.activeNode.tagName.toLowerCase())&&(p[e].tag="li"),delete p[e].properties.style,delete p[e].properties.start,delete p[e].properties.align;let t=c({tag:p[e].tag,content:p[e].content.replace(/ <\/span>/g," ").trim(),properties:p[e].properties});s+=await this.nodeToContent(t)}}e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation();try{let e=this.getRange(),n=this.getSelection(),l=document.createElement("div");if(l.innerHTML=s,e&&n){for(let e in l.children)l.children[e].tagName&&this.isTextElement(l.children[e])&&""===l.children[e].innerHTML&&l.children[e].remove();if(r){let t;if(h(o))t=document.createElement("a"),t.setAttribute("href",o),t.setAttribute("rel","noopener noreferrer"),t.setAttribute("target","_blank"),t.innerText=o;else if(l.children&&l.children.length>0){for(;l.childNodes.length>1;)e.insertNode(Array.from(l.childNodes).pop());t=Array.from(l.childNodes).pop()}else t=document.createTextNode(l.innerHTML);e.insertNode(t),setTimeout((()=>{this._positionCursorInNode(t,t.length)}),0)}else{var t,i,a;for(""!=this.activeNode.innerText.trim()&&e.endOffset!=this.activeNode.innerText.length&&(t=!0,document.execCommand("insertParagraph")),e.commonAncestorContainer&&e.commonAncestorContainer.parentNode&&(a||this.activeNode==e.commonAncestorContainer||(a=e.commonAncestorContainer.parentNode)||(a=e.commonAncestorContainer));l.firstElementChild;)i=l.firstElementChild,a?(a.getAttribute&&a.getAttribute("slot")&&i.setAttribute("slot",a.getAttribute("slot")),t?(this.activeHaxBody.haxReplaceNode(a.previousElementSibling,i),t=!1):a.parentNode?a.parentNode.insertBefore(i,a.nextElementSibling):a.insertBefore(i,a.nextElementSibling)):this.activeNode?(this.activeNode.getAttribute("slot")&&i.setAttribute("slot",this.activeNode.getAttribute("slot")),""==this.activeNode.innerText.trim()?this.activeHaxBody.haxReplaceNode(this.activeNode,i):this.activeNode.parentNode.insertBefore(i,this.activeNode.nextElementSibling)):this.activeHaxBody.appendChild(i),a=i;setTimeout((()=>{i&&i.childNodes&&i.childNodes[0]&&(this._positionCursorInNode(i.childNodes[0],i.childNodes[0].length),i=null,a=null)}),0)}}}catch(e){console.warn(e)}}}__validGridTags(){return["p","ol","ul","li","div","h1","h2","h3","h4","h5","h6","blockquote","code","section","dl","dd","dt","figure"]}__validTags(){return["p","div","span","mark","abbr","table","caption","sup","sub","u","strike","tr","th","td","ol","ul","li","a","strong","kbd","tt","em","i","b","hr","h1","h2","h3","h4","h5","h6","blockquote","code","figure","figcaption","img","iframe","video","audio","section","dl","dt","dd","template","webview"]}__validGizmoTypes(){return["data","video","audio","text","link","file","pdf","image","csv","doc","document","archive","markdown","html","content","text","gif","inline","*"]}constructor(){super(),N(["core"]),this.toastShowEventName="simple-toast-show",this.t={close:"Close"},void 0!==window.speechSynthesis&&(window.SpeechRecognition||window.webkitSpeechRecognition||window.mozSpeechRecognition||window.msSpeechRecognition||window.oSpeechRecognition)&&(C.voiceSearch=!0),C.icon="hax:wizard-hat",C.allowedCallback=()=>!(!this.ready||!this.editMode),C.defineOption({title:"Insert emoji",icon:"editor:insert-emoticon",tags:["emoji"],value:{name:"Insert emoji",context:"/",program:async(e,t)=>{let i=[],a=document.createElement("textarea");return await Object.keys(window.SimplePickerEmojis).forEach((async t=>{await window.SimplePickerEmojis[t].forEach((async o=>{(""==e||o.description.includes(e))&&(a.innerHTML=o.value,i.push({title:o.description,textCharacter:a.value,tags:[t],value:{target:this,method:"_insertTextResult",args:[a.value]},context:["/","/HAX/text/emoji/"+a.value],eventName:"super-daemon-element-method",path:"/HAX/text/emoji/"+a.value}))}))})),i}},context:["HAX","/"],eventName:"super-daemon-run-program",path:"/HAX/text/emoji"}),C.defineOption({title:"Insert symbol",icon:"editor:functions",tags:["symbol"],value:{name:"Insert symbol",context:"/",program:async(e,t)=>{let i=[],a=document.createElement("textarea");return await Object.keys(window.SimplePickerSymbols).forEach((async t=>{await window.SimplePickerSymbols[t].forEach((async o=>{(""==e||t.includes(e))&&(a.innerHTML=o.value,i.push({title:`${t}: ${a.value}`,textCharacter:a.value,tags:[t],value:{target:this,method:"_insertTextResult",args:[a.value]},context:["/","/HAX/text/symbol/"+a.value],eventName:"super-daemon-element-method",path:"/HAX/text/symbol/"+a.value}))}))})),i}},context:["HAX","/"],eventName:"super-daemon-run-program",path:"/HAX/text/symbol"}),C.defineOption({title:"Join our Community",icon:"hax:discord",priority:-100,tags:["community","discord","chat","help"],value:{target:this,method:"_openExternalLink",args:["https://bit.ly/hax-discord"]},eventName:"super-daemon-element-method",path:"HAX/community/join",context:["logged-in","CMS","HAX","?"]}),C.defineOption({title:"User Tutorials",icon:"hax:hax2022",priority:-1e3,tags:["Documentation","community","help"],value:{target:this,method:"_openExternalLink",args:["https://oer.hax.psu.edu/bto108/sites/haxcellence/tutorials"]},eventName:"super-daemon-element-method",path:"HAX/community/tutorials",context:["logged-in","CMS","HAX","?"]}),C.defineOption({title:"User Documentation",icon:"hax:hax2022",tags:["Documentation","community","help"],value:{target:this,method:"_openExternalLink",args:["https://oer.hax.psu.edu/bto108/sites/haxcellence/documentation"]},eventName:"super-daemon-element-method",path:"HAX/community/documentation",context:["logged-in","CMS","HAX","?"]}),C.defineOption({title:"HAX Teaching Excellence",icon:"hax:hax2022",tags:["Ontology","community","pedagogy","documentation","help"],value:{target:this,method:"_openExternalLink",args:["https://oer.hax.psu.edu/bto108/sites/haxcellence/ontology"]},eventName:"super-daemon-element-method",path:"HAX/community/pedagogy",context:["logged-in","CMS","HAX","?"]}),C.defineOption({title:"Bug / issue",icon:"mdi-social:github-circle",tags:["Bug report","github","git","community","issue queue"],value:{target:this,method:"_haxStoreContribute",args:["bug","POP,bug"]},eventName:"super-daemon-element-method",path:"HAX/community/contribute",context:["logged-in","CMS","HAX","?"]}),C.defineOption({title:"Idea / Feature request",icon:"mdi-social:github-circle",tags:["Feature request","idea","github","git","community","issue queue"],value:{target:this,method:"_haxStoreContribute",args:["feature","POP,enhancement"]},context:["logged-in","CMS","HAX","?"],eventName:"super-daemon-element-method",path:"HAX/community/contribute"}),this.primativeHooks={},this.__dragTarget=null,this.registerLocalization({context:this,namespace:"hax",basePath:import.meta.url+"/../../",locales:["es"]}),this.appSearch=null,this.method="GET",this.haxSelectedText="",this.__winEvents={"hax-super-daemon-insert-tag":"_superDaemonInsert","hax-register-properties":"_haxStoreRegisterProperties","hax-consent-tap":"_haxConsentTap","hax-context-item-selected":"_haxContextOperation",onbeforeunload:"_onBeforeUnload",paste:"_onPaste","hax-register-app":"_haxStoreRegisterApp","hax-register-stax":"_haxStoreRegisterStax","hax-register-core-piece":"_haxStorePieceRegistrationManager","hax-register-body":"_haxStoreRegisterBody","hax-insert-content":"_haxStoreInsertContent","hax-insert-content-array":"_haxStoreInsertMultiple","hax-refresh-tray-form":"refreshActiveNodeForm","rich-text-editor-prompt-open":"_richTextEditorPromptOpen","rich-text-editor-prompt-close":"_richTextEditorPromptClose","super-daemon-command-context-changed":"_superDaemonCommandContextChanged","super-daemon-context-changed":"_superDaemonContextChanged"},window.onbeforeunload=e=>{if(!this.skipExitTrap&&this.editMode){var t="Are you sure you want to leave? Your work will not be saved!";return e.returnValue=t,t}},a.registerNewTour({key:"hax",name:"Let's learn HAX",style:"\n simple-popover-manager::part(simple-popover) {\n max-width: 250px;\n }\n simple-popover-manager button {\n font-size: 12px;\n margin: 0px 2px;\n }\n simple-popover-manager p {\n --hax-base-styles-p-font-size: 14px;\n padding: 0;\n margin: 0;\n font-size: 14px;\n line-height: 20px;\n }\n simple-popover-manager h3 {\n --hax-base-styles-h3-font-size: 18px;\n margin: 8px 2px;\n }"}),this.skipHAXConfirmation=!1,this.storageData={},this.appStore={url:"",params:{}},this.daemonKeyCombo=`${C.key1} + ${C.key2} + `,this.activeNode=null,this.activeEditingElement=null,this.haxBodies=[],this.activePlaceHolder=null,this.sessionObject={},this.editMode=!1,this.skipExitTrap=!1,this.appStoreLoaded=!1,this.elementList={},this.elementAlign=u("hax-tray-elementAlign"),this.elementAlign&&null!=this.elementAlign||(this.elementAlign="left"),this.trayStatus="collapsed",this.trayDetail="content-edit",this.appList=[],this.gizmoList=[],this.recentGizmoList=[],this.haxAutoloader=null,this.activeHaxBody=null,this.haxTray=null,this.haxCancel=null,this.staxList=[],this.globalPreferences={},this.activeApp={},this.connectionRewrites={},this.daemonCommands={},this.keyboardShortcuts={"#":{tag:"h2",content:""},"##":{tag:"h3",content:""},"###":{tag:"h4",content:""},"####":{tag:"h5",content:""},"#####":{tag:"h6",content:""},"######":{tag:"h6",content:""},"1.":{tag:"ol",content:"
  • "},"-":{tag:"ul",content:"
  • "},"*":{tag:"ul",content:"
  • "},"+":{tag:"ul",content:"
  • "},"---":{tag:"hr"},"***":{tag:"hr"},___:{tag:"hr"},"```":{tag:"code",content:""},">":{tag:"blockquote",content:""}},this.validTagList=this.__validTags(),this.validGridTagList=this.__validGridTags(),this.validGizmoTypes=this.__validGizmoTypes();let e=document.createElement("webview");this._isSandboxed="function"==typeof e.reload,window.SimpleToast.requestAvailability(),document.body.style.setProperty("--hax-ui-headings","#d4ff77"),v(this,{daemonKeyCombo:x,gizmoList:x,recentGizmoList:x,activeNode:x,globalPreferences:x,activeGizmo:f,activeNodeIndex:f,editMode:x,elementAlign:x,trayStatus:x,trayDetail:x,appList:x,activeApp:x,haxSelectedText:x,activeEditingElement:x,activeHaxBody:x,appStoreLoaded:x}),y((()=>{this._globalPreferencesChanged(w(this.globalPreferences))})),y((()=>{this._editModeChanged(w(this.editMode))}))}async _insertTextResult(e){this.activeNode.focus(),C.activeRange.setStart(this.activeNode,0),C.activeRange.collapse(!0),C.activeSelection.removeAllRanges(),C.activeSelection.addRange(C.activeRange),C.activeSelection.selectAllChildren(this.activeNode),C.activeSelection.collapseToEnd(),setTimeout((()=>{""==this.activeNode.textContent?this.activeNode.textContent=e:document.execCommand("insertHTML",!1,e)}),0)}_openExternalLink(e){window.open(e,"_blank")}async _haxStoreContribute(e,t,i=null){let a="";if("merlin"==e){var o=`[${e}] New command request from HAX daemon`;a=`Location: ${window.location.href}\nMerlin command: ${i}\nWhat did you want merlin to do?\n`}else{o=`[${e}] User report from HAX daemon`;if(a=`Location: ${window.location.href}\nBrowser: ${navigator.userAgent}\nOS: ${navigator.userAgentData.platform} - ${navigator.deviceMemory}GB RAM - ${navigator.hardwareConcurrency} cores\nScreen: ${window.screen.width}x${window.screen.height}\nWindow size: ${window.innerWidth}x${window.innerHeight}\n`,navigator.getBattery){a+=`Battery: ${100*(await navigator.getBattery()).level}%\n`}navigator.connection&&navigator.connection.effectiveType&&(a+=`Connection: ${navigator.connection.effectiveType}\n`),a+=("feature"==e?"Your idea:":"Bug you experienced:")+"\n"}window.open(`https://github.com/elmsln/issues/issues/new?assignees=&labels=${t}&template=issue-report.md&title=${o}&body=${encodeURIComponent(a)}`,"_blank")}_superDaemonCommandContextChanged(e){}_superDaemonContextChanged(e){-1!==e.detail.value.indexOf("CMS")?C.questionTags=[{value:"CMS/action/edit",label:"Edit current page"},{value:"*",label:"List everything I can do"},{value:"?",label:"HELP!"}]:-1!==e.detail.value.indexOf("HAX")?C.questionTags=[{value:"CMS/action/save",label:"Save current page"},{value:"media",label:"Where can I find media?"},{value:"*",label:"List everything I can do"},{value:"?",label:"HELP!"}]:C.questionTags=[{value:"*",label:"List everything I can do"},{value:"?",label:"HELP!"}]}_richTextEditorPromptOpen(){const e=window.getComputedStyle(document.body);"hidden"==e.getPropertyValue("overflow")&&(this.__overflowHiddenOnOpen=e.getPropertyValue("overflow"),document.body.style.overflow="auto")}_richTextEditorPromptClose(){this.__overflowHiddenOnOpen&&(document.body.style.overflow=this.__overflowHiddenOnOpen,this.__overflowHiddenOnOpen=null)}_buildPrimitiveDefinitions(){if(this._isSandboxed){let e={type:"element",editingElement:"core",canScale:!0,canPosition:!0,canEditSource:!0,settings:{configure:[{attribute:"src",title:"Source",description:"The URL for this resource.",inputMethod:"textfield",icon:"link",required:!0,validationType:"url"}],advanced:[]}};this.setHaxProperties(e,"webview")}this.setHaxProperties({canScale:{min:10,step:5},type:"element",editingElement:"core",canPosition:!0,canEditSource:!0,gizmo:{title:"Image",description:"A basic img tag",icon:"image:image",color:"blue-grey",tags:["Images","media","img","html"],handles:[{type:"image",source:"src"}],meta:{author:"W3C",hidden:!0}},settings:{configure:[{attribute:"src",title:"Source",description:"The URL for this image.",inputMethod:"haxupload",noVoiceRecord:!0,icon:"link",required:!0,validationType:"url"},{attribute:"alt",title:"Alt text",description:"Useful for screen readers and improved SEO.",inputMethod:"alt",icon:"accessibility"},{attribute:"height",title:"Height",description:"height in pixels of the item. Leave blank to respond to the natural resolution",inputMethod:"textfield",icon:"icons:swap-vert"}],advanced:[{attribute:"loading",title:"Loading method",description:"Whether or not to lazy load this",inputMethod:"select",options:{lazy:"Load when visible",auto:"Automatic"}}]},demoSchema:[{tag:"img",content:"",properties:{src:"https://cdn2.thecatapi.com/images/9j5.jpg",loading:"lazy"}}]},"img");let e={canScale:{min:10,step:5},type:"grid",canPosition:!0,canEditSource:!0,gizmo:{title:"Figure",description:"A basic figure tag",icon:"hax:figure",color:"blue-grey",tags:["Images","media","figure","html"],requiresChildren:"figcaption",handles:[],meta:{author:"W3C",hidden:!0}},settings:{configure:[_]},demoSchema:[{tag:"figure",properties:{},content:'image other media here\n

    Image Caption Here

    '}]};this.setHaxProperties(e,"figure");let t={canScale:{min:10,step:5},type:"grid",editingElement:"core",canPosition:!0,canEditSource:!0,gizmo:{title:"Figure caption",description:"Used inside of a figure tag",icon:"image:image",color:"blue-grey",tags:["Images","media","caption","figure","html"],handles:[],requiresParent:"figure",meta:{author:"W3C",hidden:!0}},settings:{configure:[{slot:"",title:"Figure Caption",description:"Caption for the figure",inputMethod:"code-editor"},_]},demoSchema:[{tag:"figcaption",properties:{},content:"Image Caption Here"}]};this.setHaxProperties(t,"figcaption");let i={type:"element",editingElement:"core",canScale:!1,canPosition:!1,canEditSource:!0,contentEditable:!0,gizmo:{title:"Highlight",description:"Highlight text within a block of content",icon:"editor:highlight",color:"yellow",tags:["Content","text","highlight","mark","html"],handles:[],meta:{author:"W3C",hidden:!0}},settings:{configure:[{attribute:"innerText",title:"Text",description:"Text of the highlight",inputMethod:"textfield",required:!0},A],advanced:[],developer:[]},demoSchema:[{tag:"mark",content:"Highlight me",properties:{}}]};this.setHaxProperties(i,"mark");let a={type:"element",editingElement:"core",canScale:!1,canPosition:!1,canEditSource:!0,contentEditable:!0,gizmo:{title:"Abbreviation",description:"Simple abbreviation with tooltip of full word",icon:"hax:abbr",color:"yellow",tags:["Content","text","abbr","html"],handles:[],meta:{author:"W3C",hidden:!0}},settings:{configure:[{attribute:"innerText",title:"Text",description:"Text that is visible, the abbreviation",inputMethod:"textfield",required:!0},{attribute:"title",title:"Word",description:"Word that the abbreviation is representing",inputMethod:"textfield",required:!0},A],advanced:[],developer:[]},demoSchema:[{tag:"abbr",content:"Abbr",properties:{title:"Abbreviation"}}]};this.setHaxProperties(a,"abbr");let o={type:"element",editingElement:"core",canScale:!1,canPosition:!1,canEditSource:!0,contentEditable:!0,gizmo:{title:"Basic link",description:"A basic a tag",icon:"icons:link",color:"blue-grey",tags:["Resource","link","a","url","html","href","address","http"],handles:[],meta:{author:"W3C"}},settings:{configure:[{attribute:"innerText",title:"Text",description:"Text of the link",inputMethod:"textfield",required:!0},{attribute:"href",title:"Link",description:"The URL for the link",inputMethod:"haxupload",required:!0,validationType:"url"},{attribute:"target",title:"Target",description:"Where to open the link.",inputMethod:"select",options:{"":"Same window",_blank:"New window - _blank",_top:"Top window - _top",_parent:"Parent window - _parent"}},A],advanced:[],developer:[{attribute:"title",title:"Title text",description:"Useful for screen readers and improved SEO.",inputMethod:"textfield"},{attribute:"rel",title:"rel",description:"Specifies the relationship between this document and the opened document. Change as part of security or SEO policy.",inputMethod:"select",options:{noopener:"noopener","noopener noreferrer":"noopener noreferrer","nofollow ":"nofollow","noopener noreferrer nofollow":"noopener noreferrer nofollow",opener:"opener"}}]},demoSchema:[{tag:"p",content:'Link to content',properties:{}}]};this.validGizmoTypes.forEach((e=>{o.gizmo.handles.push({type:e,source:"href",title:"innerText",alt:"title"})})),this.setHaxProperties(o,"a");let n={type:"element",editingElement:"core",canScale:!1,canPosition:!1,canEditSource:!0,contentEditable:!0,gizmo:{title:"Paragraph",description:"A basic text area",icon:"hax:paragraph",color:"blue-grey",tags:["Text","p","paragraph","text","html"],handles:[{type:"content",title:"innerHTML",alt:"title"}],meta:{author:"W3C",outlineDesigner:!0}},settings:{configure:[_],advanced:[]},demoSchema:[{tag:"p",content:"Deep thoughts..",properties:{}}]};this.setHaxProperties(n,"p");let r={type:"element",editingElement:{tag:"editable-table",import:"@lrnwebcomponents/editable-table/editable-table.js",callback:this.setupEditableTable.bind(this)},canScale:!0,canPosition:!0,canEditSource:!0,gizmo:{title:"Table",description:"A table for displaying data",icon:"image:grid-on",color:"blue-grey",tags:["Instructional","table","data","html","grid","matrix","spreadsheet","csv","excel"],meta:{hidden:!0,author:"W3C"}},settings:{configure:[],advanced:[]}};this.setHaxProperties(r,"table");let s=document.createElement("editable-table");this.haxAutoloader.appendChild(s);let l={type:"element",editingElement:{tag:"iframe-loader",import:"@lrnwebcomponents/iframe-loader/iframe-loader.js",callback:this.setupIframeLoader.bind(this)},canScale:!1,canPosition:!0,canEditSource:!1,gizmo:{title:"iFrame",description:"A basic way to frame external web content",icon:"hax:iframe",color:"blue-grey",tags:["Resource","iframe","content","url","link","embed","https","html","address"],handles:[],meta:{author:"W3C",hidden:!0}},settings:{configure:[{attribute:"src",title:"Source",description:"The URL for this resource.",inputMethod:"textfield",icon:"link",required:!0,validationType:"url"}]}};this.setHaxProperties(l,"iframe");let d=document.createElement("iframe-loader");this.haxAutoloader.appendChild(d);let c={caption:{title:"Caption",icon:"av:call-to-action"},video:{title:"Video",icon:"av:play-circle-filled"},audio:{title:"Audio",icon:"image:music-note"},section:{title:"Section",icon:"image:crop-landscape"},dl:{title:"Data list",icon:"editor:format-list-bulleted"},dt:{title:"Data term",icon:"editor:format-list-bulleted"},dd:{title:"Data definition",icon:"editor:format-list-bulleted"},ol:{title:"Numbered list",icon:"editor:format-list-numbered"},ul:{title:"Bulleted list",icon:"editor:format-list-bulleted"},li:{title:"List item",icon:"editor:format-list-bulleted"},h1:{title:"Heading",icon:"hax:h1"},h2:{title:"Heading",icon:"hax:h2",tags:["Text","h2","html","text","heading","header"]},h3:{title:"Heading",icon:"hax:h3"},h4:{title:"Heading",icon:"hax:h4"},h5:{title:"Heading",icon:"hax:h5"},h6:{title:"Heading",icon:"hax:h6"},strike:{title:"Cross out",icon:"editor:format-strikethrough"},u:{title:"Underline",icon:"editor:format-underlined"},sub:{title:"Subscript",icon:"mdextra:subscript"},sup:{title:"Superscript",icon:"mdextra:superscript"},div:{title:"DIV",icon:"image:crop-landscape"},span:{title:"SPAN",icon:"editor:short-text",handles:[{type:"inline",text:"text"}]},i:{title:"Italic",icon:"editor:format-italic"},em:{title:"Emphasis",icon:"editor:format-italic"},strong:{title:"Bold",icon:"editor:format-bold"},b:{title:"Bold",icon:"editor:format-bold"},blockquote:{title:"Block quote",icon:"editor:format-quote"},code:{title:"Code",icon:"icons:code"},embed:{title:"Embedded object",icon:"icons:fullscreen"}};for(let e in c){let t="";["h1","h2","h3","h4","h5","h6"].includes(e)?t="Heading":"ul"!=e&&"ol"!=e||(t="
  • Item
  • Item
  • "),this.setHaxProperties({type:"element",editingElement:"core",canScale:!1,canPosition:!1,canEditSource:!0,contentEditable:!0,gizmo:{title:c[e].title,icon:c[e].icon,tags:c[e].tags||["Text",e,"html","text"],handles:c[e].handles||[],meta:{author:"W3C",inlineOnly:!!["em","b","strong","i","strike","u","sub","sup","span"].includes(e),hidden:!["h2","ul"].includes(e),outlineDesigner:!!["h2","ul"].includes(e)}},settings:{configure:["h1","h2","h3","h4","h5","h6"].includes(e)?[A,...L]:[A],advanced:[]},demoSchema:[{tag:e,content:t,properties:{}}]},e)}let h={canScale:{min:25,step:25},type:"element",editingElement:"core",canPosition:!1,canEditSource:!1,contentEditable:!0,gizmo:{title:"Horizontal line",icon:"hax:hr",meta:{author:"W3C"}},settings:{configure:[...L],advanced:[]},demoSchema:[{tag:"hr",content:"",properties:{style:"width:50%;"}}]};this.setHaxProperties(h,"hr")}_haxStorePieceRegistrationManager(e){e.detail&&e.detail.piece&&e.detail.object&&(this[e.detail.piece]=e.detail.object)}setupEditableTable(e){this.activeNode=e,setTimeout((()=>{e.editMode=!0,e.focus()}),0)}setupIframeLoader(e){this.activeNode=e,setTimeout((()=>{e.disabled=!0}),0)}async _haxStoreInsertContent(e){if(e.detail){let i=e.detail;if(window.customElements.get(i.tag)){let e=document.createElement(i.tag);this.testHook(e,"preProcessInsertContent")&&(i=await this.runHook(e,"preProcessInsertContent",[i,this.activeNode]))}var t={};if(void 0!==i.properties&&(t=i.properties),t.innerHTML&&(""==i.content&&(i.content=t.innerHTML),delete t.innerHTML),t.innerText&&(""==i.content&&(i.content=t.innerText),delete t.innerText),void 0!==i.__type&&"inline"===i.__type){let e=c({tag:i.tag,content:i.content,properties:t});null!==this.activePlaceHolder&&(this.activePlaceHolder.deleteContents(),this.activePlaceHolder.insertNode(e)),this.activePlaceHolder=null}else if(i.replace||i.replacement||i.nextToActive){let e=c({tag:i.tag,content:i.content,properties:t});this.activePlaceHolder?(this.activeHaxBody.haxReplaceNode(this.activePlaceHolder,e),this.activePlaceHolder=null):i.nextToActive&&this.activeNode?this.activeHaxBody.__slot&&this.activeNode.haxLayoutContainer?this.activeNode.appendChild(e):this.activeNode.parentNode.insertBefore(e,this.activeNode):this.activeHaxBody.haxReplaceNode(this.activeNode,e)}else if(this.activeNode.parentNode&&"HAX-BODY"!=this.activeNode.parentNode.tagName){let e=c({tag:i.tag,content:i.content,properties:t});this.activeNode.parentNode.haxLayoutContainer?(null!=this.activeNode.getAttribute("slot")&&e.setAttribute("slot",this.activeNode.getAttribute("slot")),this.activeHaxBody.haxInsert(i.tag,i.content,t)):this.activeHaxBody.haxInsert(i.tag,i.content,t)}else this.activeHaxBody.haxInsert(i.tag,i.content,t)}}slotsFromSchema(e,t=!1){let i=e?e.settings:{},a=[];return Object.keys({...i||{}}).map((e=>(i[e]||[]).filter((e=>{let i=!t||!e.required;return!(!e.slot&&""!==e.slot||a.includes(e.slot)||!i)&&(a.push(e.slot),!0)})))).flat()}haxSchemaFromTag(e){return e&&e.toLowerCase&&(e=e.toLowerCase(),this.elementList&&this.elementList[e])?this.elementList[e]:{}}_haxStoreInsertMultiple(e){var t;if(e.detail)for(let i in e.detail)t={},void 0!==e.detail[i].properties&&(t=e.detail[i].properties),this.activeHaxBody.haxInsert(e.detail[i].tag,e.detail[i].content,t)}_haxStoreRegisterBody(e){e.detail&&(this.haxBodies.push(e.detail),this.activeHaxBody=e.detail,this.write("activeHaxBody",this.activeHaxBody,this),this.write("editMode",this.editMode,this),clearTimeout(this.__storeReady),this.__storeReady=setTimeout((()=>{this._storePiecesAllHere(this.haxAutoloader,this.activeHaxBody,this.haxTray,this.haxCancel)}),0))}_superDaemonInsert(e){C.programTarget&&e.detail.properties&&(e.detail.properties.src||e.detail.properties.source)?C.programTarget.value=e.detail.properties.src||e.detail.properties.source:this.haxTray._processTrayEvent(e),C.programTarget=null}computePolyfillSafe(){return!(!document.head.createShadowRoot&&!document.head.attachShadow)||(console.warn("Shadow DOM missing, certain operations hidden"),!1)}_haxStoreRegisterApp(e){if(e.detail){const i=e.detail;i.index=this.appList.length,this.appList=[...this.appList,i],this.write("appList",w(this.appList),this);let a="media";if(i.connection.operations&&i.connection.operations.browse&&i.connection.operations.browse.resultMap&&i.connection.operations.browse.resultMap.defaultGizmoType&&(a=i.connection.operations.browse.resultMap.defaultGizmoType),C.defineOption({title:"Search "+i.details.title,icon:i.details.icon,tags:["Search",...i.details.tags,a],more:i.details.tos&&i.details.tos.length>0?t`
    Terms of service:
    +import{LitElement as e,html as t,nothing as i}from"../../../lit/index.js";import{SimpleTourManager as a}from"../../simple-popover/lib/simple-tour.js";import{HaxSchematizer as o,HaxElementizer as n}from"../../hax-body-behaviors/lib/HAXFields.js";import{winEventsElement as r,getRange as s,stripMSWord as l,nodeToHaxElement as d,haxElementToNode as c,validURL as h,camelToDash as p,htmlEntities as m,localStorageGet as u,localStorageSet as g}from"../../utils/utils.js";import{observable as x,makeObservable as v,computed as f,configure as b,autorun as y,toJS as w}from"../../../mobx/dist/mobx.esm.js";b({enforceActions:!1});import{HAXElement as S}from"../../hax-body-behaviors/hax-body-behaviors.js";import{I18NMixin as H,I18NManagerStore as T}from"../../i18n-manager/lib/I18NMixin.js";import{enableServices as N}from"../../micro-frontend-registry/lib/microServices.js";import{SuperDaemonInstance as C}from"../../super-daemon/super-daemon.js";import"../../media-behaviors/media-behaviors.js";import"../../simple-toast/simple-toast.js";import"../../editable-table/editable-table.js";import"../../iframe-loader/iframe-loader.js";import{learningComponentTypes as E}from"../../course-design/lib/learning-component.js";import"../../hax-iconset/lib/hax-iconset-manifest.js";import"./hax-app.js";function sessionStorageGet(e){try{return sessionStorage.getItem(e)}catch(e){return!1}}function sessionStorageSet(e,t){try{return sessionStorage.setItem(e,t)}catch(e){return!1}}const A={attribute:"data-style-decoration",title:"Decoration",description:"Some built in styles to highlight material",inputMethod:"select",options:{"":"","mark-blue":"Marker - blue","mark-brown":"Marker - gray","mark-pink":"Marker - pink","mark-red":"Marker - purple","mark-teal":"Marker - green","mark-yellow":"Marker - yellow"}},_={attribute:"data-style-block-decoration",title:"Block Decoration",description:"Some built in styles to offset material",inputMethod:"select",options:{"":"","callout-blue":"Callout - blue","callout-brown":"Callout - brown","callout-pink":"Callout - pink","callout-red":"Callout - purple","callout-teal":"Callout - green","callout-yellow":"Callout - yellow"}},L=[{attribute:"data-instructional-action",title:"Type",description:"Indicates instructional context to users visually",inputMethod:"select",options:{"":"-- none --",...E}},{attribute:"data-id-emphasize",title:"Alternate visual treatment",description:"Apply a different visual treatment to the element but with same meaning",inputMethod:"boolean"}];class HaxStore extends(H(r(S(e)))){testHook(e,t){return!!(e&&e.tagName&&this.HTMLPrimativeTest(e)&&this.primativeHooks[e.tagName.toLowerCase()]&&this.primativeHooks[e.tagName.toLowerCase()][t])||e&&"function"==typeof e.haxHooks&&e.haxHooks()[t]}async runHook(e,t,i=[]){return!!this.testHook(e,t)&&(this.HTMLPrimativeTest(e)?await this.primativeHooks[e.tagName.toLowerCase()][t](...i):await e[e.haxHooks()[t]](...i))}getSelection(){if(this.activeHaxBody&&this.activeHaxBody.parentNode){if(this.activeHaxBody.parentNode.getSelection)return this.activeHaxBody.parentNode.getSelection();try{if(s(this.activeHaxBody.parentNode))return s(this.activeHaxBody.parentNode)}catch(e){}}return window.getSelection()}getRange(){let e=this.getSelection();return e&&e.getRangeAt&&e.rangeCount?e.getRangeAt(0):e||!1}guessGizmo(e,t,i=!1,a=!1){var o=[],n=[];if(void 0!==e&&this.validGizmoTypes.includes(e))for(let r in this.gizmoList){let s=this.gizmoList[r],l=t.innerHTML?{innerHTML:t.innerHTML}:{},d=!1;if(s&&s.handles)for(let r=0;r{t&&t.type&&""!=t.type&&(e[t.type.toLowerCase()]=!0)})),[...s.tags].forEach((t=>{t&&""!=t&&(e[t.toLowerCase()]=!0)})),s.keywords=Object.keys(e),n.includes(s.tag)||(o.push(this.haxElementPrototype(s,l,"")),n.push(s.tag))}}}}return o}insertLogicFromValues(e,t,i=!1,a=!1){let o=this.guessGizmoType(e),n=o,r=!0;if("*"==o){if(i)return!1;r=!1,n="link"}let s=this.guessGizmo(o,e,!1,r);return s.length>0?(1===s.length||a?1===s.length&&void 0!==s[0].tag?t.dispatchEvent(new CustomEvent("hax-insert-content",{bubbles:!0,cancelable:!0,composed:!0,detail:s[0]})):a&&t.dispatchEvent(new CustomEvent("hax-insert-content",{bubbles:!0,cancelable:!0,composed:!0,detail:s.find((e=>"a"==e.tag))})):this.haxAppPicker.presentOptions(s,o,"Pick how to present this "+n,"gizmo"),!0):(this.toast("Sorry, HAX doesn't know how to handle that type of link yet."),!1)}write(e,t,i){i&&i.dispatchEvent(new CustomEvent("hax-store-write",{composed:!0,bubbles:!0,cancelable:!1,detail:{property:e,value:t,owner:i}}))}mimeTypeToGizmoType(e){let t=e.split("/");switch(t[0]){case"audio":return"audio";case"image":return"svg+xml"==t[1]?"svg":"image";case"video":return"video";case"text":return["csv","html","markdown"].includes(t[1])?t[1]:"document";case"application":return"pdf"==t[1]?"pdf":["zip","gzip","x-tar"].includes(t[1])?"archive":"document"}}guessGizmoType(e){if(void 0!==e.source){const t=e.source.toLowerCase();if(-1!=t.indexOf(".mp3")||-1!=t.indexOf(".midi")||-1!=t.indexOf(".mid"))return"audio";if(-1!=t.indexOf(".png")||-1!=t.indexOf(".jpg")||-1!=t.indexOf(".jpeg"))return"image";if(-1!=t.indexOf(".gif"))return"gif";if(-1!=t.indexOf(".pdf"))return"pdf";if(-1!=t.indexOf(".svg"))return"svg";if(-1!=t.indexOf(".csv"))return"csv";if(-1!=t.indexOf(".md"))return"markdown";if(-1!=t.indexOf(".html")||-1!=t.indexOf(".htm"))return"html";if(-1!=t.indexOf(".txt")||-1!=t.indexOf(".doc")||-1!=t.indexOf(".docx")||-1!=t.indexOf(".xls")||-1!=t.indexOf(".xlsx")||-1!=t.indexOf(".vtt")||-1!=t.indexOf(".ppt"))return"document";if(-1!=t.indexOf(".zip")||-1!=t.indexOf(".tar.gz")||-1!=t.indexOf(".tar"))return"archive";if("external"!=window.MediaBehaviors.Video.getVideoType(t))return"video"}return"*"}render(){return t` `}static get tag(){return"hax-store"}toast(e,t=2e3,i={},a="capsule",o=this.t.close,n=null,r=null){window.dispatchEvent(new CustomEvent(this.toastShowEventName,{bubbles:!0,composed:!0,cancelable:!0,detail:{text:e,duration:t,classStyle:a,closeText:o,eventCallback:n,slot:r,...i}}))}static get properties(){return{...super.properties,skipHAXConfirmation:{type:Boolean,reflect:!0,attribute:"skip-hax-confirmation"},storageData:{type:Object},haxTray:{type:Object},haxCancel:{type:Object},haxAutoloader:{type:Object},haxBodies:{type:Array},activePlaceHolder:{type:Object},appStore:{type:Object},sessionObject:{type:Object},skipExitTrap:{type:Boolean},elementList:{type:Object},staxList:{type:Array},validTagList:{type:Array},validGridTagList:{type:Array},validGizmoTypes:{type:Array},_isSandboxed:{type:Boolean},__appStoreData:{type:Object},ready:{type:Boolean},connectionRewrites:{type:Object}}}_storageDataChanged(e){e&&this.ready&&this.__storageDataProcessed&&(u("haxConfirm",!1)?g("haxUserData",e):sessionStorageGet("haxConfirm")&&sessionStorageSet("haxUserData",e))}isSingleSlotElement(e){let t=Object.keys(this.slotsSchemaFromNode(e));return 1==t.length&&0===t[0].length}isTextElement(e){let t;return null!=e&&e.tagName?t=e.tagName.toLowerCase():null!=e&&e.tag&&(t=e.tag.toLowerCase()),!!(t&&this.validTagList.includes(t)&&["p","ol","ul","li","a","h1","h2","h3","h4","h5","h6","strike","u","b","sub","sup","span","mark","abbr","i","bold","em","strong","blockquote","code","figure"].includes(t))}isInlineElement(e){let t;return null!=e&&e.tagName?t=e.tagName.toLowerCase():null!=e&&e.tag&&(t=e.tag.toLowerCase()),!!(t&&this.validTagList.includes(t)&&(this.haxSchemaFromTag(t)&&this.haxSchemaFromTag(t).meta&&this.haxSchemaFromTag(t).meta.inlineOnly||["a","strike","u","b","sub","sup","span","code","mark","abbr","i","bold","em","strong"].includes(t)))}isGridPlateElement(e){let t;return e&&e.tagName?t=e.tagName.toLowerCase():e&&e.tag&&(t=e.tag.toLowerCase()),!(!t||!this.validGridTagList.includes(t))}isLayoutElement(e){let t=e&&e.tagName&&this.haxSchemaFromTag(e.tagName)||{};return t.type&&"grid"===t.type}isLayoutSlot(e){return!(!e||!e.parentNode)&&this.isLayoutElement(e.parentNode)}isOriginalGridPlate(e){return!!e&&"GRID-PLATE"===e.tagName}activeSchema(){return this.activeNode?this.haxSchemaFromTag(this.activeNode.tagName):void 0}activeParentSchema(){return this.activeNode&&this.activeNode.parentNode?this.haxSchemaFromTag(this.activeNode.parentNode.tagName):void 0}slottedContentByNode(e){let t={...this.slotsSchemaFromNode(e)||{}};return e?([...e.children||[]].forEach((e=>{e.slot&&""!==e.slot&&t[e.slot]?(t[e.slot].items=t[e.slot].items||[],t[e.slot].items.push(e)):e.slot&&""!==e.slot||!t[""]||(t[""].items=t[""].items||[],t[""].items.push(e))})),t):t}slotsSchemaFromNode(e){if(!e||!e.tagName)return{};let t={},i=this.haxSchemaFromTag(e.tagName||{}),a=this.slotsFromSchema(i);if(this.isOriginalGridPlate(e)){(e.layout||"1-1-1-1").split("-").map(((e,t)=>{a.push({slot:`col-${t+1}`,title:`Column ${t+1}`,excludedSlotWrappers:["grid-plate"]})}))}return a.forEach((a=>{a.items=void 0,a.label=a.title||a.slot,a.editMode={...i.editMode,...a.editMode},a.grid=e,(a.slot||""===a.slot)&&(t[a.slot]=a)})),t}schemaBySlotId(e,t){return(this.slotsSchemaFromNode(e)||{})[t]}_appStoreChanged(e,t){e&&t&&(e.url&&!e.apps&&this.shadowRoot?this.loadAppStoreFromRemote():this.__appStoreData=e)}async _loadAppStoreData(e){if(null!=e){var t={};if(void 0!==e.autoloader){e.autoloader=Object.assign({},e.autoloader);for(let i in e.autoloader){let a=i,o=e.autoloader[i];isNaN(a)||(a=e.autoloader[i],o=`@lrnwebcomponents/${a}/${a}.js`),"string"!=typeof o&&(o.haxProperties&&this.setHaxProperties(e.autoloader[i].haxProperties,a),o=e.autoloader[i].import),this.validTagList.push(a),t[a]=o}}if(void 0!==e.apps){var i=e.apps;for(let e=0;e{window.customElements.get(a)&&window.customElements.get(a).haxProperties?this.setHaxProperties(window.customElements.get(a).haxProperties,a):t.appendChild(document.createElement(a))})).catch((e=>{console.warn(e),t.appendChild(document.createElement(a))}))}}isExternalURLImport(e){let t;try{t=new URL(e)}catch(e){return!1}return new URL(t).origin!==location.origin}_editModeChanged(e){e&&!this.appStoreLoaded&&this.__appStoreData&&this.haxAutoloader&&(clearTimeout(this.__readyToProcessAppStoreData),this._loadAppStoreData(this.__appStoreData))}async _globalPreferencesChanged(e){if(this.__storageDataProcessed&&e&&this.ready){let t=this.storageData;"string"==typeof t&&(t=JSON.parse(t)),t.globalPreferences=e,this.storageData=t,this._storageDataChanged(this.storageData),e.haxLang&&HAXStore.editMode&&(clearTimeout(this._debounceLang),this._debounceLang=setTimeout((async()=>{for(let e in this.elementList){let t=this.elementList[e];t=await this.attemptGizmoTranslation(e,t),this.elementList[e]=t}this.gizmoList.forEach((e=>{this.elementList[e.tag].gizmo.title&&(e.title=this.elementList[e.tag].gizmo.title),this.elementList[e.tag].gizmo.description&&(e.description=this.elementList[e.tag].gizmo.description)}))}),100))}}_haxContextOperation(e){let t=e.detail;if(this.activeNode){let e=!1;switch(t.eventName){case"hax-align-left":this.activeNode.style.float=null,this.activeNode.style.margin=null,this.activeNode.style.display=null,e=!0;break;case"hax-align-center":this.activeNode.style.float=null,this.activeNode.style.margin="0 auto",this.activeNode.style.display="block",e=!0;break;case"hax-align-right":this.activeNode.style.float="right",this.activeNode.style.margin="0 auto",this.activeNode.style.display="block",e=!0;break;case"hax-size-change":100==t.value||t.value>100?this.activeNode.style.width=null:this.activeNode.style.width=t.value+"%",e=!0;break;case"hax-style-setting-change":Object.keys(t.value).forEach((e=>{e.startsWith("__")||(this.activeNode.style.removeProperty(e),"background-color"===e&&this.activeNode.style.removeProperty("color"),setTimeout((()=>{if("background-color"===e)this.activeNode.style[e]=`var(--simple-colors-default-theme-${t.value[e]}-1)`,this.activeNode.style.color=`var(--simple-colors-default-theme-${t.value[e]}-12)`;else if("text-align"===e)this.activeNode.style[e]=t.value[e];else if("font-size"===e)switch(t.value[e]){case"x-small":this.activeNode.style[e]="0.8em";break;case"small":this.activeNode.style[e]="0.9em";break;case"large":this.activeNode.style[e]="1.2em";break;case"x-large":this.activeNode.style[e]="1.4em";break;case"xx-large":this.activeNode.style[e]="2em"}else this.activeNode.style[e]=t.value[e]+"px"}),0))})),e=!0}e&&(clearTimeout(this.__repositionMenu),this.__repositionMenu=setTimeout((()=>{this.activeHaxBody.positionContextMenus()}),0))}}_haxConsentTap(e){g("haxConfirm",!0),g("haxUserData",JSON.stringify(this.storageData))}updated(e){super.updated&&super.updated(e),e.forEach(((e,t)=>{"appStore"==t&&this[t]&&this._appStoreChanged(this[t],e),["ready","__appStoreData","haxAutoloader"].includes(t)&&this.ready&&this.__appStoreData&&this.haxAutoloader&&(clearTimeout(this.__readyToProcessAppStoreData),this.__readyToProcessAppStoreData=setTimeout((()=>{this._loadAppStoreData(this.__appStoreData)}),0)),["haxAutoloader","haxTray","haxCancel"].includes(t)&&(clearTimeout(this.__storeReady),this.__storeReady=setTimeout((()=>{this._storePiecesAllHere(this.haxAutoloader,this.activeHaxBody,this.haxTray,this.haxCancel)}),0))}))}_calculateActiveGizmo(e){if(null==e||!e.tagName)return null;for(let i in this.gizmoList){var t=this.gizmoList[i];if(t.tag===e.tagName.toLowerCase())return t}}loadAppStoreFromRemote(){const e=new URLSearchParams(this.appStore.params);let t=this.appStore.url;e&&(t+=`?${e}`),fetch(t,{method:this.method}).then((e=>{if(e.ok)return e.json()})).then((e=>{this.__appStoreData=e}))}firstUpdated(e){if(super.firstUpdated&&super.firstUpdated(e),this.skipHAXConfirmation&&(sessionStorageSet("haxConfirm",!0),g("haxConfirm",!0)),sessionStorageGet("haxConfirm")||u("haxConfirm"))if(sessionStorageGet("haxConfirm")&&!u("haxConfirm"))try{let e=sessionStorageGet("haxUserData")?JSON.parse(sessionStorageGet("haxUserData")):{};this.storageData=e,this._storageDataChanged(this.storageData)}catch(e){}else try{let e=u("haxUserData",{});this.storageData=e,this._storageDataChanged(this.storageData)}catch(e){}else{sessionStorageSet("haxConfirm",!0);let e="\n The HAX content editor keeps preferences in order to improve your experience.\n This data is stored in your browser and is never sent anywhere.\n Click to accept.\n ";this.toast(e,"-1",{},"fit-bottom","I Accept","hax-consent-tap")}setTimeout((()=>{this.__storageDataProcessed=!0,this.storageData.globalPreferences&&this.write("globalPreferences",this.storageData.globalPreferences,this)}),0)}_storePiecesAllHere(e,t,i,a){if(!this.ready&&t&&e&&i&&a){this.dispatchEvent(new CustomEvent("hax-store-ready",{bubbles:!0,cancelable:!1,composed:!0,detail:!0}));let e=window.RichTextEditorPrompt.requestAvailability();e&&(e.shadowRoot.querySelector("#formfields").schematizer=o,e.shadowRoot.querySelector("#formfields").elementizer=n),i.shadowRoot.querySelector("#haxcancelbutton")&&(a.shadowRoot.querySelector("#dialog").associateEvents(i.shadowRoot.querySelector("#haxcancelbutton")),a.shadowRoot.querySelector("#dialog")&&window.addEventListener("simple-modal-confirmed",this._handleConfirmCancel.bind(this))),this.ready=!0,this._buildPrimitiveDefinitions()}}_handleConfirmCancel(e){e.detail.invokedBy===this.haxTray.shadowRoot.querySelector("#haxcancelbutton")&&(this.editMode=!1,this.dispatchEvent(new CustomEvent("hax-cancel",{bubbles:!0,composed:!0,cancelable:!1,detail:e.detail})))}_positionCursorInNode(e,t=0){this.activeHaxBody.positionContextMenus();var i=document.createRange(),a=this.getSelection();return i.setStart(e,t),i.collapse(!0),a.removeAllRanges(),a.addRange(i),i}_onBeforeUnload(e){if(!this.skipExitTrap&&this.editMode)return"Are you sure you want to leave? Your work will not be saved!"}isBase64(e){try{return btoa(atob(e))==e}catch(e){return!1}}retrieveImageFromClipboardAsBlob(e,t){if(0==e.clipboardData&&"function"==typeof t)return t(void 0);var i=e.clipboardData.items;if(null==i&&"function"==typeof t)return t(void 0);for(let e=0;e\s*?<\/span>/g," "),o=o.replace(/(?:style="(\S+:\s*[^;"]+;\s*)*)+"/g,""),o=o.replace(/
    /g,"

    "),n=o,this.isBase64(n))return e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),this.retrieveImageFromClipboardAsBlob(e,(t=>{if(t){var i=window.URL||window.webkitURL;let a=document.createElement("img");a.src=i.createObjectURL(t),this.activeNode.parentNode.insertBefore(a,this.activeNode.nextElementSibling);for(let t in e.clipboardData.items)!e.clipboardData.items[t].name&&e.clipboardData.items[t].type&&(e.clipboardData.items[t].name="image-"+Math.floor(Date.now()/1e3)+e.clipboardData.items[t].type.replace("image/","."));return e.dataTransfer=e.clipboardData,e.placeHolderElement=a,this.dispatchEvent(new CustomEvent("place-holder-file-drop",{bubbles:!0,cancelable:!0,composed:!0,detail:e})),a}return!1}));if(e.clipboardData.files.length>0){e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation();let t=this.activeHaxBody.haxInsert("p","",{});e.dataTransfer=e.clipboardData;for(let t in e.clipboardData.files)!e.clipboardData.files[t].name&&e.clipboardData.files[t].type&&(e.clipboardData.files[t].name="image-"+Math.floor(Date.now()/1e3)+e.clipboardData.files[t].type.replace("image/","."));e.placeHolderElement=t,this.dispatchEvent(new CustomEvent("place-holder-file-drop",{bubbles:!0,cancelable:!0,composed:!0,detail:e}))}let r=!1,s="",d=document.createElement("div");d.innerHTML=o;let p=[];if(d.children&&(o=l(o),o=o.replace(/

    /g,"

    "),o=o.replace(/<\/h1>/g,"

    "),o=o.replace(//g,(function(e,t){return``})),p=await this.htmlToHaxElements(o),1!==p.length||this.__validGridTags().includes(p[0].tag)||(p=await this.htmlToHaxElements(p[0].content))),0===p.length&&h(o)){""!=this.activeNode.innerText.trim()&&(r=!0);let e={source:o,title:o};if(!r&&!this.insertLogicFromValues(e,this,!1,!0))return!1}else if(0===p.length){if(r=!0,n==o)return!1;s=o}else if(1===p.length&&"p"===p[0].tag)s=o,r=!0;else if(1===p.length&&"a"===p[0].tag&&p[0].properties.href)if(""!=this.activeNode.innerText.trim())s=p[0].properties.href,r=!0;else{let e={source:p[0].properties.href,title:p[0].content};if(!this.insertLogicFromValues(e,this))return!1}else{if(!this.isGridPlateElement(p[0]))return!1;for(let e in p){"p"==p[e].tag&&["li","ol","ul"].includes(this.activeNode.tagName.toLowerCase())&&(p[e].tag="li"),delete p[e].properties.style,delete p[e].properties.start,delete p[e].properties.align;let t=c({tag:p[e].tag,content:p[e].content.replace(/ <\/span>/g," ").trim(),properties:p[e].properties});s+=await this.nodeToContent(t)}}e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation();try{let e=this.getRange(),n=this.getSelection(),l=document.createElement("div");if(l.innerHTML=s,e&&n){for(let e in l.children)l.children[e].tagName&&this.isTextElement(l.children[e])&&""===l.children[e].innerHTML&&l.children[e].remove();if(r){let t;if(h(o))t=document.createElement("a"),t.setAttribute("href",o),t.setAttribute("rel","noopener noreferrer"),t.setAttribute("target","_blank"),t.innerText=o;else if(l.children&&l.children.length>0){for(;l.childNodes.length>1;)e.insertNode(Array.from(l.childNodes).pop());t=Array.from(l.childNodes).pop()}else t=document.createTextNode(l.innerHTML);e.insertNode(t),setTimeout((()=>{this._positionCursorInNode(t,t.length)}),0)}else{var t,i,a;for(""!=this.activeNode.innerText.trim()&&e.endOffset!=this.activeNode.innerText.length&&(t=!0,document.execCommand("insertParagraph")),e.commonAncestorContainer&&e.commonAncestorContainer.parentNode&&(a||this.activeNode==e.commonAncestorContainer||(a=e.commonAncestorContainer.parentNode)||(a=e.commonAncestorContainer));l.firstElementChild;)i=l.firstElementChild,a?(a.getAttribute&&a.getAttribute("slot")&&i.setAttribute("slot",a.getAttribute("slot")),t?(this.activeHaxBody.haxReplaceNode(a.previousElementSibling,i),t=!1):a.parentNode?a.parentNode.insertBefore(i,a.nextElementSibling):a.insertBefore(i,a.nextElementSibling)):this.activeNode?(this.activeNode.getAttribute("slot")&&i.setAttribute("slot",this.activeNode.getAttribute("slot")),""==this.activeNode.innerText.trim()?this.activeHaxBody.haxReplaceNode(this.activeNode,i):this.activeNode.parentNode.insertBefore(i,this.activeNode.nextElementSibling)):this.activeHaxBody.appendChild(i),a=i;setTimeout((()=>{i&&i.childNodes&&i.childNodes[0]&&(this._positionCursorInNode(i.childNodes[0],i.childNodes[0].length),i=null,a=null)}),0)}}}catch(e){console.warn(e)}}}__validGridTags(){return["p","ol","ul","li","div","h1","h2","h3","h4","h5","h6","blockquote","code","section","dl","dd","dt","figure"]}__validTags(){return["p","div","span","mark","abbr","table","caption","sup","sub","u","strike","tr","th","td","ol","ul","li","a","strong","kbd","tt","em","i","b","hr","h1","h2","h3","h4","h5","h6","blockquote","code","figure","figcaption","img","iframe","video","audio","section","dl","dt","dd","template","webview"]}__validGizmoTypes(){return["data","video","audio","text","link","file","pdf","image","csv","doc","document","archive","markdown","html","content","text","gif","inline","*"]}constructor(){super(),N(["core"]),this.toastShowEventName="simple-toast-show",this.t={close:"Close"},void 0!==window.speechSynthesis&&(window.SpeechRecognition||window.webkitSpeechRecognition||window.mozSpeechRecognition||window.msSpeechRecognition||window.oSpeechRecognition)&&(C.voiceSearch=!0),C.icon="hax:wizard-hat",C.allowedCallback=()=>!(!this.ready||!this.editMode),C.defineOption({title:"Insert emoji",icon:"editor:insert-emoticon",tags:["emoji"],value:{name:"Insert emoji",context:"/",program:async(e,t)=>{let i=[],a=document.createElement("textarea");return await Object.keys(window.SimplePickerEmojis).forEach((async t=>{await window.SimplePickerEmojis[t].forEach((async o=>{(""==e||o.description.includes(e))&&(a.innerHTML=o.value,i.push({title:o.description,textCharacter:a.value,tags:[t],value:{target:this,method:"_insertTextResult",args:[a.value]},context:["/","/HAX/text/emoji/"+a.value],eventName:"super-daemon-element-method",path:"/HAX/text/emoji/"+a.value}))}))})),i}},context:["HAX","/"],eventName:"super-daemon-run-program",path:"/HAX/text/emoji"}),C.defineOption({title:"Insert symbol",icon:"editor:functions",tags:["symbol"],value:{name:"Insert symbol",context:"/",program:async(e,t)=>{let i=[],a=document.createElement("textarea");return await Object.keys(window.SimplePickerSymbols).forEach((async t=>{await window.SimplePickerSymbols[t].forEach((async o=>{(""==e||t.includes(e))&&(a.innerHTML=o.value,i.push({title:`${t}: ${a.value}`,textCharacter:a.value,tags:[t],value:{target:this,method:"_insertTextResult",args:[a.value]},context:["/","/HAX/text/symbol/"+a.value],eventName:"super-daemon-element-method",path:"/HAX/text/symbol/"+a.value}))}))})),i}},context:["HAX","/"],eventName:"super-daemon-run-program",path:"/HAX/text/symbol"}),C.defineOption({title:"Join our Community",icon:"hax:discord",priority:-100,tags:["community","discord","chat","help"],value:{target:this,method:"_openExternalLink",args:["https://bit.ly/hax-discord"]},eventName:"super-daemon-element-method",path:"HAX/community/join",context:["logged-in","CMS","HAX","?"]}),C.defineOption({title:"User Tutorials",icon:"hax:hax2022",priority:-1e3,tags:["Documentation","community","help"],value:{target:this,method:"_openExternalLink",args:["https://oer.hax.psu.edu/bto108/sites/haxcellence/tutorials"]},eventName:"super-daemon-element-method",path:"HAX/community/tutorials",context:["logged-in","CMS","HAX","?"]}),C.defineOption({title:"User Documentation",icon:"hax:hax2022",tags:["Documentation","community","help"],value:{target:this,method:"_openExternalLink",args:["https://oer.hax.psu.edu/bto108/sites/haxcellence/documentation"]},eventName:"super-daemon-element-method",path:"HAX/community/documentation",context:["logged-in","CMS","HAX","?"]}),C.defineOption({title:"HAX Teaching Excellence",icon:"hax:hax2022",tags:["Ontology","community","pedagogy","documentation","help"],value:{target:this,method:"_openExternalLink",args:["https://oer.hax.psu.edu/bto108/sites/haxcellence/ontology"]},eventName:"super-daemon-element-method",path:"HAX/community/pedagogy",context:["logged-in","CMS","HAX","?"]}),C.defineOption({title:"Bug / issue",icon:"mdi-social:github-circle",tags:["Bug report","github","git","community","issue queue"],value:{target:this,method:"_haxStoreContribute",args:["bug","POP,bug"]},eventName:"super-daemon-element-method",path:"HAX/community/contribute",context:["logged-in","CMS","HAX","?"]}),C.defineOption({title:"Idea / Feature request",icon:"mdi-social:github-circle",tags:["Feature request","idea","github","git","community","issue queue"],value:{target:this,method:"_haxStoreContribute",args:["feature","POP,enhancement"]},context:["logged-in","CMS","HAX","?"],eventName:"super-daemon-element-method",path:"HAX/community/contribute"}),this.primativeHooks={},this.__dragTarget=null,this.registerLocalization({context:this,namespace:"hax",basePath:import.meta.url+"/../../",locales:["es"]}),this.appSearch=null,this.method="GET",this.haxSelectedText="",this.__winEvents={"hax-super-daemon-insert-tag":"_superDaemonInsert","hax-register-properties":"_haxStoreRegisterProperties","hax-consent-tap":"_haxConsentTap","hax-context-item-selected":"_haxContextOperation",onbeforeunload:"_onBeforeUnload",paste:"_onPaste","hax-register-app":"_haxStoreRegisterApp","hax-register-stax":"_haxStoreRegisterStax","hax-register-core-piece":"_haxStorePieceRegistrationManager","hax-register-body":"_haxStoreRegisterBody","hax-insert-content":"_haxStoreInsertContent","hax-insert-content-array":"_haxStoreInsertMultiple","hax-refresh-tray-form":"refreshActiveNodeForm","rich-text-editor-prompt-open":"_richTextEditorPromptOpen","rich-text-editor-prompt-close":"_richTextEditorPromptClose","super-daemon-command-context-changed":"_superDaemonCommandContextChanged","super-daemon-context-changed":"_superDaemonContextChanged"},window.onbeforeunload=e=>{if(!this.skipExitTrap&&this.editMode){var t="Are you sure you want to leave? Your work will not be saved!";return e.returnValue=t,t}},a.registerNewTour({key:"hax",name:"Let's learn HAX",style:"\n simple-popover-manager::part(simple-popover) {\n max-width: 250px;\n }\n simple-popover-manager button {\n font-size: 12px;\n margin: 0px 2px;\n }\n simple-popover-manager p {\n --hax-base-styles-p-font-size: 14px;\n padding: 0;\n margin: 0;\n font-size: 14px;\n line-height: 20px;\n }\n simple-popover-manager h3 {\n --hax-base-styles-h3-font-size: 18px;\n margin: 8px 2px;\n }"}),this.skipHAXConfirmation=!1,this.storageData={},this.appStore={url:"",params:{}},this.daemonKeyCombo=`${C.key1} + ${C.key2} + `,this.activeNode=null,this.activeEditingElement=null,this.haxBodies=[],this.activePlaceHolder=null,this.sessionObject={},this.editMode=!1,this.skipExitTrap=!1,this.appStoreLoaded=!1,this.elementList={},this.elementAlign=u("hax-tray-elementAlign"),this.elementAlign&&null!=this.elementAlign||(this.elementAlign="left"),this.trayStatus="collapsed",this.trayDetail="content-edit",this.appList=[],this.gizmoList=[],this.recentGizmoList=[],this.haxAutoloader=null,this.activeHaxBody=null,this.haxTray=null,this.haxCancel=null,this.staxList=[],this.globalPreferences={},this.activeApp={},this.connectionRewrites={},this.daemonCommands={},this.keyboardShortcuts={"#":{tag:"h2",content:""},"##":{tag:"h3",content:""},"###":{tag:"h4",content:""},"####":{tag:"h5",content:""},"#####":{tag:"h6",content:""},"######":{tag:"h6",content:""},"1.":{tag:"ol",content:"
  • "},"-":{tag:"ul",content:"
  • "},"*":{tag:"ul",content:"
  • "},"+":{tag:"ul",content:"
  • "},"---":{tag:"hr"},"***":{tag:"hr"},___:{tag:"hr"},"```":{tag:"code",content:""},">":{tag:"blockquote",content:""}},this.validTagList=this.__validTags(),this.validGridTagList=this.__validGridTags(),this.validGizmoTypes=this.__validGizmoTypes();let e=document.createElement("webview");this._isSandboxed="function"==typeof e.reload,window.SimpleToast.requestAvailability(),document.body.style.setProperty("--hax-ui-headings","#d4ff77"),v(this,{daemonKeyCombo:x,gizmoList:x,recentGizmoList:x,activeNode:x,globalPreferences:x,activeGizmo:f,activeNodeIndex:f,editMode:x,elementAlign:x,trayStatus:x,trayDetail:x,appList:x,activeApp:x,haxSelectedText:x,activeEditingElement:x,activeHaxBody:x,appStoreLoaded:x}),y((()=>{this._globalPreferencesChanged(w(this.globalPreferences))})),y((()=>{this._editModeChanged(w(this.editMode))}))}async _insertTextResult(e){this.activeNode.focus(),C.activeRange.setStart(this.activeNode,0),C.activeRange.collapse(!0),C.activeSelection.removeAllRanges(),C.activeSelection.addRange(C.activeRange),C.activeSelection.selectAllChildren(this.activeNode),C.activeSelection.collapseToEnd(),setTimeout((()=>{""==this.activeNode.textContent?this.activeNode.textContent=e:document.execCommand("insertHTML",!1,e)}),0)}_openExternalLink(e){window.open(e,"_blank")}async _haxStoreContribute(e,t,i=null){let a="";if("merlin"==e){var o=`[${e}] New command request from HAX daemon`;a=`Location: ${window.location.href}\nMerlin command: ${i}\nWhat did you want merlin to do?\n`}else{o=`[${e}] User report from HAX daemon`;if(a=`Location: ${window.location.href}\nBrowser: ${navigator.userAgent}\nOS: ${navigator.userAgentData.platform} - ${navigator.deviceMemory}GB RAM - ${navigator.hardwareConcurrency} cores\nScreen: ${window.screen.width}x${window.screen.height}\nWindow size: ${window.innerWidth}x${window.innerHeight}\n`,navigator.getBattery){a+=`Battery: ${100*(await navigator.getBattery()).level}%\n`}navigator.connection&&navigator.connection.effectiveType&&(a+=`Connection: ${navigator.connection.effectiveType}\n`),a+=("feature"==e?"Your idea:":"Bug you experienced:")+"\n"}window.open(`https://github.com/elmsln/issues/issues/new?assignees=&labels=${t}&template=issue-report.md&title=${o}&body=${encodeURIComponent(a)}`,"_blank")}_superDaemonCommandContextChanged(e){}_superDaemonContextChanged(e){-1!==e.detail.value.indexOf("CMS")?C.questionTags=[{value:"CMS/action/edit",label:"Edit current page"},{value:"*",label:"List everything I can do"},{value:"?",label:"HELP!"}]:-1!==e.detail.value.indexOf("HAX")?C.questionTags=[{value:"CMS/action/save",label:"Save current page"},{value:"media",label:"Where can I find media?"},{value:"*",label:"List everything I can do"},{value:"?",label:"HELP!"}]:C.questionTags=[{value:"*",label:"List everything I can do"},{value:"?",label:"HELP!"}]}_richTextEditorPromptOpen(){const e=window.getComputedStyle(document.body);"hidden"==e.getPropertyValue("overflow")&&(this.__overflowHiddenOnOpen=e.getPropertyValue("overflow"),document.body.style.overflow="auto")}_richTextEditorPromptClose(){this.__overflowHiddenOnOpen&&(document.body.style.overflow=this.__overflowHiddenOnOpen,this.__overflowHiddenOnOpen=null)}_buildPrimitiveDefinitions(){if(this._isSandboxed){let e={type:"element",editingElement:"core",canScale:!0,canPosition:!0,canEditSource:!0,settings:{configure:[{attribute:"src",title:"Source",description:"The URL for this resource.",inputMethod:"textfield",icon:"link",required:!0,validationType:"url"}],advanced:[]}};this.setHaxProperties(e,"webview")}this.setHaxProperties({canScale:{min:10,step:5},type:"element",editingElement:"core",canPosition:!0,canEditSource:!0,gizmo:{title:"Image",description:"A basic img tag",icon:"image:image",color:"blue-grey",tags:["Images","media","img","html"],handles:[{type:"image",source:"src"}],meta:{author:"W3C",hidden:!0}},settings:{configure:[{attribute:"src",title:"Source",description:"The URL for this image.",inputMethod:"haxupload",noVoiceRecord:!0,icon:"link",required:!0,validationType:"url"},{attribute:"alt",title:"Alt text",description:"Useful for screen readers and improved SEO.",inputMethod:"alt",icon:"accessibility"},{attribute:"height",title:"Height",description:"height in pixels of the item. Leave blank to respond to the natural resolution",inputMethod:"textfield",icon:"icons:swap-vert"}],advanced:[{attribute:"loading",title:"Loading method",description:"Whether or not to lazy load this",inputMethod:"select",options:{lazy:"Load when visible",auto:"Automatic"}}]},demoSchema:[{tag:"img",content:"",properties:{src:"https://cdn2.thecatapi.com/images/9j5.jpg",loading:"lazy"}}]},"img");let e={canScale:{min:10,step:5},type:"grid",canPosition:!0,canEditSource:!0,gizmo:{title:"Figure",description:"A basic figure tag",icon:"hax:figure",color:"blue-grey",tags:["Images","media","figure","html"],requiresChildren:"figcaption",handles:[],meta:{author:"W3C",hidden:!0}},settings:{configure:[_]},demoSchema:[{tag:"figure",properties:{},content:'image other media here\n

    Image Caption Here

    '}]};this.setHaxProperties(e,"figure");let t={canScale:{min:10,step:5},type:"grid",editingElement:"core",canPosition:!0,canEditSource:!0,gizmo:{title:"Figure caption",description:"Used inside of a figure tag",icon:"image:image",color:"blue-grey",tags:["Images","media","caption","figure","html"],handles:[],requiresParent:"figure",meta:{author:"W3C",hidden:!0}},settings:{configure:[{slot:"",title:"Figure Caption",description:"Caption for the figure",inputMethod:"code-editor"},_]},demoSchema:[{tag:"figcaption",properties:{},content:"Image Caption Here"}]};this.setHaxProperties(t,"figcaption");let i={type:"element",editingElement:"core",canScale:!1,canPosition:!1,canEditSource:!0,contentEditable:!0,gizmo:{title:"Highlight",description:"Highlight text within a block of content",icon:"editor:highlight",color:"yellow",tags:["Content","text","highlight","mark","html"],handles:[],meta:{author:"W3C",hidden:!0}},settings:{configure:[{attribute:"innerText",title:"Text",description:"Text of the highlight",inputMethod:"textfield",required:!0},A],advanced:[],developer:[]},demoSchema:[{tag:"mark",content:"Highlight me",properties:{}}]};this.setHaxProperties(i,"mark");let a={type:"element",editingElement:"core",canScale:!1,canPosition:!1,canEditSource:!0,contentEditable:!0,gizmo:{title:"Abbreviation",description:"Simple abbreviation with tooltip of full word",icon:"hax:abbr",color:"yellow",tags:["Content","text","abbr","html"],handles:[],meta:{author:"W3C",hidden:!0}},settings:{configure:[{attribute:"innerText",title:"Text",description:"Text that is visible, the abbreviation",inputMethod:"textfield",required:!0},{attribute:"title",title:"Word",description:"Word that the abbreviation is representing",inputMethod:"textfield",required:!0},A],advanced:[],developer:[]},demoSchema:[{tag:"abbr",content:"Abbr",properties:{title:"Abbreviation"}}]};this.setHaxProperties(a,"abbr");let o={type:"element",editingElement:"core",canScale:!1,canPosition:!1,canEditSource:!0,contentEditable:!0,gizmo:{title:"Basic link",description:"A basic a tag",icon:"icons:link",color:"blue-grey",tags:["Resource","link","a","url","html","href","address","http"],handles:[],meta:{author:"W3C"}},settings:{configure:[{attribute:"innerText",title:"Text",description:"Text of the link",inputMethod:"textfield",required:!0},{attribute:"href",title:"Link",description:"The URL for the link",inputMethod:"haxupload",required:!0,validationType:"url"},{attribute:"target",title:"Target",description:"Where to open the link.",inputMethod:"select",options:{"":"Same window",_blank:"New window - _blank",_top:"Top window - _top",_parent:"Parent window - _parent"}},A],advanced:[],developer:[{attribute:"title",title:"Title text",description:"Useful for screen readers and improved SEO.",inputMethod:"textfield"},{attribute:"rel",title:"rel",description:"Specifies the relationship between this document and the opened document. Change as part of security or SEO policy.",inputMethod:"select",options:{noopener:"noopener","noopener noreferrer":"noopener noreferrer","nofollow ":"nofollow","noopener noreferrer nofollow":"noopener noreferrer nofollow",opener:"opener"}}]},demoSchema:[{tag:"p",content:'Link to content',properties:{}}]};this.validGizmoTypes.forEach((e=>{o.gizmo.handles.push({type:e,source:"href",title:"innerText",alt:"title"})})),this.setHaxProperties(o,"a");let n={type:"element",editingElement:"core",canScale:!1,canPosition:!1,canEditSource:!0,contentEditable:!0,gizmo:{title:"Paragraph",description:"A basic text area",icon:"hax:paragraph",color:"blue-grey",tags:["Text","p","paragraph","text","html"],handles:[{type:"content",title:"innerHTML",alt:"title"}],meta:{author:"W3C",outlineDesigner:!0}},settings:{configure:[_],advanced:[]},demoSchema:[{tag:"p",content:"Deep thoughts..",properties:{}}]};this.setHaxProperties(n,"p");let r={type:"element",editingElement:{tag:"editable-table",import:"@lrnwebcomponents/editable-table/editable-table.js",callback:this.setupEditableTable.bind(this)},canScale:!0,canPosition:!0,canEditSource:!0,gizmo:{title:"Table",description:"A table for displaying data",icon:"image:grid-on",color:"blue-grey",tags:["Instructional","table","data","html","grid","matrix","spreadsheet","csv","excel"],meta:{hidden:!0,author:"W3C"}},settings:{configure:[],advanced:[]}};this.setHaxProperties(r,"table");let s=document.createElement("editable-table");this.haxAutoloader.appendChild(s);let l={type:"element",editingElement:{tag:"iframe-loader",import:"@lrnwebcomponents/iframe-loader/iframe-loader.js",callback:this.setupIframeLoader.bind(this)},canScale:!1,canPosition:!0,canEditSource:!1,gizmo:{title:"iFrame",description:"A basic way to frame external web content",icon:"hax:iframe",color:"blue-grey",tags:["Resource","iframe","content","url","link","embed","https","html","address"],handles:[],meta:{author:"W3C",hidden:!0}},settings:{configure:[{attribute:"src",title:"Source",description:"The URL for this resource.",inputMethod:"textfield",icon:"link",required:!0,validationType:"url"}]}};this.setHaxProperties(l,"iframe");let d=document.createElement("iframe-loader");this.haxAutoloader.appendChild(d);let c={caption:{title:"Caption",icon:"av:call-to-action"},video:{title:"Video",icon:"av:play-circle-filled"},audio:{title:"Audio",icon:"image:music-note"},section:{title:"Section",icon:"image:crop-landscape"},dl:{title:"Data list",icon:"editor:format-list-bulleted"},dt:{title:"Data term",icon:"editor:format-list-bulleted"},dd:{title:"Data definition",icon:"editor:format-list-bulleted"},ol:{title:"Numbered list",icon:"editor:format-list-numbered"},ul:{title:"Bulleted list",icon:"editor:format-list-bulleted"},li:{title:"List item",icon:"editor:format-list-bulleted"},h1:{title:"Heading",icon:"hax:h1"},h2:{title:"Heading",icon:"hax:h2",tags:["Text","h2","html","text","heading","header"]},h3:{title:"Heading",icon:"hax:h3"},h4:{title:"Heading",icon:"hax:h4"},h5:{title:"Heading",icon:"hax:h5"},h6:{title:"Heading",icon:"hax:h6"},strike:{title:"Cross out",icon:"editor:format-strikethrough"},u:{title:"Underline",icon:"editor:format-underlined"},sub:{title:"Subscript",icon:"mdextra:subscript"},sup:{title:"Superscript",icon:"mdextra:superscript"},div:{title:"DIV",icon:"image:crop-landscape"},span:{title:"SPAN",icon:"editor:short-text",handles:[{type:"inline",text:"text"}]},i:{title:"Italic",icon:"editor:format-italic"},em:{title:"Emphasis",icon:"editor:format-italic"},strong:{title:"Bold",icon:"editor:format-bold"},b:{title:"Bold",icon:"editor:format-bold"},blockquote:{title:"Block quote",icon:"editor:format-quote"},code:{title:"Code",icon:"icons:code"},embed:{title:"Embedded object",icon:"icons:fullscreen"}};for(let e in c){let t="";["h1","h2","h3","h4","h5","h6"].includes(e)?t="Heading":"ul"!=e&&"ol"!=e||(t="
  • Item
  • Item
  • "),this.setHaxProperties({type:"element",editingElement:"core",canScale:!1,canPosition:!1,canEditSource:!0,contentEditable:!0,gizmo:{title:c[e].title,icon:c[e].icon,tags:c[e].tags||["Text",e,"html","text"],handles:c[e].handles||[],meta:{author:"W3C",inlineOnly:!!["em","b","strong","i","strike","u","sub","sup","span"].includes(e),hidden:!["h2","ul"].includes(e),outlineDesigner:!!["h2","ul"].includes(e)}},settings:{configure:["h1","h2","h3","h4","h5","h6"].includes(e)?[A,...L]:[A],advanced:[]},demoSchema:[{tag:e,content:t,properties:{}}]},e)}let h={canScale:{min:25,step:25},type:"element",editingElement:"core",canPosition:!1,canEditSource:!1,contentEditable:!0,gizmo:{title:"Horizontal line",icon:"hax:hr",meta:{author:"W3C"}},settings:{configure:[...L],advanced:[]},demoSchema:[{tag:"hr",content:"",properties:{style:"width:50%;"}}]};this.setHaxProperties(h,"hr")}_haxStorePieceRegistrationManager(e){e.detail&&e.detail.piece&&e.detail.object&&(this[e.detail.piece]=e.detail.object)}setupEditableTable(e){this.activeNode=e,setTimeout((()=>{e.editMode=!0,e.focus()}),0)}setupIframeLoader(e){this.activeNode=e,setTimeout((()=>{e.disabled=!0}),0)}async _haxStoreInsertContent(e){if(e.detail){let i=e.detail;if(window.customElements.get(i.tag)){let e=document.createElement(i.tag);this.testHook(e,"preProcessInsertContent")&&(i=await this.runHook(e,"preProcessInsertContent",[i,this.activeNode]))}var t={};if(void 0!==i.properties&&(t=i.properties),t.innerHTML&&(""==i.content&&(i.content=t.innerHTML),delete t.innerHTML),t.innerText&&(""==i.content&&(i.content=t.innerText),delete t.innerText),void 0!==i.__type&&"inline"===i.__type){let e=c({tag:i.tag,content:i.content,properties:t});null!==this.activePlaceHolder&&(this.activePlaceHolder.deleteContents(),this.activePlaceHolder.insertNode(e)),this.activePlaceHolder=null}else if(i.replace||i.replacement||i.nextToActive){let e=c({tag:i.tag,content:i.content,properties:t});this.activePlaceHolder?(this.activeHaxBody.haxReplaceNode(this.activePlaceHolder,e),this.activePlaceHolder=null):i.nextToActive&&this.activeNode?this.activeHaxBody.__slot&&this.activeNode.haxLayoutContainer?this.activeNode.appendChild(e):this.activeNode.parentNode.insertBefore(e,this.activeNode):this.activeHaxBody.haxReplaceNode(this.activeNode,e)}else if(this.activeNode.parentNode&&"HAX-BODY"!=this.activeNode.parentNode.tagName){let e=c({tag:i.tag,content:i.content,properties:t});this.activeNode.parentNode.haxLayoutContainer?(null!=this.activeNode.getAttribute("slot")&&e.setAttribute("slot",this.activeNode.getAttribute("slot")),this.activeHaxBody.haxInsert(i.tag,i.content,t)):this.activeHaxBody.haxInsert(i.tag,i.content,t)}else this.activeHaxBody.haxInsert(i.tag,i.content,t)}}slotsFromSchema(e,t=!1){let i=e?e.settings:{},a=[];return Object.keys({...i||{}}).map((e=>(i[e]||[]).filter((e=>{let i=!t||!e.required;return!(!e.slot&&""!==e.slot||a.includes(e.slot)||!i)&&(a.push(e.slot),!0)})))).flat()}haxSchemaFromTag(e){return e&&e.toLowerCase&&(e=e.toLowerCase(),this.elementList&&this.elementList[e])?this.elementList[e]:{}}_haxStoreInsertMultiple(e){var t;if(e.detail)for(let i in e.detail)t={},void 0!==e.detail[i].properties&&(t=e.detail[i].properties),this.activeHaxBody.haxInsert(e.detail[i].tag,e.detail[i].content,t)}_haxStoreRegisterBody(e){e.detail&&(this.haxBodies.push(e.detail),this.activeHaxBody=e.detail,this.write("activeHaxBody",this.activeHaxBody,this),this.write("editMode",this.editMode,this),clearTimeout(this.__storeReady),this.__storeReady=setTimeout((()=>{this._storePiecesAllHere(this.haxAutoloader,this.activeHaxBody,this.haxTray,this.haxCancel)}),0))}_superDaemonInsert(e){C.programTarget&&e.detail.properties&&(e.detail.properties.src||e.detail.properties.source||e.detail.properties.href)?C.programTarget.value=e.detail.properties.src||e.detail.properties.source||e.detail.properties.href:this.haxTray._processTrayEvent(e),C.programTarget=null}computePolyfillSafe(){return!(!document.head.createShadowRoot&&!document.head.attachShadow)||(console.warn("Shadow DOM missing, certain operations hidden"),!1)}_haxStoreRegisterApp(e){if(e.detail){const i=e.detail;i.index=this.appList.length,this.appList=[...this.appList,i],this.write("appList",w(this.appList),this);let a="media";if(i.connection.operations&&i.connection.operations.browse&&i.connection.operations.browse.resultMap&&i.connection.operations.browse.resultMap.defaultGizmoType&&(a=i.connection.operations.browse.resultMap.defaultGizmoType),C.defineOption({title:"Search "+i.details.title,icon:i.details.icon,tags:["Search",...i.details.tags,a],more:i.details.tos&&i.details.tos.length>0?t`
    Terms of service: