apprun 3.36.0 → 3.36.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -0
- package/README.md +133 -20
- package/WHATSNEW.md +20 -12
- package/apprun-book.jpg +0 -0
- package/apprun.d.ts +5 -2
- package/cli/app.js +29 -0
- package/cli/index.html +13 -0
- package/{apprun-cli.js → cli/index.js} +8 -14
- package/dist/apprun-dev-tools.js +1 -2
- package/dist/apprun-dev-tools.js.map +1 -1
- package/dist/apprun-html.esm.js +7 -7
- package/dist/apprun-html.esm.js.map +1 -1
- package/dist/apprun-html.js +1 -1
- package/dist/apprun-html.js.map +1 -1
- package/dist/apprun-play-html.esm.js +7 -7
- package/dist/apprun-play-html.esm.js.map +1 -1
- package/dist/apprun-play.js +1 -1
- package/dist/apprun-play.js.map +1 -1
- package/dist/apprun.esm.js +1 -1
- package/dist/apprun.esm.js.map +1 -1
- package/dist/apprun.js +1 -1
- package/dist/apprun.js.map +1 -1
- package/esm/app.js +10 -6
- package/esm/app.js.map +1 -1
- package/esm/apprun-dev-tools.js +1 -7
- package/esm/apprun-dev-tools.js.map +1 -1
- package/esm/apprun.js +18 -4
- package/esm/apprun.js.map +1 -1
- package/esm/component.js +4 -0
- package/esm/component.js.map +1 -1
- package/esm/router.js +241 -18
- package/esm/router.js.map +1 -1
- package/esm/vdom-my-new.js +329 -0
- package/esm/vdom-my-new.js.map +1 -0
- package/esm/vdom-my-prop-attr.js +227 -0
- package/esm/vdom-my-prop-attr.js.map +1 -0
- package/esm/vdom-my.js +109 -143
- package/esm/vdom-my.js.map +1 -1
- package/esm/version.js +1 -1
- package/index.html +1 -1
- package/jest.config.js +2 -1
- package/jest.setup.js +29 -3
- package/jsx-runtime.js +1 -1
- package/jsx-runtime.js.map +1 -1
- package/package.json +7 -7
- package/src/app.ts +11 -6
- package/src/apprun-dev-tools.tsx +1 -7
- package/src/apprun.ts +22 -4
- package/src/component.ts +4 -0
- package/src/router.ts +259 -15
- package/src/vdom-my-new.ts +311 -0
- package/src/vdom-my-prop-attr.ts +241 -0
- package/src/vdom-my.ts +109 -134
- package/src/version.ts +1 -1
- package/cli/export.js +0 -92
- package/cli/import.js +0 -68
- package/plan/plan-apprun-bugfixes.md +0 -207
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
const t="3.36.0",e=`AppRun-${t}`;class i{constructor(){this._events={}}on(t,e,i={}){this._events[t]=this._events[t]||[],this._events[t].push({fn:e,options:i})}off(t,e){const i=this._events[t]||[];this._events[t]=i.filter((t=>t.fn!==e))}find(t){return this._events[t]}run(t,...e){const i=this.getSubscribers(t,this._events);return console.assert(i&&i.length>0,"No subscriber for event: "+t),i.forEach((i=>{const{fn:n,options:s}=i;if(!n||"function"!=typeof n)return console.error(`AppRun event handler for '${t}' is not a function:`,n),!1;if(s.delay)this.delay(t,n,e,s);else try{Object.keys(s).length>0?n.apply(this,[...e,s]):n.apply(this,e)}catch(e){console.error(`Error in event handler for '${t}':`,e)}return!i.options.once})),i.length}once(t,e,i={}){this.on(t,e,Object.assign(Object.assign({},i),{once:!0}))}delay(t,e,i,n){n._t&&clearTimeout(n._t),n._t=setTimeout((()=>{clearTimeout(n._t);try{Object.keys(n).length>0?e.apply(this,[...i,n]):e.apply(this,i)}catch(e){console.error(`Error in delayed event handler for '${t}':`,e)}}),n.delay)}runAsync(t,...e){const i=this.getSubscribers(t,this._events);console.assert(i&&i.length>0,"No subscriber for event: "+t);const n=i.map((i=>{const{fn:n,options:s}=i;if(!n||"function"!=typeof n)return console.error(`AppRun async event handler for '${t}' is not a function:`,n),Promise.resolve(null);try{return Object.keys(s).length>0?n.apply(this,[...e,s]):n.apply(this,e)}catch(e){return console.error(`Error in async event handler for '${t}':`,e),Promise.reject(e)}}));return Promise.all(n)}query(t,...e){return this.runAsync(t,...e)}getSubscribers(t,e){const i=e[t]||[];return e[t]=i.filter((t=>!t.options.once)),Object.keys(e).filter((e=>e.endsWith("*")&&t.startsWith(e.replace("*","")))).sort(((t,e)=>e.length-t.length)).forEach((n=>i.push(...e[n].map((e=>Object.assign(Object.assign({},e),{options:Object.assign(Object.assign({},e.options),{event:t})})))))),i}}const n=e;let s;const o="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};o.app&&o._AppRunVersions?s=o.app:(s=new i,o.app=s,o._AppRunVersions=n);var r=s;function c(t){return(null==t?void 0:t.target)instanceof HTMLElement?t.target:null}const h=(t,e)=>(e?t.state[e]:t.state)||"",l=(t,e,i)=>{if(e){const n=t.state||{};n[e]=i,t.setState(n)}else t.setState(i)},a=(t,e)=>{if(Array.isArray(t))return t.map((t=>a(t,e)));{let{type:i,tag:n,props:s,children:o}=t;return n=n||i,o=o||(null==s?void 0:s.children),s&&Object.keys(s).forEach((t=>{t.startsWith("$")&&(((t,e,i,n)=>{if(t.startsWith("$on")){const i=e[t];if(t=t.substring(1),"boolean"==typeof i)e[t]=e=>n.run?n.run(t,e):r.run(t,e);else if("string"==typeof i)e[t]=t=>n.run?n.run(i,t):r.run(i,t);else if("function"==typeof i)e[t]=t=>n.setState(i(n.state,t));else if(Array.isArray(i)){const[s,...o]=i;"string"==typeof s?e[t]=t=>n.run?n.run(s,...o,t):r.run(s,...o,t):"function"==typeof s&&(e[t]=t=>n.setState(s(n.state,...o,t)))}}else if("$bind"===t){const s=e.type||"text",o="string"==typeof e[t]?e[t]:e.name;if("input"===i)switch(s){case"checkbox":e.checked=h(n,o),e.onclick=t=>{const e=c(t);e&&l(n,o||e.name,e.checked)};break;case"radio":e.checked=h(n,o)===e.value,e.onclick=t=>{const e=c(t);e&&l(n,o||e.name,e.value)};break;case"number":case"range":e.value=h(n,o),e.oninput=t=>{const e=c(t);e&&l(n,o||e.name,Number(e.value))};break;default:e.value=h(n,o),e.oninput=t=>{const e=c(t);e&&l(n,o||e.name,e.value)}}else"select"===i?(e.value=h(n,o),e.onchange=t=>{const e=c(t);e&&!e.multiple&&l(n,o||e.name,e.value)}):"option"===i?(e.selected=h(n,o),e.onclick=t=>{const e=c(t);e&&l(n,o||e.name,e.selected)}):"textarea"===i&&(e.innerHTML=h(n,o),e.oninput=t=>{const e=c(t);e&&l(n,o||e.name,e.value)})}else r.run("$",{key:t,tag:i,props:e,component:n})})(t,s,n,e),delete s[t])})),o&&a(o,e),t}};function u(t,...e){return p(e)}const d="_props";function p(t){const e=[],i=t=>{null!=t&&""!==t&&!1!==t&&e.push("function"==typeof t||"object"==typeof t?t:`${t}`)};return t&&t.forEach((t=>{Array.isArray(t)?t.forEach((t=>i(t))):i(t)})),e}function f(t,e,...i){const n=p(i);if("string"==typeof t)return{tag:t,props:e,children:n};if(Array.isArray(t))return t;if(void 0===t&&i)return n;if(Object.getPrototypeOf(t).i)return{tag:t,props:e,children:n};if("function"==typeof t)return t(e,n);throw new Error(`Unknown tag in vdom ${t}`)}const y=(t,e,i={})=>{if(null==e||!1===e)return;!function(t,e,i={}){if(null==e||!1===e)return;if(e=j(e,i),!t)return;const n="SVG"===t.nodeName;Array.isArray(e)?m(t,e,n):m(t,[e],n)}("string"==typeof t&&t?document.getElementById(t)||document.querySelector(t):t,e=a(e,i),i)};function v(t,e,i){i=i||"svg"===e.tag,function(t,e){const i=t.nodeName,n=`${e.tag||""}`;return i.toUpperCase()===n.toUpperCase()}(t,e)?(m(t,e.children,i),$(t,e.props,i)):t.parentNode.replaceChild(w(e,i),t)}function m(t,e,i){var n;const s=(null===(n=t.childNodes)||void 0===n?void 0:n.length)||0,o=(null==e?void 0:e.length)||0;if(null==e?void 0:e.some((t=>t&&"object"==typeof t&&t.props&&void 0!==t.props.key))){const n=new Map;for(let e=0;e<s;e++){const i=t.childNodes[e];i&&i.key&&n.set(i.key,i)}const r=document.createDocumentFragment();for(let t=0;t<o;t++){const s=e[t];if(null==s)continue;const o=s.props&&s.props.key;if(o&&n.has(o)){const t=n.get(o);v(t,s,i),r.appendChild(t),n.delete(o)}else r.appendChild(w(s,i))}for(;t.firstChild;)t.removeChild(t.firstChild);return void t.appendChild(r)}const r=Math.min(s,o);for(let n=0;n<r;n++){const s=e[n];if(null==s)continue;const o=t.childNodes[n];o&&("string"==typeof s?3===o.nodeType?o.nodeValue!==s&&(o.nodeValue=s):t.replaceChild(g(s),o):s instanceof HTMLElement||s instanceof SVGElement?t.replaceChild(s,o):s&&"object"==typeof s&&v(t.childNodes[n],s,i))}for(;t.childNodes.length>r;)t.removeChild(t.lastChild);if(o>r){const n=document.createDocumentFragment();for(let t=r;t<e.length;t++){const s=e[t];null!=s&&n.appendChild(w(s,i))}t.appendChild(n)}}const b=t=>{const e=document.createElement("section");return e.insertAdjacentHTML("afterbegin",t),Array.from(e.children)};function g(t){if(0===(null==t?void 0:t.indexOf("_html:"))){const e=document.createElement("div");return e.insertAdjacentHTML("afterbegin",t.substring(6)),e}return document.createTextNode(null!=t?t:"")}function w(t,e){if(t instanceof HTMLElement||t instanceof SVGElement)return t;if("string"==typeof t)return g(t);if(!t||"object"!=typeof t||!t.tag||"function"==typeof t.tag)return g("object"==typeof t?JSON.stringify(t):String(null!=t?t:""));const i=(e=e||"svg"===t.tag)?document.createElementNS("http://www.w3.org/2000/svg",t.tag):document.createElement(t.tag);return $(i,t.props,e),t.children&&t.children.forEach((t=>i.appendChild(w(t,e)))),i}function $(t,e,i){const n=t[d]||{};e=function(t,e){e.class=e.class||e.className,delete e.className;const i={};return t&&Object.keys(t).forEach((t=>i[t]=null)),Object.keys(e).forEach((t=>i[t]=e[t])),i}(n,e||{}),t[d]=e;for(const n in e){const s=e[n];if(n.startsWith("data-")){const e=n.substring(5).replace(/-(\w)/g,(t=>t[1].toUpperCase()));t.dataset[e]!==s&&(s||""===s?t.dataset[e]=s:delete t.dataset[e])}else if("style"===n)if(t.style.cssText&&(t.style.cssText=""),"string"==typeof s)t.style.cssText=s;else for(const e in s)t.style[e]!==s[e]&&(t.style[e]=s[e]);else if(n.startsWith("xlink")){const e=n.replace("xlink","").toLowerCase();null==s||!1===s?t.removeAttributeNS("http://www.w3.org/1999/xlink",e):t.setAttributeNS("http://www.w3.org/1999/xlink",e,s)}else n.startsWith("on")?s&&"function"!=typeof s?"string"==typeof s&&(s?t.setAttribute(n,s):t.removeAttribute(n)):t[n]=s:/^id$|^class$|^list$|^readonly$|^contenteditable$|^role|-|^for$/g.test(n)||i?t.getAttribute(n)!==s&&(s?t.setAttribute(n,s):t.removeAttribute(n)):t[n]!==s&&(t[n]=s);"key"===n&&void 0!==s&&(t.key=s)}e&&"function"==typeof e.ref&&window.requestAnimationFrame((()=>e.ref(t)))}function j(t,e,i=0){var n;if("string"==typeof t)return t;if(Array.isArray(t))return t.map((t=>j(t,e,i++)));let s=t;if(t&&"function"==typeof t.tag&&Object.getPrototypeOf(t.tag).i&&(s=function(t,e,i){const{tag:n,props:s,children:o}=t;let r=`_${i}`,c=s&&s.id;c?r=c:c=`_${i}${Date.now()}`;let h="section";s&&s.as&&(h=s.as,delete s.as),e.v||(e.v={});let l=e.v[r];if(l&&l instanceof n&&l.element)l.renderState(l.state);else{const t=document.createElement(h);l=e.v[r]=new n(Object.assign(Object.assign({},s),{children:o})).mount(t,{render:!0})}if(l.mounted){const t=l.mounted(s,o,l.state);void 0!==t&&l.setState(t)}return $(l.element,s,!1),l.element}(t,e,i)),s&&Array.isArray(s.children)){const t=null===(n=s.props)||void 0===n?void 0:n._component;if(t){let e=0;s.children=s.children.map((i=>j(i,t,e++)))}else s.children=s.children.map((t=>j(t,e,i++)))}return s}const A=(t,e={})=>class extends HTMLElement{constructor(){super()}get component(){return this._component}get state(){return this._component.state}static get observedAttributes(){return(e.observedAttributes||[]).map((t=>t.toLowerCase()))}connectedCallback(){if(this.isConnected&&!this._component){const i=e||{};this._shadowRoot=i.shadow?this.attachShadow({mode:"open"}):this;const n=i.observedAttributes||[],s=n.reduce(((t,e)=>{const i=e.toLowerCase();return i!==e&&(t[i]=e),t}),{});this._attrMap=t=>s[t]||t;const o={};Array.from(this.attributes).forEach((t=>o[this._attrMap(t.name)]=t.value)),n.forEach((t=>{void 0!==this[t]&&(o[t]=this[t]),Object.defineProperty(this,t,{get:()=>o[t],set(e){this.attributeChangedCallback(t,o[t],e)},configurable:!0,enumerable:!0})})),requestAnimationFrame((()=>{const e=this.children?Array.from(this.children):[];if(this._component=new t(Object.assign(Object.assign({},o),{children:e})).mount(this._shadowRoot,i),this._component._props=o,this._component.dispatchEvent=this.dispatchEvent.bind(this),this._component.mounted){const t=this._component.mounted(o,e,this._component.state);void 0!==t&&(this._component.state=t)}this.on=this._component.on.bind(this._component),this.run=this._component.run.bind(this._component),!1!==i.render&&this._component.run(".")}))}}disconnectedCallback(){var t,e,i,n;null===(e=null===(t=this._component)||void 0===t?void 0:t.unload)||void 0===e||e.call(t),null===(n=null===(i=this._component)||void 0===i?void 0:i.unmount)||void 0===n||n.call(i),this._component=null}attributeChangedCallback(t,i,n){if(this._component){const s=this._attrMap(t);this._component._props[s]=n,this._component.run("attributeChanged",s,i,n),n!==i&&!1!==e.render&&window.requestAnimationFrame((()=>{this._component.run(".")}))}}};var S=(t,e,i)=>{"undefined"!=typeof customElements&&customElements.define(t,A(e,i))};const O={meta:new WeakMap,defineMetadata(t,e,i){this.meta.has(i)||this.meta.set(i,{}),this.meta.get(i)[t]=e},getMetadataKeys(t){return t=Object.getPrototypeOf(t),this.meta.get(t)?Object.keys(this.meta.get(t)):[]},getMetadata(t,e){return e=Object.getPrototypeOf(e),this.meta.get(e)?this.meta.get(e)[t]:null}};const _=new Map;r.find("get-components")||r.on("get-components",(t=>t.components=_));const x=t=>t;class E{renderState(t,e=null){if(!this.view)return;let i=e||this.view(t);if(r.debug&&r.run("debug",{component:this,_:i?".":"-",state:t,vdom:i,el:this.element}),"object"!=typeof document)return;const n="string"==typeof this.element&&this.element?function(t){try{return document.getElementById(t)}catch(e){return console.warn(`Error getting element by id: ${t}`,e),null}}(this.element)||function(t,e=document){try{return e.querySelector(t)}catch(e){return console.warn(`Invalid selector: ${t}`,e),null}}(this.element):this.element;if(!n)return void console.warn(`Component element not found: ${this.element}`);const s="_c";this.unload?n._component===this&&n.getAttribute(s)===this.tracking_id||(this.tracking_id=(new Date).valueOf().toString(),n.setAttribute(s,this.tracking_id),"undefined"!=typeof MutationObserver&&(this.observer||(this.observer=new MutationObserver((t=>{t[0].oldValue!==this.tracking_id&&document.body.contains(n)||(this.unload(this.state),this.observer.disconnect(),this.observer=null)}))),this.observer.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeOldValue:!0,attributeFilter:[s]}))):n.removeAttribute&&n.removeAttribute(s),n._component=this,!e&&i&&(i=a(i,this),this.options.transition&&document&&document.startViewTransition?document.startViewTransition((()=>r.render(n,i,this))):r.render(n,i,this)),this.rendered&&this.rendered(this.state)}setState(t,e={render:!0,history:!1}){const i=async t=>{try{for(;;){const{value:i,done:n}=await t.next();if(n)break;this.setState(i,e)}}catch(t){console.error("Error in async iterator:",t)}},n=t;if(null==n?void 0:n[Symbol.asyncIterator])this.setState(i(n[Symbol.asyncIterator]()),e);else if((null==n?void 0:n[Symbol.iterator])&&"function"==typeof n.next)for(const t of n)this.setState(t,e);else if(t&&t instanceof Promise)Promise.resolve(t).then((i=>{this.setState(i,e),this._state=t}));else{if(this._state=t,null==t)return;this.state=t,!1!==e.render&&(e.transition&&document&&document.startViewTransition?document.startViewTransition((()=>this.renderState(t))):this.renderState(t)),!1!==e.history&&this.enable_history&&(this._history=[...this._history,t],this._history_idx=this._history.length-1),"function"==typeof e.callback&&e.callback(this.state)}}constructor(t,e,n,s){this.state=t,this.view=e,this.update=n,this.options=s,this._app=new i,this._actions=[],this._global_events=[],this._history=[],this._history_idx=-1,this._history_prev=()=>{this._history_idx--,this._history_idx>=0?this.setState(this._history[this._history_idx],{render:!0,history:!1}):this._history_idx=0},this._history_next=()=>{this._history_idx++,this._history_idx<this._history.length?this.setState(this._history[this._history_idx],{render:!0,history:!1}):this._history_idx=this._history.length-1},this.start=(t=null,e)=>{if(this.mount(t,Object.assign({render:!0},e)),this.mounted&&"function"==typeof this.mounted){const t=this.mounted({},[],this.state);void 0!==t&&this.setState(t)}return this}}mount(t=null,e){var i,n;return console.assert(!this.element,"Component already mounted."),this.options=e=Object.assign(Object.assign({},this.options),e),this.element=t,this.global_event=e.global_event,this.enable_history=!!e.history,this.enable_history&&(this.on(e.history.prev||"history-prev",this._history_prev),this.on(e.history.next||"history-next",this._history_next)),e.route&&(this.update=this.update||{},this.update[e.route]||(this.update[e.route]=x)),this.add_actions(),this.state=null!==(n=null!==(i=this.state)&&void 0!==i?i:this.model)&&void 0!==n?n:{},"function"==typeof this.state&&(this.state=this.state()),this.setState(this.state,{render:!!e.render,history:!0}),r.debug&&(_.get(t)?_.get(t).push(this):_.set(t,[this])),this}is_global_event(t){return t&&(this.global_event||this._global_events.indexOf(t)>=0||t.startsWith("#")||t.startsWith("/")||t.startsWith("@"))}add_action(t,e,i={}){e&&"function"==typeof e?(i.global&&this._global_events.push(t),this.on(t,((...n)=>{r.debug&&r.run("debug",{component:this,_:">",event:t,p:n,current_state:this.state,options:i});try{const s=e(this.state,...n);r.debug&&r.run("debug",{component:this,_:"<",event:t,p:n,newState:s,state:this.state,options:i}),this.setState(s,i)}catch(e){console.error(`Error in component action '${t}':`,e),r.debug&&r.run("debug",{component:this,_:"!",event:t,p:n,error:e,state:this.state,options:i})}}),i)):console.warn(`Component action for '${t}' is not a valid function:`,e)}add_actions(){const t=this.update||{};O.getMetadataKeys(this).forEach((e=>{if(e.startsWith("apprun-update:")){const i=O.getMetadata(e,this);t[i.name]=[this[i.key].bind(this),i.options]}}));const e={};Array.isArray(t)?t.forEach((t=>{const[i,n,s]=t;i.toString().split(",").forEach((t=>e[t.trim()]=[n,s]))})):Object.keys(t).forEach((i=>{const n=t[i];("function"==typeof n||Array.isArray(n))&&i.split(",").forEach((t=>e[t.trim()]=n))})),e["."]||(e["."]=x),Object.keys(e).forEach((t=>{const i=e[t];"function"==typeof i?this.add_action(t,i):Array.isArray(i)&&this.add_action(t,i[0],i[1])}))}run(t,...e){if(this.state instanceof Promise)return Promise.resolve(this.state).then((i=>{this.state=i,this.run(t,...e)}));{const i=t.toString();return this.is_global_event(i)?r.run(i,...e):this._app.run(i,...e)}}on(t,e,i){const n=t.toString();return this._actions.push({name:n,fn:e}),this.is_global_event(n)?r.on(n,e,i):this._app.on(n,e,i)}runAsync(t,...e){const i=t.toString();return this.is_global_event(i)?r.runAsync(i,...e):this._app.runAsync(i,...e)}query(t,...e){return this.runAsync(t,...e)}unmount(){var t;null===(t=this.observer)||void 0===t||t.disconnect(),this._actions.forEach((t=>{const{name:e,fn:i}=t;this.is_global_event(e)?r.off(e,i):this._app.off(e,i)}))}}E.i=!0;const k="//",C="///",M=t=>{if(r.lastUrl!==t)if(r.lastUrl=t,t||(t="#"),t.startsWith("#")){const[e,...i]=t.split("/");r.run(e,...i)||r.run(C,e,...i),r.run(k,e,...i)}else if(t.startsWith("/")){const[e,i,...n]=t.split("/");r.run("/"+i,...n)||r.run(C,"/"+i,...n),r.run(k,"/"+i,...n)}else r.run(t)||r.run(C,t),r.run(k,t)};if(!r.start){r.version=t,r.h=r.createElement=f,r.render=y,r.Fragment=u,r.webComponent=S,r.safeHTML=b,r.start=(t,e,i,n,s)=>{const o=Object.assign({render:!0,global_event:!0},s),r=new E(e,i,n);return s&&s.rendered&&(r.rendered=s.rendered),s&&s.mounted&&(r.mounted=s.mounted),r.start(t,o),r},r.once=r.once||((t,e,i={})=>{r.on(t,e,Object.assign(Object.assign({},i),{once:!0}))}),r.query=r.query||r.runAsync;const e=t=>{};if(r.on("debug",(t=>e)),r.on(k,e),r.on(C,e),r.route=M,r.on("route",(t=>r.route&&r.route(t))),"object"==typeof document&&document.addEventListener("DOMContentLoaded",(()=>{const t=document.body.hasAttribute("apprun-no-init")||r["no-init-route"]||!1,e=r.find("#")||r.find("#/")||!1;window.addEventListener("hashchange",(()=>M(location.hash))),window.addEventListener("popstate",(()=>M(location.pathname))),e?!t&&M(location.hash):(!t&&M(location.pathname),document.body.addEventListener("click",(t=>{const e=t.target;if(!e)return;const i="A"===e.tagName?e:e.closest("a");i&&i.origin===location.origin&&i.pathname&&(t.preventDefault(),history.pushState(null,"",i.pathname),M(i.pathname))})))})),"object"==typeof window){const t=window;t.Component=E,t._React=t.React,t.React=r,t.on=function(t,e={}){return function(i,n){const s=t?t.toString():n;O.defineMetadata(`apprun-update:${s}`,{name:s,key:n,options:e},i)}},t.customElement=function(t,e){return function(i){return S(t,i,e),i}},t.safeHTML=b}r.use_render=(t,e=0)=>{r.render=0===e?(e,i)=>t(i,e):(e,i)=>t(e,i)},r.use_react=(t,e)=>{if(t&&e)if("function"==typeof t.createElement)if(t.Fragment)if(r.h=r.createElement=t.createElement,r.Fragment=t.Fragment,t.version&&t.version.startsWith("18")){if(!e.createRoot||"function"!=typeof e.createRoot)return void console.error("AppRun use_react: ReactDOM.createRoot not found in React 18+");r.render=(t,i)=>{t&&void 0!==i&&(t._root||(t._root=e.createRoot(t)),t._root.render(i))}}else{if(!e.render||"function"!=typeof e.render)return void console.error("AppRun use_react: ReactDOM.render not found in legacy React");r.render=(t,i)=>e.render(i,t)}else console.error("AppRun use_react: Invalid React object - Fragment not found");else console.error("AppRun use_react: Invalid React object - createElement method not found");else console.error("AppRun use_react: React and ReactDOM parameters are required")}}
|
|
1
|
+
const n="3.36.1",t=`AppRun-${n}`;class e{constructor(){this._events={}}on(n,t,e={}){this._events[n]=this._events[n]||[],this._events[n].push({fn:t,options:e})}off(n,t){const e=this._events[n]||[];this._events[n]=e.filter((n=>n.fn!==t))}find(n){return this._events[n]}run(n,...t){const e=this.getSubscribers(n,this._events);return console.assert(e&&e.length>0,"No subscriber for event: "+n),e.forEach((e=>{const{fn:l,options:o}=e;if(!l||"function"!=typeof l)return console.error(`AppRun event handler for '${n}' is not a function:`,l),!1;if(o.delay)this.delay(n,l,t,o);else try{Object.keys(o).length>0?l.apply(this,[...t,o]):l.apply(this,t)}catch(t){console.error(`Error in event handler for '${n}':`,t)}return!e.options.once})),e.length}once(n,t,e={}){this.on(n,t,Object.assign(Object.assign({},e),{once:!0}))}delay(n,t,e,l){l._t&&clearTimeout(l._t),l._t=setTimeout((()=>{clearTimeout(l._t);try{Object.keys(l).length>0?t.apply(this,[...e,l]):t.apply(this,e)}catch(t){console.error(`Error in delayed event handler for '${n}':`,t)}}),l.delay)}runAsync(n,...t){const e=this.getSubscribers(n,this._events);console.assert(e&&e.length>0,"No subscriber for event: "+n);const l=e.map((e=>{const{fn:l,options:o}=e;if(!l||"function"!=typeof l)return console.error(`AppRun async event handler for '${n}' is not a function:`,l),Promise.resolve(null);try{return Object.keys(o).length>0?l.apply(this,[...t,o]):l.apply(this,t)}catch(t){return console.error(`Error in async event handler for '${n}':`,t),Promise.reject(t)}}));return Promise.all(l)}query(n,...t){return console.warn("app.query() is deprecated. Use app.runAsync() instead."),this.runAsync(n,...t)}getSubscribers(n,t){const e=t[n]||[];return t[n]=e.filter((n=>!n.options.once)),Object.keys(t).filter((t=>t.endsWith("*")&&n.startsWith(t.replace("*","")))).sort(((n,t)=>t.length-n.length)).forEach((l=>e.push(...t[l].map((t=>Object.assign(Object.assign({},t),{options:Object.assign(Object.assign({},t.options),{event:n})})))))),e}}const l=t;let o;const i="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};i.app&&i._AppRunVersions?o=i.app:(o=new e,i.app=o,i._AppRunVersions=l);var s=o;function r(n){return(null==n?void 0:n.target)instanceof HTMLElement?n.target:null}const a=(n,t)=>(t?n.state[t]:n.state)||"",u=(n,t,e)=>{if(t){const l=n.state||{};l[t]=e,n.setState(l)}else n.setState(e)},c=(n,t)=>{if(Array.isArray(n))return n.map((n=>c(n,t)));{let{type:e,tag:l,props:o,children:i}=n;return l=l||e,i=i||(null==o?void 0:o.children),o&&Object.keys(o).forEach((n=>{n.startsWith("$")&&(((n,t,e,l)=>{if(n.startsWith("$on")){const e=t[n];if(n=n.substring(1),"boolean"==typeof e)t[n]=t=>l.run?l.run(n,t):s.run(n,t);else if("string"==typeof e)t[n]=n=>l.run?l.run(e,n):s.run(e,n);else if("function"==typeof e)t[n]=n=>l.setState(e(l.state,n));else if(Array.isArray(e)){const[o,...i]=e;"string"==typeof o?t[n]=n=>l.run?l.run(o,...i,n):s.run(o,...i,n):"function"==typeof o&&(t[n]=n=>l.setState(o(l.state,...i,n)))}}else if("$bind"===n){const o=t.type||"text",i="string"==typeof t[n]?t[n]:t.name;if("input"===e)switch(o){case"checkbox":t.checked=a(l,i),t.onclick=n=>{const t=r(n);t&&u(l,i||t.name,t.checked)};break;case"radio":t.checked=a(l,i)===t.value,t.onclick=n=>{const t=r(n);t&&u(l,i||t.name,t.value)};break;case"number":case"range":t.value=a(l,i),t.oninput=n=>{const t=r(n);t&&u(l,i||t.name,Number(t.value))};break;default:t.value=a(l,i),t.oninput=n=>{const t=r(n);t&&u(l,i||t.name,t.value)}}else"select"===e?(t.value=a(l,i),t.onchange=n=>{const t=r(n);t&&!t.multiple&&u(l,i||t.name,t.value)}):"option"===e?(t.selected=a(l,i),t.onclick=n=>{const t=r(n);t&&u(l,i||t.name,t.selected)}):"textarea"===e&&(t.innerHTML=a(l,i),t.oninput=n=>{const t=r(n);t&&u(l,i||t.name,t.value)})}else s.run("$",{key:n,tag:e,props:t,component:l})})(n,o,l,t),delete o[n])})),i&&c(i,t),n}};class h{constructor(n,t,e){this.normal=t,this.property=n,e&&(this.space=e)}}function d(n,t){const e={},l={};for(const t of n)Object.assign(e,t.property),Object.assign(l,t.normal);return new h(e,l,t)}function p(n){return n.toLowerCase()}h.prototype.normal={},h.prototype.property={},h.prototype.space=void 0;class f{constructor(n,t){this.attribute=t,this.property=n}}f.prototype.attribute="",f.prototype.booleanish=!1,f.prototype.boolean=!1,f.prototype.commaOrSpaceSeparated=!1,f.prototype.commaSeparated=!1,f.prototype.defined=!1,f.prototype.mustUseProperty=!1,f.prototype.number=!1,f.prototype.overloadedBoolean=!1,f.prototype.property="",f.prototype.spaceSeparated=!1,f.prototype.space=void 0;let g=0;const m=x(),v=x(),y=x(),b=x(),w=x(),k=x(),S=x();function x(){return 2**++g}var C=Object.freeze({__proto__:null,boolean:m,booleanish:v,commaOrSpaceSeparated:S,commaSeparated:k,number:b,overloadedBoolean:y,spaceSeparated:w});const O=Object.keys(C);class P extends f{constructor(n,t,e,l){let o=-1;if(super(n,t),M(this,"space",l),"number"==typeof e)for(;++o<O.length;){const n=O[o];M(this,O[o],(e&C[n])===C[n])}}}function M(n,t,e){e&&(n[t]=e)}function A(n){const t={},e={};for(const[l,o]of Object.entries(n.properties)){const i=new P(l,n.transform(n.attributes||{},l),o,n.space);n.mustUseProperty&&n.mustUseProperty.includes(l)&&(i.mustUseProperty=!0),t[l]=i,e[p(l)]=l,e[p(i.attribute)]=l}return new h(t,e,n.space)}P.prototype.defined=!0;const E=A({properties:{ariaActiveDescendant:null,ariaAtomic:v,ariaAutoComplete:null,ariaBusy:v,ariaChecked:v,ariaColCount:b,ariaColIndex:b,ariaColSpan:b,ariaControls:w,ariaCurrent:null,ariaDescribedBy:w,ariaDetails:null,ariaDisabled:v,ariaDropEffect:w,ariaErrorMessage:null,ariaExpanded:v,ariaFlowTo:w,ariaGrabbed:v,ariaHasPopup:null,ariaHidden:v,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:w,ariaLevel:b,ariaLive:null,ariaModal:v,ariaMultiLine:v,ariaMultiSelectable:v,ariaOrientation:null,ariaOwns:w,ariaPlaceholder:null,ariaPosInSet:b,ariaPressed:v,ariaReadOnly:v,ariaRelevant:null,ariaRequired:v,ariaRoleDescription:w,ariaRowCount:b,ariaRowIndex:b,ariaRowSpan:b,ariaSelected:v,ariaSetSize:b,ariaSort:null,ariaValueMax:b,ariaValueMin:b,ariaValueNow:b,ariaValueText:null,role:null},transform:(n,t)=>"role"===t?t:"aria-"+t.slice(4).toLowerCase()});function R(n,t){return t in n?n[t]:t}function D(n,t){return R(n,t.toLowerCase())}const $=A({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:k,acceptCharset:w,accessKey:w,action:null,allow:null,allowFullScreen:m,allowPaymentRequest:m,allowUserMedia:m,alt:null,as:null,async:m,autoCapitalize:null,autoComplete:w,autoFocus:m,autoPlay:m,blocking:w,capture:null,charSet:null,checked:m,cite:null,className:w,cols:b,colSpan:null,content:null,contentEditable:v,controls:m,controlsList:w,coords:b|k,crossOrigin:null,data:null,dateTime:null,decoding:null,default:m,defer:m,dir:null,dirName:null,disabled:m,download:y,draggable:v,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:m,formTarget:null,headers:w,height:b,hidden:y,high:b,href:null,hrefLang:null,htmlFor:w,httpEquiv:w,id:null,imageSizes:null,imageSrcSet:null,inert:m,inputMode:null,integrity:null,is:null,isMap:m,itemId:null,itemProp:w,itemRef:w,itemScope:m,itemType:w,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:m,low:b,manifest:null,max:null,maxLength:b,media:null,method:null,min:null,minLength:b,multiple:m,muted:m,name:null,nonce:null,noModule:m,noValidate:m,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:m,optimum:b,pattern:null,ping:w,placeholder:null,playsInline:m,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:m,referrerPolicy:null,rel:w,required:m,reversed:m,rows:b,rowSpan:b,sandbox:w,scope:null,scoped:m,seamless:m,selected:m,shadowRootClonable:m,shadowRootDelegatesFocus:m,shadowRootMode:null,shape:null,size:b,sizes:null,slot:null,span:b,spellCheck:v,src:null,srcDoc:null,srcLang:null,srcSet:null,start:b,step:null,style:null,tabIndex:b,target:null,title:null,translate:null,type:null,typeMustMatch:m,useMap:null,value:v,width:b,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:w,axis:null,background:null,bgColor:null,border:b,borderColor:null,bottomMargin:b,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:m,declare:m,event:null,face:null,frame:null,frameBorder:null,hSpace:b,leftMargin:b,link:null,longDesc:null,lowSrc:null,marginHeight:b,marginWidth:b,noResize:m,noHref:m,noShade:m,noWrap:m,object:null,profile:null,prompt:null,rev:null,rightMargin:b,rules:null,scheme:null,scrolling:v,standby:null,summary:null,text:null,topMargin:b,valueType:null,version:null,vAlign:null,vLink:null,vSpace:b,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:m,disableRemotePlayback:m,prefix:null,property:null,results:b,security:null,unselectable:null},space:"html",transform:D}),T=A({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:S,accentHeight:b,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:b,amplitude:b,arabicForm:null,ascent:b,attributeName:null,attributeType:null,azimuth:b,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:b,by:null,calcMode:null,capHeight:b,className:w,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:b,diffuseConstant:b,direction:null,display:null,dur:null,divisor:b,dominantBaseline:null,download:m,dx:null,dy:null,edgeMode:null,editable:null,elevation:b,enableBackground:null,end:null,event:null,exponent:b,externalResourcesRequired:null,fill:null,fillOpacity:b,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:k,g2:k,glyphName:k,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:b,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:b,horizOriginX:b,horizOriginY:b,id:null,ideographic:b,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:b,k:b,k1:b,k2:b,k3:b,k4:b,kernelMatrix:S,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:b,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:b,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:b,overlineThickness:b,paintOrder:null,panose1:null,path:null,pathLength:b,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:w,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:b,pointsAtY:b,pointsAtZ:b,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:S,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:S,rev:S,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:S,requiredFeatures:S,requiredFonts:S,requiredFormats:S,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:b,specularExponent:b,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:b,strikethroughThickness:b,string:null,stroke:null,strokeDashArray:S,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:b,strokeOpacity:b,strokeWidth:null,style:null,surfaceScale:b,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:S,tabIndex:b,tableValues:null,target:null,targetX:b,targetY:b,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:S,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:b,underlineThickness:b,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:b,values:null,vAlphabetic:b,vMathematical:b,vectorEffect:null,vHanging:b,vIdeographic:b,version:null,vertAdvY:b,vertOriginX:b,vertOriginY:b,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:b,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:R}),j=A({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform:(n,t)=>"xlink:"+t.slice(5).toLowerCase()}),L=A({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:D}),_=A({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform:(n,t)=>"xml:"+t.slice(3).toLowerCase()}),U=/[A-Z]/g,z=/-[a-z]/g,B=/^data[-\w.:]+$/i;function I(n){return"-"+n.toLowerCase()}function H(n){return n.charAt(1).toUpperCase()}const N=d([E,$,j,L,_],"html"),F=d([E,T,j,L,_],"svg"),q="_props",V=new Map;function W(n,t){const e=`${n}:${t}`;let l=V.get(e);return void 0===l&&(l=function(n,t){const e=p(t);let l=t,o=f;if(e in n.normal)return n.property[n.normal[e]];if(e.length>4&&"data"===e.slice(0,4)&&B.test(t)){if("-"===t.charAt(4)){const n=t.slice(5).replace(z,H);l="data"+n.charAt(0).toUpperCase()+n.slice(1)}else{const n=t.slice(4);if(!z.test(n)){let e=n.replace(U,I);"-"!==e.charAt(0)&&(e="-"+e),t="data"+e}}o=P}return new o(l,t)}(t?F:N,n)||null,V.set(e,l)),l}function K(n,t,e){!function(n){if(null==n||!1===n||""===n)return!1;if(!0===n)return!0;if("string"==typeof n){return"false"!==n.toLowerCase()&&"0"!==n}return Boolean(n)}(e)?n.removeAttribute(t):n.setAttribute(t,t)}function X(n,t,e){try{n[t]=e}catch(l){Y(n,t,e,!1)}}function Y(n,t,e,l){if(null==e)return void n.removeAttribute(t);const o=String(e);if(l&&t.includes(":")){const[e]=t.split(":");"xlink"===e?n.setAttributeNS("http://www.w3.org/1999/xlink",t,o):n.setAttribute(t,o)}else n.setAttribute(t,o)}function Z(n,t,e,l){if(function(n,t){if(document.activeElement===n)return["value","selectionStart","selectionEnd","selectionDirection"].includes(t);if("scrollTop"===t||"scrollLeft"===t)return!0;if(n instanceof HTMLMediaElement&&["currentTime","paused","playbackRate","volume"].includes(t))return!0;return!1}(n,t))return;if("style"===t){if(n.style.cssText&&(n.style.cssText=""),"string"==typeof e)n.style.cssText=e;else if(e&&"object"==typeof e)for(const t in e)n.style[t]!==e[t]&&(n.style[t]=e[t]);return}if("key"===t)return void(null!=e&&(n.key=e));if(t.startsWith("data-"))return void function(n,t,e){const l=(o=t.slice(5)).length<=1?o.toLowerCase():o.split("-").map(((n,t)=>0===t?n.toLowerCase():n.charAt(0).toUpperCase()+n.slice(1).toLowerCase())).join("");var o;null==e?delete n.dataset[l]:n.dataset[l]=String(e)}(n,t,e);if(t.startsWith("on"))return void function(n,t,e){t.startsWith("on")&&(e&&"function"!=typeof e?"string"==typeof e&&(e?n.setAttribute(t,e):n.removeAttribute(t)):n[t]=e)}(n,t,e);if(!("INPUT"!==n.tagName&&"TEXTAREA"!==n.tagName&&"SELECT"!==n.tagName||"value"!==t&&"selected"!==t&&"selectedIndex"!==t))return void X(n,t,e);if("INPUT"===n.tagName&&"checked"===t)return X(n,t,e),void K(n,t,e);const o=W(t,l);o?o.boolean||o.overloadedBoolean?K(n,o.attribute,e):o.mustUseProperty&&!l?X(n,o.property,e):Y(n,o.attribute,e,l):t.startsWith("aria-")||"role"===t?Y(n,t,e,l):t in n||void 0!==n[t]?X(n,t,e):Y(n,t,e,l)}function J(n){return/^[a-zA-Z_:][\w\-:.]*$/.test(n)&&!n.includes("<")&&!n.includes(">")&&!n.includes('"')&&!n.includes("'")}function G(n,t,e){const l=function(n,t){if(t&&(t.class=t.class||t.className,delete t.className),!n||0===Object.keys(n).length)return t||{};if(!t||0===Object.keys(t).length){const t={};return Object.keys(n).forEach((n=>t[n]=null)),t}const e={};return Object.keys(n).forEach((n=>{n in t||(e[n]=null)})),Object.keys(t).forEach((n=>e[n]=t[n])),e}(n[q]||{},t);n[q]=t||{},function(n,t,e,l){for(const e in t)J(e)&&Z(n,e,t[e],l);t&&"function"==typeof t.ref&&window.requestAnimationFrame((()=>t.ref(n)))}(n,l,0,e)}function Q(n,...t){return nn(t)}function nn(n){const t=[],e=n=>{null!=n&&""!==n&&!1!==n&&t.push("function"==typeof n||"object"==typeof n?n:`${n}`)};return n&&n.forEach((n=>{Array.isArray(n)?n.forEach((n=>e(n))):e(n)})),t}const tn={};let en=0;function ln(n,t,...e){const l=nn(e);if("string"==typeof n)return{tag:n,props:t,children:l};if(Array.isArray(n))return n;if(void 0===n&&e)return l;if(Object.getPrototypeOf(n).i)return{tag:n,props:t,children:l};if("function"==typeof n)return n(t,l);throw new Error(`Unknown tag in vdom ${n}`)}const on=(n,t,e={})=>{if(null==t||!1===t)return;!function(n,t,e={}){if(null==t||!1===t)return;if(t=hn(t,e),!n)return;const l="SVG"===n.nodeName;Array.isArray(t)?rn(n,t,l):rn(n,[t],l)}("string"==typeof n&&n?document.getElementById(n)||document.querySelector(n):n,t=c(t,e),e)};function sn(n,t,e){e=e||"svg"===t.tag,function(n,t){const e=n.nodeName,l=`${t.tag||""}`;return e.toUpperCase()===l.toUpperCase()}(n,t)?(rn(n,t.children,e),G(n,t.props,e)):n.parentNode.replaceChild(cn(t,e),n)}function rn(n,t,e){var l,o;const i=(null===(l=n.childNodes)||void 0===l?void 0:l.length)||0,s=(null==t?void 0:t.length)||0,r=Math.min(i,s);for(let l=0;l<r;l++){const o=t[l],i=n.childNodes[l];if("string"==typeof o)i.textContent!==o&&(3===i.nodeType?i.nodeValue=o:n.replaceChild(un(o),i));else if(o instanceof HTMLElement||o instanceof SVGElement)n.insertBefore(o,i);else{const t=o.props&&o.props.key;if(t)if(i.key===t)sn(n.childNodes[l],o,e);else{const s=tn[t];s?(n.insertBefore(s,i),sn(n.childNodes[l],o,e)):n.replaceChild(cn(o,e),i)}else sn(n.childNodes[l],o,e)}}let a=(null===(o=n.childNodes)||void 0===o?void 0:o.length)||0;for(;a>r;)n.removeChild(n.lastChild),a--;if(s>r){const l=document.createDocumentFragment();for(let n=r;n<t.length;n++)l.appendChild(cn(t[n],e));n.appendChild(l)}}const an=n=>{const t=document.createElement("section");return t.insertAdjacentHTML("afterbegin",n),Array.from(t.children)};function un(n){if(0===(null==n?void 0:n.indexOf("_html:"))){const t=document.createElement("div");return t.insertAdjacentHTML("afterbegin",n.substring(6)),t}return document.createTextNode(null!=n?n:"")}function cn(n,t){if(n instanceof HTMLElement||n instanceof SVGElement)return n;if("string"==typeof n)return un(n);if(!n.tag||"function"==typeof n.tag)return un(JSON.stringify(n));const e=(t=t||"svg"===n.tag)?document.createElementNS("http://www.w3.org/2000/svg",n.tag):document.createElement(n.tag);return G(e,n.props,t),n.children&&n.children.forEach((n=>e.appendChild(cn(n,t)))),n.props&&void 0!==n.props.key&&(e.key=n.props.key,tn[n.props.key]=e,++en>=500&&(!function(){if(!(Object.keys(tn).length<=1e3))for(const[n,t]of Object.entries(tn))t.isConnected||delete tn[n]}(),en=0)),e}function hn(n,t,e=0){var l;if("string"==typeof n)return n;if(Array.isArray(n))return n.map((n=>hn(n,t,e++)));let o=n;if(n&&"function"==typeof n.tag&&Object.getPrototypeOf(n.tag).i&&(o=function(n,t,e){const{tag:l,props:o,children:i}=n;let s=`_${e}`,r=o&&o.id;r?s=r:r=`_${e}${Date.now()}`;let a="section";o&&o.as&&(a=o.as,delete o.as),t.m||(t.m={});let u=t.m[s];if(u&&u instanceof l&&u.element)u.renderState(u.state);else{const n=document.createElement(a);u=t.m[s]=new l(Object.assign(Object.assign({},o),{children:i})).mount(n,{render:!0})}if(u.mounted){const n=u.mounted(o,i,u.state);void 0!==n&&u.setState(n)}return G(u.element,o,!1),u.element}(n,t,e)),o&&Array.isArray(o.children)){const n=null===(l=o.props)||void 0===l?void 0:l._component;if(n){let t=0;o.children=o.children.map((e=>hn(e,n,t++)))}else o.children=o.children.map((n=>hn(n,t,e++)))}return o}const dn=(n,t={})=>class extends HTMLElement{constructor(){super()}get component(){return this._component}get state(){return this._component.state}static get observedAttributes(){return(t.observedAttributes||[]).map((n=>n.toLowerCase()))}connectedCallback(){if(this.isConnected&&!this._component){const e=t||{};this._shadowRoot=e.shadow?this.attachShadow({mode:"open"}):this;const l=e.observedAttributes||[],o=l.reduce(((n,t)=>{const e=t.toLowerCase();return e!==t&&(n[e]=t),n}),{});this._attrMap=n=>o[n]||n;const i={};Array.from(this.attributes).forEach((n=>i[this._attrMap(n.name)]=n.value)),l.forEach((n=>{void 0!==this[n]&&(i[n]=this[n]),Object.defineProperty(this,n,{get:()=>i[n],set(t){this.attributeChangedCallback(n,i[n],t)},configurable:!0,enumerable:!0})})),requestAnimationFrame((()=>{const t=this.children?Array.from(this.children):[];if(this._component=new n(Object.assign(Object.assign({},i),{children:t})).mount(this._shadowRoot,e),this._component._props=i,this._component.dispatchEvent=this.dispatchEvent.bind(this),this._component.mounted){const n=this._component.mounted(i,t,this._component.state);void 0!==n&&(this._component.state=n)}this.on=this._component.on.bind(this._component),this.run=this._component.run.bind(this._component),!1!==e.render&&this._component.run(".")}))}}disconnectedCallback(){var n,t,e,l;null===(t=null===(n=this._component)||void 0===n?void 0:n.unload)||void 0===t||t.call(n),null===(l=null===(e=this._component)||void 0===e?void 0:e.unmount)||void 0===l||l.call(e),this._component=null}attributeChangedCallback(n,e,l){if(this._component){const o=this._attrMap(n);this._component._props[o]=l,this._component.run("attributeChanged",o,e,l),l!==e&&!1!==t.render&&window.requestAnimationFrame((()=>{this._component.run(".")}))}}};var pn=(n,t,e)=>{"undefined"!=typeof customElements&&customElements.define(n,dn(t,e))};const fn={meta:new WeakMap,defineMetadata(n,t,e){this.meta.has(e)||this.meta.set(e,{}),this.meta.get(e)[n]=t},getMetadataKeys(n){return n=Object.getPrototypeOf(n),this.meta.get(n)?Object.keys(this.meta.get(n)):[]},getMetadata(n,t){return t=Object.getPrototypeOf(t),this.meta.get(t)?this.meta.get(t)[n]:null}};const gn=new Map;s.find("get-components")||s.on("get-components",(n=>n.components=gn));const mn=n=>n;class vn{renderState(n,t=null){if(!this.view)return;let e=t||this.view(n);if(s.debug&&s.run("debug",{component:this,_:e?".":"-",state:n,vdom:e,el:this.element}),"object"!=typeof document)return;const l="string"==typeof this.element&&this.element?function(n){try{return document.getElementById(n)}catch(t){return console.warn(`Error getting element by id: ${n}`,t),null}}(this.element)||function(n,t=document){try{return t.querySelector(n)}catch(t){return console.warn(`Invalid selector: ${n}`,t),null}}(this.element):this.element;if(!l)return void console.warn(`Component element not found: ${this.element}`);const o="_c";this.unload?l._component===this&&l.getAttribute(o)===this.tracking_id||(this.tracking_id=(new Date).valueOf().toString(),l.setAttribute(o,this.tracking_id),"undefined"!=typeof MutationObserver&&(this.observer||(this.observer=new MutationObserver((n=>{n[0].oldValue!==this.tracking_id&&document.body.contains(l)||(this.unload(this.state),this.observer.disconnect(),this.observer=null)}))),this.observer.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeOldValue:!0,attributeFilter:[o]}))):l.removeAttribute&&l.removeAttribute(o),l._component=this,!t&&e&&(e=c(e,this),this.options.transition&&document&&document.startViewTransition?document.startViewTransition((()=>s.render(l,e,this))):s.render(l,e,this)),this.rendered&&this.rendered(this.state)}setState(n,t={render:!0,history:!1}){const e=async n=>{try{for(;;){const{value:e,done:l}=await n.next();if(l)break;this.setState(e,t)}}catch(n){console.error("Error in async iterator:",n)}},l=n;if(null==l?void 0:l[Symbol.asyncIterator])this.setState(e(l[Symbol.asyncIterator]()),t);else if((null==l?void 0:l[Symbol.iterator])&&"function"==typeof l.next)for(const n of l)this.setState(n,t);else if(n&&n instanceof Promise)Promise.resolve(n).then((e=>{this.setState(e,t),this._state=n}));else{if(this._state=n,null==n)return;this.state=n,!1!==t.render&&(t.transition&&document&&document.startViewTransition?document.startViewTransition((()=>this.renderState(n))):this.renderState(n)),!1!==t.history&&this.enable_history&&(this._history=[...this._history,n],this._history_idx=this._history.length-1),"function"==typeof t.callback&&t.callback(this.state)}}constructor(n,t,l,o){this.state=n,this.view=t,this.update=l,this.options=o,this._app=new e,this._actions=[],this._global_events=[],this._history=[],this._history_idx=-1,this._history_prev=()=>{this._history_idx--,this._history_idx>=0?this.setState(this._history[this._history_idx],{render:!0,history:!1}):this._history_idx=0},this._history_next=()=>{this._history_idx++,this._history_idx<this._history.length?this.setState(this._history[this._history_idx],{render:!0,history:!1}):this._history_idx=this._history.length-1},this.start=(n=null,t)=>{if(this.mount(n,Object.assign({render:!0},t)),this.mounted&&"function"==typeof this.mounted){const n=this.mounted({},[],this.state);void 0!==n&&this.setState(n)}return this}}mount(n=null,t){var e,l;return console.assert(!this.element,"Component already mounted."),this.options=t=Object.assign(Object.assign({},this.options),t),this.element=n,this.global_event=t.global_event,this.enable_history=!!t.history,this.enable_history&&(this.on(t.history.prev||"history-prev",this._history_prev),this.on(t.history.next||"history-next",this._history_next)),t.route&&(this.update=this.update||{},this.update[t.route]||(this.update[t.route]=mn)),this.add_actions(),this.state=null!==(l=null!==(e=this.state)&&void 0!==e?e:this.model)&&void 0!==l?l:{},"function"==typeof this.state&&(this.state=this.state()),this.setState(this.state,{render:!!t.render,history:!0}),s.debug&&(gn.get(n)?gn.get(n).push(this):gn.set(n,[this])),this}is_global_event(n){return n&&(this.global_event||this._global_events.indexOf(n)>=0||n.startsWith("#")||n.startsWith("/")||n.startsWith("@"))}add_action(n,t,e={}){t&&"function"==typeof t?(e.global&&this._global_events.push(n),this.on(n,((...l)=>{s.debug&&s.run("debug",{component:this,_:">",event:n,p:l,current_state:this.state,options:e});try{const o=t(this.state,...l);s.debug&&s.run("debug",{component:this,_:"<",event:n,p:l,newState:o,state:this.state,options:e}),this.setState(o,e)}catch(t){console.error(`Error in component action '${n}':`,t),s.debug&&s.run("debug",{component:this,_:"!",event:n,p:l,error:t,state:this.state,options:e})}}),e)):console.warn(`Component action for '${n}' is not a valid function:`,t)}add_actions(){const n=this.update||{};fn.getMetadataKeys(this).forEach((t=>{if(t.startsWith("apprun-update:")){const e=fn.getMetadata(t,this);n[e.name]=[this[e.key].bind(this),e.options]}}));const t={};Array.isArray(n)?n.forEach((n=>{const[e,l,o]=n;e.toString().split(",").forEach((n=>t[n.trim()]=[l,o]))})):Object.keys(n).forEach((e=>{const l=n[e];("function"==typeof l||Array.isArray(l))&&e.split(",").forEach((n=>t[n.trim()]=l))})),t["."]||(t["."]=mn),Object.keys(t).forEach((n=>{const e=t[n];"function"==typeof e?this.add_action(n,e):Array.isArray(e)&&this.add_action(n,e[0],e[1])}))}run(n,...t){if(this.state instanceof Promise)return Promise.resolve(this.state).then((e=>{this.state=e,this.run(n,...t)}));{const e=n.toString();return this.is_global_event(e)?s.run(e,...t):this._app.run(e,...t)}}on(n,t,e){const l=n.toString();return this._actions.push({name:l,fn:t}),this.is_global_event(l)?s.on(l,t,e):this._app.on(l,t,e)}runAsync(n,...t){const e=n.toString();return this.is_global_event(e)?s.runAsync(e,...t):this._app.runAsync(e,...t)}query(n,...t){return console.warn("component.query() is deprecated. Use component.runAsync() instead."),this.runAsync(n,...t)}unmount(){var n;null===(n=this.observer)||void 0===n||n.disconnect(),this._actions.forEach((n=>{const{name:t,fn:e}=n;this.is_global_event(t)?s.off(t,e):this._app.off(t,e)}))}}function yn(){const n=s.find("#");if(n&&n.length>0)return s.run("#"),void s.run(kn,"#");const t=s.find("/");if(t&&t.length>0)return s.run("/"),void s.run(kn,"/");const e=s.find("#/");if(e&&e.length>0)return s.run("#/"),void s.run(kn,"#/");console.warn("No subscribers for event: "),s.run(Sn,""),s.run(kn,"")}function bn(n){if(!n)return void yn();n=function(n){return n&&"/"!==n&&"#"!==n&&"#/"!==n&&n.endsWith("/")?n.slice(0,-1):n}(n);const t=s.basePath;t&&(n=function(n,t){if(!t||"/"===t||""===t)return n;const e=t.startsWith("/")?t:"/"+t;if(n.startsWith(e)){const t=n.substring(e.length);return t.startsWith("/")?t:"/"+t}return n}(n,t));const e=function(n){return n?n.startsWith("#/")?n.substring(2).split("/"):n.startsWith("#")||n.startsWith("/")?n.substring(1).split("/"):n.split("/"):[]}(n);let l;!function(n){const t=n.filter(Boolean);t.length>11&&console.warn(`Deep route hierarchy detected: ${t.join("/")} (${t.length} levels)`)}(e),l=n.startsWith("#/")?"hash-slash":n.startsWith("#")?"hash":n.startsWith("/")?"path":"non-prefixed";const o=function(n,t){const e=[];for(let l=n.length;l>0;l--){const o=n.slice(0,l);let i="";switch(t){case"path":i="/"+o.join("/");break;case"hash":i="#"+o.join("/");break;case"hash-slash":i="#/"+o.join("/");break;case"non-prefixed":i=o.join("/")}e.push(i)}return e}(e,l),i=function(n,t){for(let e=0;e<n.length;e++){const l=n[e],o=s.find(l);if(o&&o.length>0){const o=n.length-e;return{eventName:l,parameters:t.slice(o)}}}return null}(o,e);if(i)wn(i.eventName,...i.parameters);else if(o.length>0){const t=o[o.length-1];console.warn(`No subscribers for event: ${t}`),s.run(Sn,n),s.run(kn,n)}else yn()}vn.i=!0;const wn=(n,...t)=>{if(!n||n===kn||n===Sn)return;const e=s.find(n);e&&0!==e.length?s.run(n,...t):(console.warn(`No subscribers for event: ${n}`),s.run(Sn,n,...t)),s.run(kn,n,...t)},kn="//",Sn="///",xn=n=>{s.lastUrl!==n&&(s.lastUrl=n,bn(n))};if(!s.start){s.version=n,s.h=s.createElement=ln,s.render=on,s.Fragment=Q,s.webComponent=pn,s.safeHTML=an,s.start=(n,t,e,l,o)=>{const i=Object.assign({render:!0,global_event:!0},o),s=new vn(t,e,l);return o&&o.rendered&&(s.rendered=o.rendered),o&&o.mounted&&(s.mounted=o.mounted),s.start(n,i),s},s.once=s.once||((n,t,e={})=>{s.on(n,t,Object.assign(Object.assign({},e),{once:!0}))}),s.query=s.query||s.runAsync;const t=n=>{};if(s.on("/",t),s.on("debug",(n=>t)),s.on(kn,t),s.on(Sn,t),s.route=xn,s.on("route",(n=>s.route&&s.route(n))),"object"==typeof document&&document.addEventListener("DOMContentLoaded",(()=>{const n=document.body.hasAttribute("apprun-no-init")||s["no-init-route"]||!1,t=s.find("#")||s.find("#/")||!1;window.addEventListener("hashchange",(()=>xn(location.hash))),window.addEventListener("popstate",(()=>xn(location.pathname))),t?!n&&xn(location.hash):(!n&&(()=>{const n=s.basePath||"";let t=location.pathname;n&&t.startsWith(n)&&(t=t.substring(n.length),t.startsWith("/")||(t="/"+t)),xn(t)})(),document.body.addEventListener("click",(n=>{const t=n.target;if(!t)return;const e="A"===t.tagName?t:t.closest("a");if(e&&e.origin===location.origin&&e.pathname){n.preventDefault();const t=(s.basePath||"")+e.pathname;history.pushState(null,"",t),xn(e.pathname)}})))})),"object"==typeof window){const n=window;n.Component=vn,n._React=n.React,n.React=s,n.on=function(n,t={}){return function(e,l){const o=n?n.toString():l;fn.defineMetadata(`apprun-update:${o}`,{name:o,key:l,options:t},e)}},n.customElement=function(n,t){return function(e){return pn(n,e,t),e}},n.safeHTML=an}s.use_render=(n,t=0)=>{s.render=0===t?(t,e)=>n(e,t):(t,e)=>n(t,e)},s.use_react=(n,t)=>{if(n&&t)if("function"==typeof n.createElement)if(n.Fragment)if(s.h=s.createElement=n.createElement,s.Fragment=n.Fragment,n.version&&n.version.startsWith("18")){if(!t.createRoot||"function"!=typeof t.createRoot)return void console.error("AppRun use_react: ReactDOM.createRoot not found in React 18+");s.render=(n,e)=>{n&&void 0!==e&&(n._root||(n._root=t.createRoot(n)),n._root.render(e))}}else{if(!t.render||"function"!=typeof t.render)return void console.error("AppRun use_react: ReactDOM.render not found in legacy React");s.render=(n,e)=>t.render(e,n)}else console.error("AppRun use_react: Invalid React object - Fragment not found");else console.error("AppRun use_react: Invalid React object - createElement method not found");else console.error("AppRun use_react: React and ReactDOM parameters are required")}}
|
|
2
2
|
/**
|
|
3
3
|
* @license
|
|
4
4
|
* Copyright 2019 Google LLC
|
|
5
5
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
6
|
-
*/const
|
|
6
|
+
*/const Cn=globalThis,On=Cn.ShadowRoot&&(void 0===Cn.ShadyCSS||Cn.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Pn=Symbol(),Mn=new WeakMap;let An=class{constructor(n,t,e){if(this._$cssResult$=!0,e!==Pn)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=n,this.t=t}get styleSheet(){let n=this.o;const t=this.t;if(On&&void 0===n){const e=void 0!==t&&1===t.length;e&&(n=Mn.get(t)),void 0===n&&((this.o=n=new CSSStyleSheet).replaceSync(this.cssText),e&&Mn.set(t,n))}return n}toString(){return this.cssText}};const En=On?n=>n:n=>n instanceof CSSStyleSheet?(n=>{let t="";for(const e of n.cssRules)t+=e.cssText;return(n=>new An("string"==typeof n?n:n+"",void 0,Pn))(t)})(n):n
|
|
7
7
|
/**
|
|
8
8
|
* @license
|
|
9
9
|
* Copyright 2017 Google LLC
|
|
10
10
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
11
|
-
*/,{is:
|
|
11
|
+
*/,{is:Rn,defineProperty:Dn,getOwnPropertyDescriptor:$n,getOwnPropertyNames:Tn,getOwnPropertySymbols:jn,getPrototypeOf:Ln}=Object,_n=globalThis,Un=_n.trustedTypes,zn=Un?Un.emptyScript:"",Bn=_n.reactiveElementPolyfillSupport,In=(n,t)=>n,Hn={toAttribute(n,t){switch(t){case Boolean:n=n?zn:null;break;case Object:case Array:n=null==n?n:JSON.stringify(n)}return n},fromAttribute(n,t){let e=n;switch(t){case Boolean:e=null!==n;break;case Number:e=null===n?null:Number(n);break;case Object:case Array:try{e=JSON.parse(n)}catch(n){e=null}}return e}},Nn=(n,t)=>!Rn(n,t),Fn={attribute:!0,type:String,converter:Hn,reflect:!1,useDefault:!1,hasChanged:Nn};Symbol.metadata??=Symbol("metadata"),_n.litPropertyMetadata??=new WeakMap;let qn=class extends HTMLElement{static addInitializer(n){this._$Ei(),(this.l??=[]).push(n)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(n,t=Fn){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(n)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(n,t),!t.noAccessor){const e=Symbol(),l=this.getPropertyDescriptor(n,e,t);void 0!==l&&Dn(this.prototype,n,l)}}static getPropertyDescriptor(n,t,e){const{get:l,set:o}=$n(this.prototype,n)??{get(){return this[t]},set(n){this[t]=n}};return{get:l,set(t){const i=l?.call(this);o?.call(this,t),this.requestUpdate(n,i,e)},configurable:!0,enumerable:!0}}static getPropertyOptions(n){return this.elementProperties.get(n)??Fn}static _$Ei(){if(this.hasOwnProperty(In("elementProperties")))return;const n=Ln(this);n.finalize(),void 0!==n.l&&(this.l=[...n.l]),this.elementProperties=new Map(n.elementProperties)}static finalize(){if(this.hasOwnProperty(In("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(In("properties"))){const n=this.properties,t=[...Tn(n),...jn(n)];for(const e of t)this.createProperty(e,n[e])}const n=this[Symbol.metadata];if(null!==n){const t=litPropertyMetadata.get(n);if(void 0!==t)for(const[n,e]of t)this.elementProperties.set(n,e)}this._$Eh=new Map;for(const[n,t]of this.elementProperties){const e=this._$Eu(n,t);void 0!==e&&this._$Eh.set(e,n)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(n){const t=[];if(Array.isArray(n)){const e=new Set(n.flat(1/0).reverse());for(const n of e)t.unshift(En(n))}else void 0!==n&&t.push(En(n));return t}static _$Eu(n,t){const e=t.attribute;return!1===e?void 0:"string"==typeof e?e:"string"==typeof n?n.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((n=>this.enableUpdating=n)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((n=>n(this)))}addController(n){(this._$EO??=new Set).add(n),void 0!==this.renderRoot&&this.isConnected&&n.hostConnected?.()}removeController(n){this._$EO?.delete(n)}_$E_(){const n=new Map,t=this.constructor.elementProperties;for(const e of t.keys())this.hasOwnProperty(e)&&(n.set(e,this[e]),delete this[e]);n.size>0&&(this._$Ep=n)}createRenderRoot(){const n=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((n,t)=>{if(On)n.adoptedStyleSheets=t.map((n=>n instanceof CSSStyleSheet?n:n.styleSheet));else for(const e of t){const t=document.createElement("style"),l=Cn.litNonce;void 0!==l&&t.setAttribute("nonce",l),t.textContent=e.cssText,n.appendChild(t)}})(n,this.constructor.elementStyles),n}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((n=>n.hostConnected?.()))}enableUpdating(n){}disconnectedCallback(){this._$EO?.forEach((n=>n.hostDisconnected?.()))}attributeChangedCallback(n,t,e){this._$AK(n,e)}_$ET(n,t){const e=this.constructor.elementProperties.get(n),l=this.constructor._$Eu(n,e);if(void 0!==l&&!0===e.reflect){const o=(void 0!==e.converter?.toAttribute?e.converter:Hn).toAttribute(t,e.type);this._$Em=n,null==o?this.removeAttribute(l):this.setAttribute(l,o),this._$Em=null}}_$AK(n,t){const e=this.constructor,l=e._$Eh.get(n);if(void 0!==l&&this._$Em!==l){const n=e.getPropertyOptions(l),o="function"==typeof n.converter?{fromAttribute:n.converter}:void 0!==n.converter?.fromAttribute?n.converter:Hn;this._$Em=l,this[l]=o.fromAttribute(t,n.type)??this._$Ej?.get(l)??null,this._$Em=null}}requestUpdate(n,t,e){if(void 0!==n){const l=this.constructor,o=this[n];if(e??=l.getPropertyOptions(n),!((e.hasChanged??Nn)(o,t)||e.useDefault&&e.reflect&&o===this._$Ej?.get(n)&&!this.hasAttribute(l._$Eu(n,e))))return;this.C(n,t,e)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(n,t,{useDefault:e,reflect:l,wrapped:o},i){e&&!(this._$Ej??=new Map).has(n)&&(this._$Ej.set(n,i??t??this[n]),!0!==o||void 0!==i)||(this._$AL.has(n)||(this.hasUpdated||e||(t=void 0),this._$AL.set(n,t)),!0===l&&this._$Em!==n&&(this._$Eq??=new Set).add(n))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(n){Promise.reject(n)}const n=this.scheduleUpdate();return null!=n&&await n,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[n,t]of this._$Ep)this[n]=t;this._$Ep=void 0}const n=this.constructor.elementProperties;if(n.size>0)for(const[t,e]of n){const{wrapped:n}=e,l=this[t];!0!==n||this._$AL.has(t)||void 0===l||this.C(t,void 0,e,l)}}let n=!1;const t=this._$AL;try{n=this.shouldUpdate(t),n?(this.willUpdate(t),this._$EO?.forEach((n=>n.hostUpdate?.())),this.update(t)):this._$EM()}catch(t){throw n=!1,this._$EM(),t}n&&this._$AE(t)}willUpdate(n){}_$AE(n){this._$EO?.forEach((n=>n.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(n)),this.updated(n)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(n){return!0}update(n){this._$Eq&&=this._$Eq.forEach((n=>this._$ET(n,this[n]))),this._$EM()}updated(n){}firstUpdated(n){}};qn.elementStyles=[],qn.shadowRootOptions={mode:"open"},qn[In("elementProperties")]=new Map,qn[In("finalized")]=new Map,Bn?.({ReactiveElement:qn}),(_n.reactiveElementVersions??=[]).push("2.1.0");
|
|
12
12
|
/**
|
|
13
13
|
* @license
|
|
14
14
|
* Copyright 2017 Google LLC
|
|
15
15
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
16
16
|
*/
|
|
17
|
-
const
|
|
17
|
+
const Vn=globalThis,Wn=Vn.trustedTypes,Kn=Wn?Wn.createPolicy("lit-html",{createHTML:n=>n}):void 0,Xn="$lit$",Yn=`lit$${Math.random().toFixed(9).slice(2)}$`,Zn="?"+Yn,Jn=`<${Zn}>`,Gn=document,Qn=()=>Gn.createComment(""),nt=n=>null===n||"object"!=typeof n&&"function"!=typeof n,tt=Array.isArray,et="[ \t\n\f\r]",lt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ot=/-->/g,it=/>/g,st=RegExp(`>|${et}(?:([^\\s"'>=/]+)(${et}*=${et}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),rt=/'/g,at=/"/g,ut=/^(?:script|style|textarea|title)$/i,ct=n=>(t,...e)=>({_$litType$:n,strings:t,values:e}),ht=ct(1),dt=ct(2),pt=Symbol.for("lit-noChange"),ft=Symbol.for("lit-nothing"),gt=new WeakMap,mt=Gn.createTreeWalker(Gn,129);function vt(n,t){if(!tt(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==Kn?Kn.createHTML(t):t}const yt=(n,t)=>{const e=n.length-1,l=[];let o,i=2===t?"<svg>":3===t?"<math>":"",s=lt;for(let t=0;t<e;t++){const e=n[t];let r,a,u=-1,c=0;for(;c<e.length&&(s.lastIndex=c,a=s.exec(e),null!==a);)c=s.lastIndex,s===lt?"!--"===a[1]?s=ot:void 0!==a[1]?s=it:void 0!==a[2]?(ut.test(a[2])&&(o=RegExp("</"+a[2],"g")),s=st):void 0!==a[3]&&(s=st):s===st?">"===a[0]?(s=o??lt,u=-1):void 0===a[1]?u=-2:(u=s.lastIndex-a[2].length,r=a[1],s=void 0===a[3]?st:'"'===a[3]?at:rt):s===at||s===rt?s=st:s===ot||s===it?s=lt:(s=st,o=void 0);const h=s===st&&n[t+1].startsWith("/>")?" ":"";i+=s===lt?e+Jn:u>=0?(l.push(r),e.slice(0,u)+Xn+e.slice(u)+Yn+h):e+Yn+(-2===u?t:h)}return[vt(n,i+(n[e]||"<?>")+(2===t?"</svg>":3===t?"</math>":"")),l]};class bt{constructor({strings:n,_$litType$:t},e){let l;this.parts=[];let o=0,i=0;const s=n.length-1,r=this.parts,[a,u]=yt(n,t);if(this.el=bt.createElement(a,e),mt.currentNode=this.el.content,2===t||3===t){const n=this.el.content.firstChild;n.replaceWith(...n.childNodes)}for(;null!==(l=mt.nextNode())&&r.length<s;){if(1===l.nodeType){if(l.hasAttributes())for(const n of l.getAttributeNames())if(n.endsWith(Xn)){const t=u[i++],e=l.getAttribute(n).split(Yn),s=/([.?@])?(.*)/.exec(t);r.push({type:1,index:o,name:s[2],strings:e,ctor:"."===s[1]?Ct:"?"===s[1]?Ot:"@"===s[1]?Pt:xt}),l.removeAttribute(n)}else n.startsWith(Yn)&&(r.push({type:6,index:o}),l.removeAttribute(n));if(ut.test(l.tagName)){const n=l.textContent.split(Yn),t=n.length-1;if(t>0){l.textContent=Wn?Wn.emptyScript:"";for(let e=0;e<t;e++)l.append(n[e],Qn()),mt.nextNode(),r.push({type:2,index:++o});l.append(n[t],Qn())}}}else if(8===l.nodeType)if(l.data===Zn)r.push({type:2,index:o});else{let n=-1;for(;-1!==(n=l.data.indexOf(Yn,n+1));)r.push({type:7,index:o}),n+=Yn.length-1}o++}}static createElement(n,t){const e=Gn.createElement("template");return e.innerHTML=n,e}}function wt(n,t,e=n,l){if(t===pt)return t;let o=void 0!==l?e._$Co?.[l]:e._$Cl;const i=nt(t)?void 0:t._$litDirective$;return o?.constructor!==i&&(o?._$AO?.(!1),void 0===i?o=void 0:(o=new i(n),o._$AT(n,e,l)),void 0!==l?(e._$Co??=[])[l]=o:e._$Cl=o),void 0!==o&&(t=wt(n,o._$AS(n,t.values),o,l)),t}class kt{constructor(n,t){this._$AV=[],this._$AN=void 0,this._$AD=n,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(n){const{el:{content:t},parts:e}=this._$AD,l=(n?.creationScope??Gn).importNode(t,!0);mt.currentNode=l;let o=mt.nextNode(),i=0,s=0,r=e[0];for(;void 0!==r;){if(i===r.index){let t;2===r.type?t=new St(o,o.nextSibling,this,n):1===r.type?t=new r.ctor(o,r.name,r.strings,this,n):6===r.type&&(t=new Mt(o,this,n)),this._$AV.push(t),r=e[++s]}i!==r?.index&&(o=mt.nextNode(),i++)}return mt.currentNode=Gn,l}p(n){let t=0;for(const e of this._$AV)void 0!==e&&(void 0!==e.strings?(e._$AI(n,e,t),t+=e.strings.length-2):e._$AI(n[t])),t++}}class St{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(n,t,e,l){this.type=2,this._$AH=ft,this._$AN=void 0,this._$AA=n,this._$AB=t,this._$AM=e,this.options=l,this._$Cv=l?.isConnected??!0}get parentNode(){let n=this._$AA.parentNode;const t=this._$AM;return void 0!==t&&11===n?.nodeType&&(n=t.parentNode),n}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(n,t=this){n=wt(this,n,t),nt(n)?n===ft||null==n||""===n?(this._$AH!==ft&&this._$AR(),this._$AH=ft):n!==this._$AH&&n!==pt&&this._(n):void 0!==n._$litType$?this.$(n):void 0!==n.nodeType?this.T(n):(n=>tt(n)||"function"==typeof n?.[Symbol.iterator])(n)?this.k(n):this._(n)}O(n){return this._$AA.parentNode.insertBefore(n,this._$AB)}T(n){this._$AH!==n&&(this._$AR(),this._$AH=this.O(n))}_(n){this._$AH!==ft&&nt(this._$AH)?this._$AA.nextSibling.data=n:this.T(Gn.createTextNode(n)),this._$AH=n}$(n){const{values:t,_$litType$:e}=n,l="number"==typeof e?this._$AC(n):(void 0===e.el&&(e.el=bt.createElement(vt(e.h,e.h[0]),this.options)),e);if(this._$AH?._$AD===l)this._$AH.p(t);else{const n=new kt(l,this),e=n.u(this.options);n.p(t),this.T(e),this._$AH=n}}_$AC(n){let t=gt.get(n.strings);return void 0===t&>.set(n.strings,t=new bt(n)),t}k(n){tt(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let e,l=0;for(const o of n)l===t.length?t.push(e=new St(this.O(Qn()),this.O(Qn()),this,this.options)):e=t[l],e._$AI(o),l++;l<t.length&&(this._$AR(e&&e._$AB.nextSibling,l),t.length=l)}_$AR(n=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);n&&n!==this._$AB;){const t=n.nextSibling;n.remove(),n=t}}setConnected(n){void 0===this._$AM&&(this._$Cv=n,this._$AP?.(n))}}class xt{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(n,t,e,l,o){this.type=1,this._$AH=ft,this._$AN=void 0,this.element=n,this.name=t,this._$AM=l,this.options=o,e.length>2||""!==e[0]||""!==e[1]?(this._$AH=Array(e.length-1).fill(new String),this.strings=e):this._$AH=ft}_$AI(n,t=this,e,l){const o=this.strings;let i=!1;if(void 0===o)n=wt(this,n,t,0),i=!nt(n)||n!==this._$AH&&n!==pt,i&&(this._$AH=n);else{const l=n;let s,r;for(n=o[0],s=0;s<o.length-1;s++)r=wt(this,l[e+s],t,s),r===pt&&(r=this._$AH[s]),i||=!nt(r)||r!==this._$AH[s],r===ft?n=ft:n!==ft&&(n+=(r??"")+o[s+1]),this._$AH[s]=r}i&&!l&&this.j(n)}j(n){n===ft?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,n??"")}}class Ct extends xt{constructor(){super(...arguments),this.type=3}j(n){this.element[this.name]=n===ft?void 0:n}}class Ot extends xt{constructor(){super(...arguments),this.type=4}j(n){this.element.toggleAttribute(this.name,!!n&&n!==ft)}}class Pt extends xt{constructor(n,t,e,l,o){super(n,t,e,l,o),this.type=5}_$AI(n,t=this){if((n=wt(this,n,t,0)??ft)===pt)return;const e=this._$AH,l=n===ft&&e!==ft||n.capture!==e.capture||n.once!==e.once||n.passive!==e.passive,o=n!==ft&&(e===ft||l);l&&this.element.removeEventListener(this.name,this,e),o&&this.element.addEventListener(this.name,this,n),this._$AH=n}handleEvent(n){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,n):this._$AH.handleEvent(n)}}class Mt{constructor(n,t,e){this.element=n,this.type=6,this._$AN=void 0,this._$AM=t,this.options=e}get _$AU(){return this._$AM._$AU}_$AI(n){wt(this,n)}}const At=Vn.litHtmlPolyfillSupport;At?.(bt,St),(Vn.litHtmlVersions??=[]).push("3.3.0");const Et=(n,t,e)=>{const l=e?.renderBefore??t;let o=l._$litPart$;if(void 0===o){const n=e?.renderBefore??null;l._$litPart$=o=new St(t.insertBefore(Qn(),n),n,void 0,e??{})}return o._$AI(n),o
|
|
18
18
|
/**
|
|
19
19
|
* @license
|
|
20
20
|
* Copyright 2017 Google LLC
|
|
21
21
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
22
|
-
*/},
|
|
22
|
+
*/},Rt=globalThis;let Dt=class extends qn{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const n=super.createRenderRoot();return this.renderOptions.renderBefore??=n.firstChild,n}update(n){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(n),this._$Do=Et(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return pt}};Dt._$litElement$=!0,Dt.finalized=!0,Rt.litElementHydrateSupport?.({LitElement:Dt});const $t=Rt.litElementPolyfillSupport;$t?.({LitElement:Dt}),(Rt.litElementVersions??=[]).push("4.2.0");
|
|
23
23
|
/**
|
|
24
24
|
* @license
|
|
25
25
|
* Copyright 2017 Google LLC
|
|
26
26
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
27
27
|
*/
|
|
28
|
-
const
|
|
28
|
+
const Tt=2,jt=5,Lt=n=>(...t)=>({_$litDirective$:n,values:t});class _t{constructor(n){}get _$AU(){return this._$AM._$AU}_$AT(n,t,e){this._$Ct=n,this._$AM=t,this._$Ci=e}_$AS(n,t){return this.update(n,t)}update(n,t){return this.render(...t)}}
|
|
29
29
|
/**
|
|
30
30
|
* @license
|
|
31
31
|
* Copyright 2017 Google LLC
|
|
32
32
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
33
|
-
*/class
|
|
33
|
+
*/class Ut extends _t{constructor(n){if(super(n),this.it=ft,n.type!==Tt)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(n){if(n===ft||null==n)return this._t=void 0,this.it=n;if(n===pt)return n;if("string"!=typeof n)throw Error(this.constructor.directiveName+"() called with a non-string value");if(n===this.it)return this._t;this.it=n;const t=[n];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}}Ut.directiveName="unsafeHTML",Ut.resultType=1;const zt=Lt(Ut);const Bt=Lt(class extends _t{constructor(n){if(super(n),n.type!==jt)throw new Error("run() can only be used in event handlers")}update(n,t){const e=n.element,l=n.name,[o,...i]=t,r=()=>{let n=e,t=n._component;for(;!t&&n;)n=n.parentElement,t=n&&n._component;return console.assert(!!t,"Component not found."),t};return"string"==typeof o?e[`on${l}`]=n=>{const t=r();t?t.run(o,...i,n):s.run(o,...i,n)}:"function"==typeof o&&(e[`on${l}`]=n=>r().setState(o(r().state,...i,n))),this.render()}render(){return pt}});if(s.createElement=ln,s.render=function(n,t,e){t&&("string"==typeof t?(n._$litPart$||n.replaceChildren(),Et(ht`${zt(t)}`,n)):t._$litType$?(n._$litPart$||n.replaceChildren(),Et(t,n)):(on(n,t,e),n._$litPart$=void 0))},s.Fragment=Q,"object"==typeof window){const n=window;It=n,Ht={React:n._React||s,html:ht,svg:dt,run:Bt},"object"==typeof It&&null!==It&&Object.keys(Ht).forEach((n=>{It[n]=Ht[n]}))}var It,Ht;const Nt=(n,t,e,l)=>{if(!t||!e)return;const o=n=>{var e,l;const o=t.cloneNode();null===(e=t.parentNode)||void 0===e||e.replaceChild(o,t);const i=null===(l=(t=o).contentWindow)||void 0===l?void 0:l.document;i&&(i.open(),n.indexOf("<html")>=0?i.write(n):i.write((n=>`<!DOCTYPE html>\n<html lang="en">\n<head>\n <meta charset="UTF-8">\n <meta name="viewport" content="width=device-width, initial-scale=1.0">\n <meta http-equiv="X-UA-Compatible" content="ie=edge">\n <script src="https://cdnjs.cloudflare.com/ajax/libs/custom-elements/1.1.2/custom-elements.min.js"><\/script>\n <title>AppRun Playground</title>\n <style>\n body {\n font-family: "Benton Sans", "Helvetica Neue", helvetica, arial, sans-serif;\n margin: 2em;\n }\n </style>\n <script src="https://unpkg.com/@babel/standalone/babel.min.js"><\/script>\n <script src="https://unpkg.com/apprun/dist/apprun-html.js"><\/script>\n</head>\n<body>\n<script>\n Babel.registerPlugin("d", [Babel.availablePlugins["proposal-decorators"], {legacy: true}]);\n Babel.registerPlugin("c", [Babel.availablePlugins["proposal-class-properties"], {loose: true}]);\n Babel.registerPlugin("b", [Babel.availablePlugins["proposal-private-methods"], {loose: true}]);\n<\/script>\n<script type="text/babel" data-plugins="d, c, b">\n ${n}\n<\/script>\n</body>\n</html>`)(n)),i.close())};o(e),!l&&n&&"TEXTAREA"===n.nodeName&&("undefined"==typeof CodeMirror?n.onkeyup=()=>o(n.value):n.editor||(n.editor=CodeMirror.fromTextArea(n,{lineNumbers:!0,mode:"jsx"}),n.editor.on("change",(n=>o(n.getValue())))))};s.webComponent("apprun-play",class extends vn{constructor(){super(...arguments),this.view=n=>{const t=n["code-element"],e=this.element;let l,o;return l=t?document.querySelector(t):e.previousElementSibling||e.parentElement.previousElementSibling,o=(null==l?void 0:l.innerText)||(null==l?void 0:l.value)||n.code,this.state.code_area=l,this.state.code=o,o?`<div class="toolbox">\n ${!n.hide_button&&'<a class="button" onclick="app.run("@show-popup")" >Try the Code</a>'}\n </div>`:"<div>AppRun Play cannot find code to run, please set code-element selector.</div>"},this.rendered=({style:n,hide_src:t,code_area:e,code:l})=>{if(!l)return;if(!document.getElementById("play-popup")){document.body.insertAdjacentHTML("beforeend",'<div id="play-popup" class="overlay">\n<style id="apprun-play-style">\n.apprun-play .col {\n height: 100%;\n flex: 1;\n}\n.apprun-preview {\n width: 100%\n}\n.apprun-play .editor, .apprun-play .preview {\n display: inline-block;\n width: calc(100% - 20px);\n height: calc(100% - 10px);\n}\n\na.button {\n font-size: .8em;\n padding: 10px;\n cursor: pointer;\n color: var(--md-primary-bg-color);\n background: var(--md-primary-fg-color)\n}\na.button:hover {\n color: var(--md-primary-fg-color);\n background: var(--md-primary-bg-color)\n}\n\n.overlay {\n position: fixed;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n background: rgba(0, 0, 0, 0.7);\n visibility: hidden;\n opacity: 0;\n z-index: 999;\n}\n.overlay.show {\n visibility: visible;\n opacity: 1;\n}\n\n.popup {\n margin: 80px auto;\n padding: 20px;\n background: #fff;\n border-radius: 3px;\n position: relative;\n width: 90%;\n height: calc(100% - 150px);\n}\n\n.popup .close {\n position: absolute;\n top: 10px;\n right: 20px;\n font-size: 20px;\n font-weight: bold;\n text-decoration: none;\n color: #333;\n}\n.popup .close:hover {\n color: #06D85F;\n}\n.popup .content {\n height: 100%;\n overflow: hidden;\n display: flex;\n}\n\n.cm-s-default {\n height: 100%;\n font-size: small;\n line-height: 1.5em;\n z-index: 0;\n}\n</style>\n\n\t<div class="popup apprun-play">\n\t\t<a class="close" href="javascript:app.run(\'@close-popup\')">×</a>\n\t\t<div class="content">\n\t\t\t<div class="col">\n <textarea class="editor"></textarea>\n </div>\n <div class="col">\n <iframe class="preview"/>\n </div>\n </div>\n\t</div>\n</div>');const n=document.querySelector(".apprun-play .editor"),t=document.querySelector(".apprun-play .preview");n.value=l,Nt(n,t,l,!1)}const o=document.createElement("iframe");o.classList.add("apprun-preview"),o.style.cssText=n,this.element.before(o),t&&(e.style.display="none"),Nt(e,o,l,t)},this.update={"@show-popup":({code:n})=>{var t;null===(t=document.querySelector(".apprun-play .editor").editor)||void 0===t||t.setValue(n),document.getElementById("play-popup").classList.add("show")},"@close-popup":()=>{document.getElementById("play-popup").classList.remove("show")}}}});
|
|
34
34
|
//# sourceMappingURL=apprun-play-html.esm.js.map
|