2022-08-18 19:47:49 +08:00

3 lines
80 KiB
JavaScript

(function(){function _defineProperty(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}System.register([],(function(){"use strict";return{execute:function(){const p=function(){const e=document.createElement("link").relList;if(!(e&&e.supports&&e.supports("modulepreload"))){for(const e of document.querySelectorAll('link[rel="modulepreload"]'))t(e);new MutationObserver((e=>{for(const n of e)if("childList"===n.type)for(const e of n.addedNodes)"LINK"===e.tagName&&"modulepreload"===e.rel&&t(e)})).observe(document,{childList:!0,subtree:!0})}function t(e){if(e.ep)return;e.ep=!0;const t=function(e){const t={};return e.integrity&&(t.integrity=e.integrity),e.referrerpolicy&&(t.referrerPolicy=e.referrerpolicy),"use-credentials"===e.crossorigin?t.credentials="include":"anonymous"===e.crossorigin?t.credentials="omit":t.credentials="same-origin",t}(e);fetch(e.href,t)}};var commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function getDefaultExportFromCjs(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var events={exports:{}},R="object"==typeof Reflect?Reflect:null,ReflectApply=R&&"function"==typeof R.apply?R.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)},ReflectOwnKeys;function ProcessEmitWarning(e){console&&console.warn&&console.warn(e)}ReflectOwnKeys=R&&"function"==typeof R.ownKeys?R.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var NumberIsNaN=Number.isNaN||function(e){return e!=e};function EventEmitter(){EventEmitter.init.call(this)}events.exports=EventEmitter,events.exports.once=once,EventEmitter.EventEmitter=EventEmitter,EventEmitter.prototype._events=void 0,EventEmitter.prototype._eventsCount=0,EventEmitter.prototype._maxListeners=void 0;var defaultMaxListeners=10;function checkListener(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function _getMaxListeners(e){return void 0===e._maxListeners?EventEmitter.defaultMaxListeners:e._maxListeners}function _addListener(e,t,n,r){var i,o,s;if(checkListener(n),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),o=e._events),s=o[t]),void 0===s)s=o[t]=n,++e._eventsCount;else if("function"==typeof s?s=o[t]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),(i=_getMaxListeners(e))>0&&s.length>i&&!s.warned){s.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=e,a.type=t,a.count=s.length,ProcessEmitWarning(a)}return e}function onceWrapper(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function _onceWrap(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=onceWrapper.bind(r);return i.listener=n,r.wrapFn=i,i}function _listeners(e,t,n){var r=e._events;if(void 0===r)return[];var i=r[t];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?unwrapListeners(i):arrayClone(i,i.length)}function listenerCount(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function arrayClone(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e[r];return n}function spliceOne(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function unwrapListeners(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}function once(e,t){return new Promise((function(n,r){function i(n){e.removeListener(t,o),r(n)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",i),n([].slice.call(arguments))}eventTargetAgnosticAddListener(e,t,o,{once:!0}),"error"!==t&&addErrorHandlerIfEventEmitter(e,i,{once:!0})}))}function addErrorHandlerIfEventEmitter(e,t,n){"function"==typeof e.on&&eventTargetAgnosticAddListener(e,"error",t,n)}function eventTargetAgnosticAddListener(e,t,n,r){if("function"==typeof e.on)r.once?e.once(t,n):e.on(t,n);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function i(o){r.once&&e.removeEventListener(t,i),n(o)}))}}Object.defineProperty(EventEmitter,"defaultMaxListeners",{enumerable:!0,get:function(){return defaultMaxListeners},set:function(e){if("number"!=typeof e||e<0||NumberIsNaN(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");defaultMaxListeners=e}}),EventEmitter.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},EventEmitter.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||NumberIsNaN(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},EventEmitter.prototype.getMaxListeners=function(){return _getMaxListeners(this)},EventEmitter.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var r="error"===e,i=this._events;if(void 0!==i)r=r&&void 0===i.error;else if(!r)return!1;if(r){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var s=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw s.context=o,s}var a=i[e];if(void 0===a)return!1;if("function"==typeof a)ReflectApply(a,this,t);else{var u=a.length,c=arrayClone(a,u);for(n=0;n<u;++n)ReflectApply(c[n],this,t)}return!0},EventEmitter.prototype.addListener=function(e,t){return _addListener(this,e,t,!1)},EventEmitter.prototype.on=EventEmitter.prototype.addListener,EventEmitter.prototype.prependListener=function(e,t){return _addListener(this,e,t,!0)},EventEmitter.prototype.once=function(e,t){return checkListener(t),this.on(e,_onceWrap(this,e,t)),this},EventEmitter.prototype.prependOnceListener=function(e,t){return checkListener(t),this.prependListener(e,_onceWrap(this,e,t)),this},EventEmitter.prototype.removeListener=function(e,t){var n,r,i,o,s;if(checkListener(t),void 0===(r=this._events))return this;if(void 0===(n=r[e]))return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(i=-1,o=n.length-1;o>=0;o--)if(n[o]===t||n[o].listener===t){s=n[o].listener,i=o;break}if(i<0)return this;0===i?n.shift():spliceOne(n,i),1===n.length&&(r[e]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",e,s||t)}return this},EventEmitter.prototype.off=EventEmitter.prototype.removeListener,EventEmitter.prototype.removeAllListeners=function(e){var t,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[e]),this;if(0===arguments.length){var i,o=Object.keys(n);for(r=0;r<o.length;++r)"removeListener"!==(i=o[r])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(void 0!==t)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this},EventEmitter.prototype.listeners=function(e){return _listeners(this,e,!0)},EventEmitter.prototype.rawListeners=function(e){return _listeners(this,e,!1)},EventEmitter.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):listenerCount.call(e,t)},EventEmitter.prototype.listenerCount=listenerCount,EventEmitter.prototype.eventNames=function(){return this._eventsCount>0?ReflectOwnKeys(this._events):[]};class Env{constructor(e=globalThis.navigator.userAgent,t={}){_defineProperty(this,"isIos",!1),_defineProperty(this,"isIphone",!1),_defineProperty(this,"isIpad",!1),_defineProperty(this,"isAndroid",!1),_defineProperty(this,"isAndroidPad",!1),_defineProperty(this,"isMac",!1),_defineProperty(this,"isWin",!1),_defineProperty(this,"isMqq",!1),_defineProperty(this,"isWechat",!1),_defineProperty(this,"isWeb",!1),this.isIphone=e.indexOf("iPhone")>=0,this.isIpad=/(iPad).*OS\s([\d_]+)/.test(e),this.isIos=this.isIphone||this.isIpad,this.isAndroid=e.indexOf("Android")>=0,this.isAndroidPad=this.isAndroid&&e.indexOf("Mobile")<0,this.isMac=e.indexOf("Macintosh")>=0,this.isWin=e.indexOf("Windows")>=0,this.isMqq=/QQ\/([\d.]+)/.test(e),this.isWechat=e.indexOf("MicroMessenger")>=0&&e.indexOf("wxwork")<0,this.isWeb=!this.isIos&&!this.isAndroid&&!/(WebOS|BlackBerry)/.test(e),Object.entries(t).forEach((([e,t])=>{this[e]=t}))}}const COMMON_EVENT_PREFIX="magic:common:events:",COMMON_METHOD_PREFIX="magic:common:actions:",CommonMethod={SHOW:"show",HIDE:"hide",SCROLL_TO_VIEW:"scrollIntoView",SCROLL_TO_TOP:"scrollToTop"},DEFAULT_EVENTS=[{label:"点击",value:`${COMMON_EVENT_PREFIX}click`}],getCommonEventName=(e,t)=>{const n=`${e}:${t}`;return e.startsWith(COMMON_EVENT_PREFIX)?n:`${COMMON_EVENT_PREFIX}${n}`},isCommonMethod=e=>e.startsWith(COMMON_METHOD_PREFIX),getDirectComponent=(e,t)=>{var n;if(!e)return!1;if(!e.id)return getDirectComponent(e.parentElement,t);const r=null===(n=t.page)||void 0===n?void 0:n.getNode(e.id);return r||!1},commonClickEventHandler=(e,t,n)=>{const r=getDirectComponent(n.target,e);if(r){const{instance:n,data:i}=r;e.emit(getCommonEventName(t,i.id),n)}},bindCommonEventListener=e=>{window.document.body.addEventListener("click",(t=>{commonClickEventHandler(e,"click",t)})),window.document.body.addEventListener("click",(t=>{commonClickEventHandler(e,"click:capture",t)}),!0)},triggerCommonMethod=(e,t)=>{const{instance:n}=t;switch(e.replace(COMMON_METHOD_PREFIX,"")){case CommonMethod.SHOW:n.show();break;case CommonMethod.HIDE:n.hide();break;case CommonMethod.SCROLL_TO_VIEW:n.$el.scrollIntoView({behavior:"smooth"});break;case CommonMethod.SCROLL_TO_TOP:window.scrollTo({top:0,behavior:"smooth"})}};class Store{constructor(){_defineProperty(this,"data",{})}set(e,t){this.data[e]=t}get(e){return this.data[e]}}class Node extends events.exports.EventEmitter{constructor(e){super(),_defineProperty(this,"data",void 0),_defineProperty(this,"style",void 0),_defineProperty(this,"events",void 0),_defineProperty(this,"instance",void 0),_defineProperty(this,"page",void 0),_defineProperty(this,"parent",void 0),_defineProperty(this,"app",void 0),_defineProperty(this,"store",new Store),this.page=e.page,this.parent=e.parent,this.app=e.app;const{events:t}=e.config;this.data=e.config,this.events=t,this.listenLifeSafe(),this.once("destroy",(()=>{this.instance=null,"function"==typeof this.data.destroy&&this.data.destroy(this),this.listenLifeSafe()}))}listenLifeSafe(){this.once("created",(e=>{this.instance=e,"function"==typeof this.data.created&&this.data.created(this)})),this.once("mounted",(e=>{this.instance=e;const t=this.app.eventQueueMap[e.config.id]||[];for(let n=t.shift();n;n=t.shift())this.app.eventHandler(n.eventConfig,n.fromCpt,n.args);"function"==typeof this.data.mounted&&this.data.mounted(this)}))}}class Page extends Node{constructor(e){super(e),_defineProperty(this,"nodes",new Map),this.setNode(e.config.id,this),this.initNode(e.config,this)}initNode(e,t){var n;const r=new Node({config:e,parent:t,page:this,app:this.app});this.setNode(e.id,r),null===(n=e.items)||void 0===n||n.forEach((e=>{this.initNode(e,r)}))}getNode(e){return this.nodes.get(e)}setNode(e,t){this.nodes.set(e,t)}deleteNode(e){this.nodes.delete(e)}}const style2Obj=e=>{if("string"!=typeof e)return e;const t={};return e.split(";").forEach((e=>{if(!e)return;const n=e.split(":");let r=n.shift(),i=n.join(":");r&&(r=r.replace(/^\s*/,"").replace(/\s*$/,""),i=i.replace(/^\s*/,"").replace(/\s*$/,""),r=r.split("-").map(((e,t)=>t>0?`${e[0].toUpperCase()}${e.substr(1)}`:e)).join(""),t[r]=i)})),t},fillBackgroundImage=e=>!e||/^url/.test(e)||/^linear-gradient/.test(e)?e:`url(${e})`,isNumber$1=e=>/^(-?\d+)(\.\d+)?$/.test(e);class App extends events.exports.EventEmitter{constructor(e){if(super(),_defineProperty(this,"env",void 0),_defineProperty(this,"pages",new Map),_defineProperty(this,"page",void 0),_defineProperty(this,"platform","mobile"),_defineProperty(this,"jsEngine","browser"),_defineProperty(this,"designWidth",375),_defineProperty(this,"components",new Map),_defineProperty(this,"eventQueueMap",{}),this.env=new Env(e.ua),e.platform&&(this.platform=e.platform),e.jsEngine&&(this.jsEngine=e.jsEngine),e.designWidth&&(this.designWidth=e.designWidth),"mobile"===this.platform||"editor"===this.platform){const e=()=>{let{width:e}=document.documentElement.getBoundingClientRect();e=Math.min(800,e);const t=e/(this.designWidth/100);document.documentElement.style.fontSize=`${t}px`};e(),document.body.style.fontSize="14px",globalThis.addEventListener("resize",e)}e.transformStyle&&(this.transformStyle=e.transformStyle),e.config&&this.setConfig(e.config,e.curPage),bindCommonEventListener(this)}transformStyle(e){if(!e)return{};let t={};const n={};t="string"==typeof e?style2Obj(e):{...e};const r=["zIndex","opacity","fontWeight"];return Object.entries(t).forEach((([e,t])=>{"backgroundImage"===e?t&&(n[e]=fillBackgroundImage(t)):"transform"===e&&"string"!=typeof t?n[e]=Object.entries(t).map((([e,t])=>{let n=0;return"scale"===e&&(n=1),"rotate"===e&&isNumber$1(t)&&(t=`${t}deg`),`${e}(${t||n})`})).join(" "):!r.includes(e)&&t&&/^[-]?[0-9]*[.]?[0-9]*$/.test(t)?n[e]=t/100+"rem":n[e]=t})),n}setConfig(e,t){var n,r,i;this.pages=new Map,null===(n=e.items)||void 0===n||n.forEach((e=>{this.pages.set(e.id,new Page({config:e,app:this}))})),this.setPage(t||(null===(r=this.page)||void 0===r||null===(i=r.data)||void 0===i?void 0:i.id))}setPage(e){let t;e&&(t=this.pages.get(e)),t||(t=this.pages.get(this.pages.keys().next().value)),this.page=t,"magic"!==this.platform&&this.bindEvents()}registerComponent(e,t){this.components.set(e,t)}unregisterComponent(e){this.components.delete(e)}resolveComponent(e){return this.components.get(e)}bindEvents(){if(this.page){this.removeAllListeners();for(const[,t]of this.page.nodes){var e;null===(e=t.events)||void 0===e||e.forEach((e=>this.bindEvent(e,`${t.data.id}`)))}}}bindEvent(e,t){let{name:n}=e;DEFAULT_EVENTS.findIndex((e=>e.value===n))>-1&&(n=getCommonEventName(n,t)),this.on(n,((t,...n)=>{this.eventHandler(e,t,n)}))}eventHandler(e,t,n){if(!this.page)throw new Error("当前没有页面");const{method:r,to:i}=e,o=this.page.getNode(i);if(!o)throw`ID为${i}的组件不存在`;if(isCommonMethod(r))return triggerCommonMethod(r,o);o.instance?"function"==typeof o.instance[r]&&o.instance[r](t,...n):this.addEventToMap({eventConfig:e,fromCpt:t,args:n})}destroy(){this.removeAllListeners(),this.pages.clear()}addEventToMap(e){this.eventQueueMap[e.eventConfig.to]?this.eventQueueMap[e.eventConfig.to].push(e):this.eventQueueMap[e.eventConfig.to]=[e]}}var dayjs_min={exports:{}},module;module=dayjs_min,module.exports=function(){var e=1e3,t=6e4,n=36e5,r="millisecond",i="second",o="minute",s="hour",a="day",u="week",c="month",l="quarter",f="year",d="date",h="Invalid Date",p=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,g=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,m={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_")},v=function(e,t,n){var r=String(e);return!r||r.length>=t?e:""+Array(t+1-r.length).join(n)+e},y={s:v,z:function(e){var t=-e.utcOffset(),n=Math.abs(t),r=Math.floor(n/60),i=n%60;return(t<=0?"+":"-")+v(r,2,"0")+":"+v(i,2,"0")},m:function e(t,n){if(t.date()<n.date())return-e(n,t);var r=12*(n.year()-t.year())+(n.month()-t.month()),i=t.clone().add(r,c),o=n-i<0,s=t.clone().add(r+(o?-1:1),c);return+(-(r+(n-i)/(o?i-s:s-i))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(e){return{M:c,y:f,w:u,d:a,D:d,h:s,m:o,s:i,ms:r,Q:l}[e]||String(e||"").toLowerCase().replace(/s$/,"")},u:function(e){return void 0===e}},E="en",C={};C[E]=m;var $=function(e){return e instanceof A},_=function e(t,n,r){var i;if(!t)return E;if("string"==typeof t){var o=t.toLowerCase();C[o]&&(i=o),n&&(C[o]=n,i=o);var s=t.split("-");if(!i&&s.length>1)return e(s[0])}else{var a=t.name;C[a]=t,i=a}return!r&&i&&(E=i),i||!r&&E},w=function(e,t){if($(e))return e.clone();var n="object"==typeof t?t:{};return n.date=e,n.args=arguments,new A(n)},b=y;b.l=_,b.i=$,b.w=function(e,t){return w(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var A=function(){function m(e){this.$L=_(e.locale,null,!0),this.parse(e)}var v=m.prototype;return v.parse=function(e){this.$d=function(e){var t=e.date,n=e.utc;if(null===t)return new Date(NaN);if(b.u(t))return new Date;if(t instanceof Date)return new Date(t);if("string"==typeof t&&!/Z$/i.test(t)){var r=t.match(p);if(r){var i=r[2]-1||0,o=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,o)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,o)}}return new Date(t)}(e),this.$x=e.x||{},this.init()},v.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},v.$utils=function(){return b},v.isValid=function(){return!(this.$d.toString()===h)},v.isSame=function(e,t){var n=w(e);return this.startOf(t)<=n&&n<=this.endOf(t)},v.isAfter=function(e,t){return w(e)<this.startOf(t)},v.isBefore=function(e,t){return this.endOf(t)<w(e)},v.$g=function(e,t,n){return b.u(e)?this[t]:this.set(n,e)},v.unix=function(){return Math.floor(this.valueOf()/1e3)},v.valueOf=function(){return this.$d.getTime()},v.startOf=function(e,t){var n=this,r=!!b.u(t)||t,l=b.p(e),h=function(e,t){var i=b.w(n.$u?Date.UTC(n.$y,t,e):new Date(n.$y,t,e),n);return r?i:i.endOf(a)},p=function(e,t){return b.w(n.toDate()[e].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(t)),n)},g=this.$W,m=this.$M,v=this.$D,y="set"+(this.$u?"UTC":"");switch(l){case f:return r?h(1,0):h(31,11);case c:return r?h(1,m):h(0,m+1);case u:var E=this.$locale().weekStart||0,C=(g<E?g+7:g)-E;return h(r?v-C:v+(6-C),m);case a:case d:return p(y+"Hours",0);case s:return p(y+"Minutes",1);case o:return p(y+"Seconds",2);case i:return p(y+"Milliseconds",3);default:return this.clone()}},v.endOf=function(e){return this.startOf(e,!1)},v.$set=function(e,t){var n,u=b.p(e),l="set"+(this.$u?"UTC":""),h=(n={},n[a]=l+"Date",n[d]=l+"Date",n[c]=l+"Month",n[f]=l+"FullYear",n[s]=l+"Hours",n[o]=l+"Minutes",n[i]=l+"Seconds",n[r]=l+"Milliseconds",n)[u],p=u===a?this.$D+(t-this.$W):t;if(u===c||u===f){var g=this.clone().set(d,1);g.$d[h](p),g.init(),this.$d=g.set(d,Math.min(this.$D,g.daysInMonth())).$d}else h&&this.$d[h](p);return this.init(),this},v.set=function(e,t){return this.clone().$set(e,t)},v.get=function(e){return this[b.p(e)]()},v.add=function(r,l){var d,h=this;r=Number(r);var p=b.p(l),g=function(e){var t=w(h);return b.w(t.date(t.date()+Math.round(e*r)),h)};if(p===c)return this.set(c,this.$M+r);if(p===f)return this.set(f,this.$y+r);if(p===a)return g(1);if(p===u)return g(7);var m=(d={},d[o]=t,d[s]=n,d[i]=e,d)[p]||1,v=this.$d.getTime()+r*m;return b.w(v,this)},v.subtract=function(e,t){return this.add(-1*e,t)},v.format=function(e){var t=this,n=this.$locale();if(!this.isValid())return n.invalidDate||h;var r=e||"YYYY-MM-DDTHH:mm:ssZ",i=b.z(this),o=this.$H,s=this.$m,a=this.$M,u=n.weekdays,c=n.months,l=function(e,n,i,o){return e&&(e[n]||e(t,r))||i[n].slice(0,o)},f=function(e){return b.s(o%12||12,e,"0")},d=n.meridiem||function(e,t,n){var r=e<12?"AM":"PM";return n?r.toLowerCase():r},p={YY:String(this.$y).slice(-2),YYYY:this.$y,M:a+1,MM:b.s(a+1,2,"0"),MMM:l(n.monthsShort,a,c,3),MMMM:l(c,a),D:this.$D,DD:b.s(this.$D,2,"0"),d:String(this.$W),dd:l(n.weekdaysMin,this.$W,u,2),ddd:l(n.weekdaysShort,this.$W,u,3),dddd:u[this.$W],H:String(o),HH:b.s(o,2,"0"),h:f(1),hh:f(2),a:d(o,s,!0),A:d(o,s,!1),m:String(s),mm:b.s(s,2,"0"),s:String(this.$s),ss:b.s(this.$s,2,"0"),SSS:b.s(this.$ms,3,"0"),Z:i};return r.replace(g,(function(e,t){return t||p[e]||i.replace(":","")}))},v.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},v.diff=function(r,d,h){var p,g=b.p(d),m=w(r),v=(m.utcOffset()-this.utcOffset())*t,y=this-m,E=b.m(this,m);return E=(p={},p[f]=E/12,p[c]=E,p[l]=E/3,p[u]=(y-v)/6048e5,p[a]=(y-v)/864e5,p[s]=y/n,p[o]=y/t,p[i]=y/e,p)[g]||y,h?E:b.a(E)},v.daysInMonth=function(){return this.endOf(c).$D},v.$locale=function(){return C[this.$L]},v.locale=function(e,t){if(!e)return this.$L;var n=this.clone(),r=_(e,t,!0);return r&&(n.$L=r),n},v.clone=function(){return b.w(this.$d,this)},v.toDate=function(){return new Date(this.valueOf())},v.toJSON=function(){return this.isValid()?this.toISOString():null},v.toISOString=function(){return this.$d.toISOString()},v.toString=function(){return this.$d.toUTCString()},m}(),x=A.prototype;return w.prototype=x,[["$ms",r],["$s",i],["$m",o],["$H",s],["$W",a],["$M",c],["$y",f],["$D",d]].forEach((function(e){x[e[1]]=function(t){return this.$g(t,e[0],e[1])}})),w.extend=function(e,t){return e.$i||(e(t,A,w),e.$i=!0),w},w.locale=_,w.isDayjs=$,w.unix=function(e){return w(1e3*e)},w.en=C[E],w.Ls=C,w.p={},w}();const dayjs=dayjs_min.exports;var utc$1={exports:{}};!function(e,t){var n,r,i;e.exports=(n="minute",r=/[+-]\d\d(?::?\d\d)?/g,i=/([+-]|\d\d)/g,function(e,t,o){var s=t.prototype;o.utc=function(e){return new t({date:e,utc:!0,args:arguments})},s.utc=function(e){var t=o(this.toDate(),{locale:this.$L,utc:!0});return e?t.add(this.utcOffset(),n):t},s.local=function(){return o(this.toDate(),{locale:this.$L,utc:!1})};var a=s.parse;s.parse=function(e){e.utc&&(this.$u=!0),this.$utils().u(e.$offset)||(this.$offset=e.$offset),a.call(this,e)};var u=s.init;s.init=function(){if(this.$u){var e=this.$d;this.$y=e.getUTCFullYear(),this.$M=e.getUTCMonth(),this.$D=e.getUTCDate(),this.$W=e.getUTCDay(),this.$H=e.getUTCHours(),this.$m=e.getUTCMinutes(),this.$s=e.getUTCSeconds(),this.$ms=e.getUTCMilliseconds()}else u.call(this)};var c=s.utcOffset;s.utcOffset=function(e,t){var o=this.$utils().u;if(o(e))return this.$u?0:o(this.$offset)?c.call(this):this.$offset;if("string"==typeof e&&(e=function(e){void 0===e&&(e="");var t=e.match(r);if(!t)return null;var n=(""+t[0]).match(i)||["-",0,0],o=n[0],s=60*+n[1]+ +n[2];return 0===s?0:"+"===o?s:-s}(e),null===e))return this;var s=Math.abs(e)<=16?60*e:e,a=this;if(t)return a.$offset=s,a.$u=0===e,a;if(0!==e){var u=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(a=this.local().add(s+u,n)).$offset=s,a.$x.$localOffset=u}else a=this.utc();return a};var l=s.format;s.format=function(e){var t=e||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return l.call(this,t)},s.valueOf=function(){var e=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*e},s.isUTC=function(){return!!this.$u},s.toISOString=function(){return this.toDate().toISOString()},s.toString=function(){return this.toDate().toUTCString()};var f=s.toDate;s.toDate=function(e){return"s"===e&&this.$offset?o(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():f.call(this)};var d=s.diff;s.diff=function(e,t,n){if(e&&this.$u===e.$u)return d.call(this,e,t,n);var r=this.local(),i=o(e).local();return d.call(r,i,t,n)}})}(utc$1);const utc=utc$1.exports;dayjs.extend(utc);const toLine=(e="")=>e.replace(/\B([A-Z])/g,"-$1").toLowerCase(),filterXSS=e=>e.replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;"),getUrlParam=(e,t)=>{const n=t||location.href,r=new RegExp(`[?&#]${e}=([^&#]+)`,"gi"),i=n.match(r);let o;return i&&i.length>0?(o=i[i.length-1].split("="),o&&o.length>1?filterXSS(o[1]):""):""},_sfc_main$8=Vue.defineComponent({name:"magic-ui-component",props:{config:{type:Object,default:()=>({})}},setup(e){var t;const n=null===(t=Vue.getCurrentInstance())||void 0===t?void 0:t.proxy,r=Vue.inject("app");return Vue.provide("hoc",n),{tagName:Vue.computed((()=>`magic-ui-${toLine(e.config.type)}`)),style:Vue.computed((()=>null==r?void 0:r.transformStyle(e.config.style))),display:()=>{var t;const n=null===(t=e.config)||void 0===t?void 0:t.display;return"function"==typeof n?n(r):!1!==n}}}}),_export_sfc=(e,t)=>{const n=e.__vccOpts||e;for(const[r,i]of t)n[r]=i;return n};function _sfc_render$7(e,t,n,r,i,o){return e.display()?(Vue.openBlock(),Vue.createBlock(Vue.resolveDynamicComponent(e.tagName),{key:0,id:e.config.id,class:Vue.normalizeClass("magic-ui-component"+(e.config.className?` ${e.config.className}`:"")),style:Vue.normalizeStyle(e.style),config:e.config},null,8,["id","class","style","config"])):Vue.createCommentVNode("v-if",!0)}const Component=_export_sfc(_sfc_main$8,[["render",_sfc_render$7],["__file","/data/magic/tmagic-editor/packages/ui/src/Component.vue"]]),useApp=e=>{var t,n;const r=Vue.inject("app"),i=null==r||null===(t=r.page)||void 0===t?void 0:t.getNode(e.config.id),o=null===(n=Vue.getCurrentInstance())||void 0===n?void 0:n.proxy;return null==i||i.emit("created",o),Vue.onMounted((()=>{null==i||i.emit("mounted",o)})),Vue.onUnmounted((()=>{null==i||i.emit("destroy",o)})),r},_sfc_main$7=Vue.defineComponent({name:"magic-ui-page",components:{"magic-ui-component":Component},props:{config:{type:Object,default:()=>({})}},setup(e){const t=useApp(e);return{style:Vue.computed((()=>null==t?void 0:t.transformStyle(e.config.style||{}))),refresh(){window.location.reload()}}}}),_hoisted_1$3=["id"];function _sfc_render$6(e,t,n,r,i,o){const s=Vue.resolveComponent("magic-ui-component");return Vue.openBlock(),Vue.createElementBlock("div",{id:`${e.config.id||""}`,class:Vue.normalizeClass("magic-ui-page magic-ui-container"+(e.config.className?` ${e.config.className}`:"")),style:Vue.normalizeStyle(e.style)},[Vue.renderSlot(e.$slots,"default"),(Vue.openBlock(!0),Vue.createElementBlock(Vue.Fragment,null,Vue.renderList(e.config.items,(e=>(Vue.openBlock(),Vue.createBlock(s,{key:e.id,config:e},null,8,["config"])))),128))],14,_hoisted_1$3)}const page=_export_sfc(_sfc_main$7,[["render",_sfc_render$6],["__file","/data/magic/tmagic-editor/packages/ui/src/page/src/index.vue"]]),useCommonMethod=e=>({show:()=>{e.config.style.display="initial"},hide:()=>{e.config.style.display="none"}}),_sfc_main$6=Vue.defineComponent({name:"magic-ui-container",components:{"magic-ui-component":Component},props:{config:{type:Object,default:()=>({})}},setup(e){const t=useApp(e);return{style:Vue.computed((()=>null==t?void 0:t.transformStyle(e.config.style||{}))),display:()=>{var n;const r=null===(n=e.config)||void 0===n?void 0:n.display;return"function"==typeof r?r(t):!1!==r},...useCommonMethod(e)}}}),_hoisted_1$2=["id"];function _sfc_render$5(e,t,n,r,i,o){const s=Vue.resolveComponent("magic-ui-component");return e.display()?(Vue.openBlock(),Vue.createElementBlock("div",{key:0,id:`${e.config.id||""}`,class:Vue.normalizeClass("magic-ui-container"+(e.config.className?` ${e.config.className}`:"")),style:Vue.normalizeStyle(e.style)},[Vue.renderSlot(e.$slots,"default"),(Vue.openBlock(!0),Vue.createElementBlock(Vue.Fragment,null,Vue.renderList(e.config.items,(e=>(Vue.openBlock(),Vue.createBlock(s,{key:e.id,config:e},null,8,["config"])))),128))],14,_hoisted_1$2)):Vue.createCommentVNode("v-if",!0)}const container=_export_sfc(_sfc_main$6,[["render",_sfc_render$5],["__file","/data/magic/tmagic-editor/packages/ui/src/container/src/Container.vue"]]),_sfc_main$5=Vue.defineComponent({name:"magic-ui-button",props:{config:{type:Object,default:()=>({})},model:{type:Object,default:()=>({})}},setup(e){var t;useApp(e);const n=null===(t=Vue.getCurrentInstance())||void 0===t?void 0:t.proxy,r=Vue.reactive([]),i=Vue.computed((()=>["function"==typeof e.config.preAction?e.config.preAction:()=>!0,...r,"function"==typeof e.config.postAction?e.config.postAction:()=>!0]));return{pushAction:function(e){r.push(e)},clickHandler:async function(){for(const t of i.value)if("function"==typeof t){if(!1===await t(n,{model:e.model}))break}},textConfig:Vue.computed((()=>{var t,n,r;return{type:"text",text:(null===(t=e.config)||void 0===t?void 0:t.text)||"",disabledText:(null===(n=e.config)||void 0===n?void 0:n.disabledText)||"",html:(null===(r=e.config)||void 0===r?void 0:r.html)||""}}))}}});function _sfc_render$4(e,t,n,r,i,o){const s=Vue.resolveComponent("magic-ui-text");return Vue.openBlock(),Vue.createElementBlock("button",{class:"magic-ui-button",onClick:t[0]||(t[0]=(...t)=>e.clickHandler&&e.clickHandler(...t))},[Vue.renderSlot(e.$slots,"default",{},(()=>[Vue.createVNode(s,{config:e.textConfig},null,8,["config"])]))])}const button=_export_sfc(_sfc_main$5,[["render",_sfc_render$4],["__file","/data/magic/tmagic-editor/packages/ui/src/button/src/index.vue"]]),_sfc_main$4=Vue.defineComponent({name:"magic-ui-text",props:{config:{type:Object,default:()=>({})},model:{type:Object,default:()=>({})},vars:{type:Object,default:()=>({})}},setup(e){var t;useApp(e);const n=null===(t=Vue.getCurrentInstance())||void 0===t?void 0:t.proxy,r=Vue.inject("hoc"),i=Vue.computed((()=>{var t,i;let o=(null===(t=e.config)||void 0===t?void 0:t.text)||"";const{vars:s}=e;if(null!=r&&r.disabled&&null!==(i=e.config)&&void 0!==i&&i.disabledText&&(o=e.config.disabledText),"function"==typeof o)return o.bind(n)(n,{model:e.model});if("[object Object]"===Object.prototype.toString.call(s)){let e=o;return Object.entries(s).forEach((([t,n])=>{e=e.replace(new RegExp(`{{${t}}}`,"g"),n)})),e}return o||""}));return{displayText:i}},render(){var e,t;const n=null!==(e=this.config)&&void 0!==e&&e.multiple?"magic-ui-text":"magic-ui-text magic-ui-text--single-line";var r,i;return"function"==typeof(null===(t=this.$slots)||void 0===t?void 0:t.default)?Vue.h("span",{class:n},[(null===(r=this.$slots)||void 0===r||null===(i=r.default)||void 0===i?void 0:i.call(r))||""]):Vue.h("span",{class:n,...this.displayText?{innerHTML:this.displayText}:{}})}}),text=_export_sfc(_sfc_main$4,[["__file","/data/magic/tmagic-editor/packages/ui/src/text/src/index.vue"]]),_sfc_main$3=Vue.defineComponent({name:"magic-ui-img",props:{config:{type:Object,default:()=>({})},model:{type:Object,default:()=>({})}},setup:e=>(useApp(e),{clickHandler(){e.config.url&&(window.location.href=e.config.url)}})}),_hoisted_1$1=["src"];function _sfc_render$3(e,t,n,r,i,o){return Vue.openBlock(),Vue.createElementBlock("img",{class:"magic-ui-img",src:e.config.src,onClick:t[0]||(t[0]=(...t)=>e.clickHandler&&e.clickHandler(...t))},null,8,_hoisted_1$1)}const img=_export_sfc(_sfc_main$3,[["render",_sfc_render$3],["__file","/data/magic/tmagic-editor/packages/ui/src/img/src/index.vue"]]);var browser={},canPromise$1=function(){return"function"==typeof Promise&&Promise.prototype&&Promise.prototype.then},qrcode$1={},utils$a={};let toSJISFunction;const CODEWORDS_COUNT=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];utils$a.getSymbolSize=function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return 4*e+17},utils$a.getSymbolTotalCodewords=function(e){return CODEWORDS_COUNT[e]},utils$a.getBCHDigit=function(e){let t=0;for(;0!==e;)t++,e>>>=1;return t},utils$a.setToSJISFunction=function(e){if("function"!=typeof e)throw new Error('"toSJISFunc" is not a valid function.');toSJISFunction=e},utils$a.isKanjiModeEnabled=function(){return void 0!==toSJISFunction},utils$a.toSJIS=function(e){return toSJISFunction(e)};var errorCorrectionLevel={},exports;function BitBuffer$1(){this.buffer=[],this.length=0}exports=errorCorrectionLevel,exports.L={bit:1},exports.M={bit:0},exports.Q={bit:3},exports.H={bit:2},exports.isValid=function(e){return e&&void 0!==e.bit&&e.bit>=0&&e.bit<4},exports.from=function(e,t){if(exports.isValid(e))return e;try{return function(e){if("string"!=typeof e)throw new Error("Param is not a string");switch(e.toLowerCase()){case"l":case"low":return exports.L;case"m":case"medium":return exports.M;case"q":case"quartile":return exports.Q;case"h":case"high":return exports.H;default:throw new Error("Unknown EC Level: "+e)}}(e)}catch(n){return t}},BitBuffer$1.prototype={get:function(e){const t=Math.floor(e/8);return 1==(this.buffer[t]>>>7-e%8&1)},put:function(e,t){for(let n=0;n<t;n++)this.putBit(1==(e>>>t-n-1&1))},getLengthInBits:function(){return this.length},putBit:function(e){const t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}};var bitBuffer=BitBuffer$1;function BitMatrix$1(e){if(!e||e<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}BitMatrix$1.prototype.set=function(e,t,n,r){const i=e*this.size+t;this.data[i]=n,r&&(this.reservedBit[i]=!0)},BitMatrix$1.prototype.get=function(e,t){return this.data[e*this.size+t]},BitMatrix$1.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n},BitMatrix$1.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]};var bitMatrix=BitMatrix$1,alignmentPattern={};!function(e){const t=utils$a.getSymbolSize;e.getRowColCoords=function(e){if(1===e)return[];const n=Math.floor(e/7)+2,r=t(e),i=145===r?26:2*Math.ceil((r-13)/(2*n-2)),o=[r-7];for(let t=1;t<n-1;t++)o[t]=o[t-1]-i;return o.push(6),o.reverse()},e.getPositions=function(t){const n=[],r=e.getRowColCoords(t),i=r.length;for(let e=0;e<i;e++)for(let t=0;t<i;t++)0===e&&0===t||0===e&&t===i-1||e===i-1&&0===t||n.push([r[e],r[t]]);return n}}(alignmentPattern);var finderPattern={};const getSymbolSize=utils$a.getSymbolSize,FINDER_PATTERN_SIZE=7;finderPattern.getPositions=function(e){const t=getSymbolSize(e);return[[0,0],[t-FINDER_PATTERN_SIZE,0],[0,t-FINDER_PATTERN_SIZE]]};var maskPattern={};!function(e){e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const t=3,n=3,r=40,i=10;function o(t,n,r){switch(t){case e.Patterns.PATTERN000:return(n+r)%2==0;case e.Patterns.PATTERN001:return n%2==0;case e.Patterns.PATTERN010:return r%3==0;case e.Patterns.PATTERN011:return(n+r)%3==0;case e.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2==0;case e.Patterns.PATTERN101:return n*r%2+n*r%3==0;case e.Patterns.PATTERN110:return(n*r%2+n*r%3)%2==0;case e.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2==0;default:throw new Error("bad maskPattern:"+t)}}e.isValid=function(e){return null!=e&&""!==e&&!isNaN(e)&&e>=0&&e<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(e){const n=e.size;let r=0,i=0,o=0,s=null,a=null;for(let u=0;u<n;u++){i=o=0,s=a=null;for(let c=0;c<n;c++){let n=e.get(u,c);n===s?i++:(i>=5&&(r+=t+(i-5)),s=n,i=1),n=e.get(c,u),n===a?o++:(o>=5&&(r+=t+(o-5)),a=n,o=1)}i>=5&&(r+=t+(i-5)),o>=5&&(r+=t+(o-5))}return r},e.getPenaltyN2=function(e){const t=e.size;let r=0;for(let n=0;n<t-1;n++)for(let i=0;i<t-1;i++){const t=e.get(n,i)+e.get(n,i+1)+e.get(n+1,i)+e.get(n+1,i+1);4!==t&&0!==t||r++}return r*n},e.getPenaltyN3=function(e){const t=e.size;let n=0,i=0,o=0;for(let r=0;r<t;r++){i=o=0;for(let s=0;s<t;s++)i=i<<1&2047|e.get(r,s),s>=10&&(1488===i||93===i)&&n++,o=o<<1&2047|e.get(s,r),s>=10&&(1488===o||93===o)&&n++}return n*r},e.getPenaltyN4=function(e){let t=0;const n=e.data.length;for(let r=0;r<n;r++)t+=e.data[r];return Math.abs(Math.ceil(100*t/n/5)-10)*i},e.applyMask=function(e,t){const n=t.size;for(let r=0;r<n;r++)for(let i=0;i<n;i++)t.isReserved(i,r)||t.xor(i,r,o(e,i,r))},e.getBestMask=function(t,n){const r=Object.keys(e.Patterns).length;let i=0,o=1/0;for(let s=0;s<r;s++){n(s),e.applyMask(s,t);const r=e.getPenaltyN1(t)+e.getPenaltyN2(t)+e.getPenaltyN3(t)+e.getPenaltyN4(t);e.applyMask(s,t),r<o&&(o=r,i=s)}return i}}(maskPattern);var errorCorrectionCode={};const ECLevel$1=errorCorrectionLevel,EC_BLOCKS_TABLE=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],EC_CODEWORDS_TABLE=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];errorCorrectionCode.getBlocksCount=function(e,t){switch(t){case ECLevel$1.L:return EC_BLOCKS_TABLE[4*(e-1)+0];case ECLevel$1.M:return EC_BLOCKS_TABLE[4*(e-1)+1];case ECLevel$1.Q:return EC_BLOCKS_TABLE[4*(e-1)+2];case ECLevel$1.H:return EC_BLOCKS_TABLE[4*(e-1)+3];default:return}},errorCorrectionCode.getTotalCodewordsCount=function(e,t){switch(t){case ECLevel$1.L:return EC_CODEWORDS_TABLE[4*(e-1)+0];case ECLevel$1.M:return EC_CODEWORDS_TABLE[4*(e-1)+1];case ECLevel$1.Q:return EC_CODEWORDS_TABLE[4*(e-1)+2];case ECLevel$1.H:return EC_CODEWORDS_TABLE[4*(e-1)+3];default:return}};var polynomial={},galoisField={};const EXP_TABLE=new Uint8Array(512),LOG_TABLE=new Uint8Array(256);!function(){let e=1;for(let t=0;t<255;t++)EXP_TABLE[t]=e,LOG_TABLE[e]=t,e<<=1,256&e&&(e^=285);for(let t=255;t<512;t++)EXP_TABLE[t]=EXP_TABLE[t-255]}(),galoisField.log=function(e){if(e<1)throw new Error("log("+e+")");return LOG_TABLE[e]},galoisField.exp=function(e){return EXP_TABLE[e]},galoisField.mul=function(e,t){return 0===e||0===t?0:EXP_TABLE[LOG_TABLE[e]+LOG_TABLE[t]]},function(e){const t=galoisField;e.mul=function(e,n){const r=new Uint8Array(e.length+n.length-1);for(let i=0;i<e.length;i++)for(let o=0;o<n.length;o++)r[i+o]^=t.mul(e[i],n[o]);return r},e.mod=function(e,n){let r=new Uint8Array(e);for(;r.length-n.length>=0;){const e=r[0];for(let o=0;o<n.length;o++)r[o]^=t.mul(n[o],e);let i=0;for(;i<r.length&&0===r[i];)i++;r=r.slice(i)}return r},e.generateECPolynomial=function(n){let r=new Uint8Array([1]);for(let i=0;i<n;i++)r=e.mul(r,new Uint8Array([1,t.exp(i)]));return r}}(polynomial);const Polynomial=polynomial;function ReedSolomonEncoder$1(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}ReedSolomonEncoder$1.prototype.initialize=function(e){this.degree=e,this.genPoly=Polynomial.generateECPolynomial(this.degree)},ReedSolomonEncoder$1.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");const t=new Uint8Array(e.length+this.degree);t.set(e);const n=Polynomial.mod(t,this.genPoly),r=this.degree-n.length;if(r>0){const e=new Uint8Array(this.degree);return e.set(n,r),e}return n};var reedSolomonEncoder=ReedSolomonEncoder$1,version={},mode={},versionCheck={isValid:function(e){return!isNaN(e)&&e>=1&&e<=40}},regex={};const numeric="[0-9]+",alphanumeric="[A-Z $%*+\\-./:]+";let kanji="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";kanji=kanji.replace(/u/g,"\\u");const byte="(?:(?![A-Z0-9 $%*+\\-./:]|"+kanji+")(?:.|[\r\n]))+";regex.KANJI=new RegExp(kanji,"g"),regex.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),regex.BYTE=new RegExp(byte,"g"),regex.NUMERIC=new RegExp(numeric,"g"),regex.ALPHANUMERIC=new RegExp(alphanumeric,"g");const TEST_KANJI=new RegExp("^"+kanji+"$"),TEST_NUMERIC=new RegExp("^"+numeric+"$"),TEST_ALPHANUMERIC=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");regex.testKanji=function(e){return TEST_KANJI.test(e)},regex.testNumeric=function(e){return TEST_NUMERIC.test(e)},regex.testAlphanumeric=function(e){return TEST_ALPHANUMERIC.test(e)},function(e){const t=versionCheck,n=regex;e.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(e,n){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!t.isValid(n))throw new Error("Invalid version: "+n);return n>=1&&n<10?e.ccBits[0]:n<27?e.ccBits[1]:e.ccBits[2]},e.getBestModeForData=function(t){return n.testNumeric(t)?e.NUMERIC:n.testAlphanumeric(t)?e.ALPHANUMERIC:n.testKanji(t)?e.KANJI:e.BYTE},e.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")},e.isValid=function(e){return e&&e.bit&&e.ccBits},e.from=function(t,n){if(e.isValid(t))return t;try{return function(t){if("string"!=typeof t)throw new Error("Param is not a string");switch(t.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+t)}}(t)}catch(r){return n}}}(mode),function(e){const t=utils$a,n=errorCorrectionCode,r=errorCorrectionLevel,i=mode,o=versionCheck,s=t.getBCHDigit(7973);function a(e,t){return i.getCharCountIndicator(e,t)+4}function u(e,t){let n=0;return e.forEach((function(e){const r=a(e.mode,t);n+=r+e.getBitsLength()})),n}e.from=function(e,t){return o.isValid(e)?parseInt(e,10):t},e.getCapacity=function(e,r,s){if(!o.isValid(e))throw new Error("Invalid QR Code version");void 0===s&&(s=i.BYTE);const u=8*(t.getSymbolTotalCodewords(e)-n.getTotalCodewordsCount(e,r));if(s===i.MIXED)return u;const c=u-a(s,e);switch(s){case i.NUMERIC:return Math.floor(c/10*3);case i.ALPHANUMERIC:return Math.floor(c/11*2);case i.KANJI:return Math.floor(c/13);case i.BYTE:default:return Math.floor(c/8)}},e.getBestVersionForData=function(t,n){let o;const s=r.from(n,r.M);if(Array.isArray(t)){if(t.length>1)return function(t,n){for(let r=1;r<=40;r++)if(u(t,r)<=e.getCapacity(r,n,i.MIXED))return r}(t,s);if(0===t.length)return 1;o=t[0]}else o=t;return function(t,n,r){for(let i=1;i<=40;i++)if(n<=e.getCapacity(i,r,t))return i}(o.mode,o.getLength(),s)},e.getEncodedBits=function(e){if(!o.isValid(e)||e<7)throw new Error("Invalid QR Code version");let n=e<<12;for(;t.getBCHDigit(n)-s>=0;)n^=7973<<t.getBCHDigit(n)-s;return e<<12|n}}(version);var formatInfo={};const Utils$3=utils$a,G15=1335,G15_MASK=21522,G15_BCH=Utils$3.getBCHDigit(G15);formatInfo.getEncodedBits=function(e,t){const n=e.bit<<3|t;let r=n<<10;for(;Utils$3.getBCHDigit(r)-G15_BCH>=0;)r^=G15<<Utils$3.getBCHDigit(r)-G15_BCH;return(n<<10|r)^G15_MASK};var segments={};const Mode$4=mode;function NumericData(e){this.mode=Mode$4.NUMERIC,this.data=e.toString()}NumericData.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},NumericData.prototype.getLength=function(){return this.data.length},NumericData.prototype.getBitsLength=function(){return NumericData.getBitsLength(this.data.length)},NumericData.prototype.write=function(e){let t,n,r;for(t=0;t+3<=this.data.length;t+=3)n=this.data.substr(t,3),r=parseInt(n,10),e.put(r,10);const i=this.data.length-t;i>0&&(n=this.data.substr(t),r=parseInt(n,10),e.put(r,3*i+1))};var numericData=NumericData;const Mode$3=mode,ALPHA_NUM_CHARS=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function AlphanumericData(e){this.mode=Mode$3.ALPHANUMERIC,this.data=e}AlphanumericData.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},AlphanumericData.prototype.getLength=function(){return this.data.length},AlphanumericData.prototype.getBitsLength=function(){return AlphanumericData.getBitsLength(this.data.length)},AlphanumericData.prototype.write=function(e){let t;for(t=0;t+2<=this.data.length;t+=2){let n=45*ALPHA_NUM_CHARS.indexOf(this.data[t]);n+=ALPHA_NUM_CHARS.indexOf(this.data[t+1]),e.put(n,11)}this.data.length%2&&e.put(ALPHA_NUM_CHARS.indexOf(this.data[t]),6)};var alphanumericData=AlphanumericData,encodeUtf8$1=function(e){for(var t=[],n=e.length,r=0;r<n;r++){var i=e.charCodeAt(r);if(i>=55296&&i<=56319&&n>r+1){var o=e.charCodeAt(r+1);o>=56320&&o<=57343&&(i=1024*(i-55296)+o-56320+65536,r+=1)}i<128?t.push(i):i<2048?(t.push(i>>6|192),t.push(63&i|128)):i<55296||i>=57344&&i<65536?(t.push(i>>12|224),t.push(i>>6&63|128),t.push(63&i|128)):i>=65536&&i<=1114111?(t.push(i>>18|240),t.push(i>>12&63|128),t.push(i>>6&63|128),t.push(63&i|128)):t.push(239,191,189)}return new Uint8Array(t).buffer};const encodeUtf8=encodeUtf8$1,Mode$2=mode;function ByteData(e){this.mode=Mode$2.BYTE,this.data=new Uint8Array(encodeUtf8(e))}ByteData.getBitsLength=function(e){return 8*e},ByteData.prototype.getLength=function(){return this.data.length},ByteData.prototype.getBitsLength=function(){return ByteData.getBitsLength(this.data.length)},ByteData.prototype.write=function(e){for(let t=0,n=this.data.length;t<n;t++)e.put(this.data[t],8)};var byteData=ByteData;const Mode$1=mode,Utils$2=utils$a;function KanjiData(e){this.mode=Mode$1.KANJI,this.data=e}KanjiData.getBitsLength=function(e){return 13*e},KanjiData.prototype.getLength=function(){return this.data.length},KanjiData.prototype.getBitsLength=function(){return KanjiData.getBitsLength(this.data.length)},KanjiData.prototype.write=function(e){let t;for(t=0;t<this.data.length;t++){let n=Utils$2.toSJIS(this.data[t]);if(n>=33088&&n<=40956)n-=33088;else{if(!(n>=57408&&n<=60351))throw new Error("Invalid SJIS character: "+this.data[t]+"\nMake sure your charset is UTF-8");n-=49472}n=192*(n>>>8&255)+(255&n),e.put(n,13)}};var kanjiData=KanjiData,dijkstra={exports:{}};!function(e){var t={single_source_shortest_paths:function(e,n,r){var i={},o={};o[n]=0;var s,a,u,c,l,f,d,h=t.PriorityQueue.make();for(h.push(n,0);!h.empty();)for(u in a=(s=h.pop()).value,c=s.cost,l=e[a]||{})l.hasOwnProperty(u)&&(f=c+l[u],d=o[u],(void 0===o[u]||d>f)&&(o[u]=f,h.push(u,f),i[u]=a));if(void 0!==r&&void 0===o[r]){var p=["Could not find a path from ",n," to ",r,"."].join("");throw new Error(p)}return i},extract_shortest_path_from_predecessor_list:function(e,t){for(var n=[],r=t;r;)n.push(r),e[r],r=e[r];return n.reverse(),n},find_path:function(e,n,r){var i=t.single_source_shortest_paths(e,n,r);return t.extract_shortest_path_from_predecessor_list(i,r)},PriorityQueue:{make:function(e){var n,r=t.PriorityQueue,i={};for(n in e=e||{},r)r.hasOwnProperty(n)&&(i[n]=r[n]);return i.queue=[],i.sorter=e.sorter||r.default_sorter,i},default_sorter:function(e,t){return e.cost-t.cost},push:function(e,t){var n={value:e,cost:t};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return 0===this.queue.length}}};e.exports=t}(dijkstra),function(e){const t=mode,n=numericData,r=alphanumericData,i=byteData,o=kanjiData,s=regex,a=utils$a,u=dijkstra.exports;function c(e){return unescape(encodeURIComponent(e)).length}function l(e,t,n){const r=[];let i;for(;null!==(i=e.exec(n));)r.push({data:i[0],index:i.index,mode:t,length:i[0].length});return r}function f(e){const n=l(s.NUMERIC,t.NUMERIC,e),r=l(s.ALPHANUMERIC,t.ALPHANUMERIC,e);let i,o;a.isKanjiModeEnabled()?(i=l(s.BYTE,t.BYTE,e),o=l(s.KANJI,t.KANJI,e)):(i=l(s.BYTE_KANJI,t.BYTE,e),o=[]);return n.concat(r,i,o).sort((function(e,t){return e.index-t.index})).map((function(e){return{data:e.data,mode:e.mode,length:e.length}}))}function d(e,s){switch(s){case t.NUMERIC:return n.getBitsLength(e);case t.ALPHANUMERIC:return r.getBitsLength(e);case t.KANJI:return o.getBitsLength(e);case t.BYTE:return i.getBitsLength(e)}}function h(e,s){let u;const c=t.getBestModeForData(e);if(u=t.from(s,c),u!==t.BYTE&&u.bit<c.bit)throw new Error('"'+e+'" cannot be encoded with mode '+t.toString(u)+".\n Suggested mode is: "+t.toString(c));switch(u!==t.KANJI||a.isKanjiModeEnabled()||(u=t.BYTE),u){case t.NUMERIC:return new n(e);case t.ALPHANUMERIC:return new r(e);case t.KANJI:return new o(e);case t.BYTE:return new i(e)}}e.fromArray=function(e){return e.reduce((function(e,t){return"string"==typeof t?e.push(h(t,null)):t.data&&e.push(h(t.data,t.mode)),e}),[])},e.fromString=function(n,r){const i=function(e){const n=[];for(let r=0;r<e.length;r++){const i=e[r];switch(i.mode){case t.NUMERIC:n.push([i,{data:i.data,mode:t.ALPHANUMERIC,length:i.length},{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.ALPHANUMERIC:n.push([i,{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.KANJI:n.push([i,{data:i.data,mode:t.BYTE,length:c(i.data)}]);break;case t.BYTE:n.push([{data:i.data,mode:t.BYTE,length:c(i.data)}])}}return n}(f(n,a.isKanjiModeEnabled())),o=function(e,n){const r={},i={start:{}};let o=["start"];for(let s=0;s<e.length;s++){const a=e[s],u=[];for(let e=0;e<a.length;e++){const c=a[e],l=""+s+e;u.push(l),r[l]={node:c,lastCount:0},i[l]={};for(let e=0;e<o.length;e++){const s=o[e];r[s]&&r[s].node.mode===c.mode?(i[s][l]=d(r[s].lastCount+c.length,c.mode)-d(r[s].lastCount,c.mode),r[s].lastCount+=c.length):(r[s]&&(r[s].lastCount=c.length),i[s][l]=d(c.length,c.mode)+4+t.getCharCountIndicator(c.mode,n))}}o=u}for(let t=0;t<o.length;t++)i[o[t]].end=0;return{map:i,table:r}}(i,r),s=u.find_path(o.map,"start","end"),l=[];for(let e=1;e<s.length-1;e++)l.push(o.table[s[e]].node);return e.fromArray(function(e){return e.reduce((function(e,t){const n=e.length-1>=0?e[e.length-1]:null;return n&&n.mode===t.mode?(e[e.length-1].data+=t.data,e):(e.push(t),e)}),[])}(l))},e.rawSplit=function(t){return e.fromArray(f(t,a.isKanjiModeEnabled()))}}(segments);const Utils$1=utils$a,ECLevel=errorCorrectionLevel,BitBuffer=bitBuffer,BitMatrix=bitMatrix,AlignmentPattern=alignmentPattern,FinderPattern=finderPattern,MaskPattern=maskPattern,ECCode=errorCorrectionCode,ReedSolomonEncoder=reedSolomonEncoder,Version=version,FormatInfo=formatInfo,Mode=mode,Segments=segments;function setupFinderPattern(e,t){const n=e.size,r=FinderPattern.getPositions(t);for(let i=0;i<r.length;i++){const t=r[i][0],o=r[i][1];for(let r=-1;r<=7;r++)if(!(t+r<=-1||n<=t+r))for(let i=-1;i<=7;i++)o+i<=-1||n<=o+i||(r>=0&&r<=6&&(0===i||6===i)||i>=0&&i<=6&&(0===r||6===r)||r>=2&&r<=4&&i>=2&&i<=4?e.set(t+r,o+i,!0,!0):e.set(t+r,o+i,!1,!0))}}function setupTimingPattern(e){const t=e.size;for(let n=8;n<t-8;n++){const t=n%2==0;e.set(n,6,t,!0),e.set(6,n,t,!0)}}function setupAlignmentPattern(e,t){const n=AlignmentPattern.getPositions(t);for(let r=0;r<n.length;r++){const t=n[r][0],i=n[r][1];for(let n=-2;n<=2;n++)for(let r=-2;r<=2;r++)-2===n||2===n||-2===r||2===r||0===n&&0===r?e.set(t+n,i+r,!0,!0):e.set(t+n,i+r,!1,!0)}}function setupVersionInfo(e,t){const n=e.size,r=Version.getEncodedBits(t);let i,o,s;for(let a=0;a<18;a++)i=Math.floor(a/3),o=a%3+n-8-3,s=1==(r>>a&1),e.set(i,o,s,!0),e.set(o,i,s,!0)}function setupFormatInfo(e,t,n){const r=e.size,i=FormatInfo.getEncodedBits(t,n);let o,s;for(o=0;o<15;o++)s=1==(i>>o&1),o<6?e.set(o,8,s,!0):o<8?e.set(o+1,8,s,!0):e.set(r-15+o,8,s,!0),o<8?e.set(8,r-o-1,s,!0):o<9?e.set(8,15-o-1+1,s,!0):e.set(8,15-o-1,s,!0);e.set(r-8,8,1,!0)}function setupData(e,t){const n=e.size;let r=-1,i=n-1,o=7,s=0;for(let a=n-1;a>0;a-=2)for(6===a&&a--;;){for(let n=0;n<2;n++)if(!e.isReserved(i,a-n)){let r=!1;s<t.length&&(r=1==(t[s]>>>o&1)),e.set(i,a-n,r),o--,-1===o&&(s++,o=7)}if(i+=r,i<0||n<=i){i-=r,r=-r;break}}}function createData(e,t,n){const r=new BitBuffer;n.forEach((function(t){r.put(t.mode.bit,4),r.put(t.getLength(),Mode.getCharCountIndicator(t.mode,e)),t.write(r)}));const i=8*(Utils$1.getSymbolTotalCodewords(e)-ECCode.getTotalCodewordsCount(e,t));for(r.getLengthInBits()+4<=i&&r.put(0,4);r.getLengthInBits()%8!=0;)r.putBit(0);const o=(i-r.getLengthInBits())/8;for(let s=0;s<o;s++)r.put(s%2?17:236,8);return createCodewords(r,e,t)}function createCodewords(e,t,n){const r=Utils$1.getSymbolTotalCodewords(t),i=r-ECCode.getTotalCodewordsCount(t,n),o=ECCode.getBlocksCount(t,n),s=o-r%o,a=Math.floor(r/o),u=Math.floor(i/o),c=u+1,l=a-u,f=new ReedSolomonEncoder(l);let d=0;const h=new Array(o),p=new Array(o);let g=0;const m=new Uint8Array(e.buffer);for(let $=0;$<o;$++){const e=$<s?u:c;h[$]=m.slice(d,d+e),p[$]=f.encode(h[$]),d+=e,g=Math.max(g,e)}const v=new Uint8Array(r);let y,E,C=0;for(y=0;y<g;y++)for(E=0;E<o;E++)y<h[E].length&&(v[C++]=h[E][y]);for(y=0;y<l;y++)for(E=0;E<o;E++)v[C++]=p[E][y];return v}function createSymbol(e,t,n,r){let i;if(Array.isArray(e))i=Segments.fromArray(e);else{if("string"!=typeof e)throw new Error("Invalid data");{let r=t;if(!r){const t=Segments.rawSplit(e);r=Version.getBestVersionForData(t,n)}i=Segments.fromString(e,r||40)}}const o=Version.getBestVersionForData(i,n);if(!o)throw new Error("The amount of data is too big to be stored in a QR Code");if(t){if(t<o)throw new Error("\nThe chosen QR Code version cannot contain this amount of data.\nMinimum version required to store current data is: "+o+".\n")}else t=o;const s=createData(t,n,i),a=Utils$1.getSymbolSize(t),u=new BitMatrix(a);return setupFinderPattern(u,t),setupTimingPattern(u),setupAlignmentPattern(u,t),setupFormatInfo(u,n,0),t>=7&&setupVersionInfo(u,t),setupData(u,s),isNaN(r)&&(r=MaskPattern.getBestMask(u,setupFormatInfo.bind(null,u,n))),MaskPattern.applyMask(r,u),setupFormatInfo(u,n,r),{modules:u,version:t,errorCorrectionLevel:n,maskPattern:r,segments:i}}qrcode$1.create=function(e,t){if(void 0===e||""===e)throw new Error("No input text");let n,r,i=ECLevel.M;return void 0!==t&&(i=ECLevel.from(t.errorCorrectionLevel,ECLevel.M),n=Version.from(t.version),r=MaskPattern.from(t.maskPattern),t.toSJISFunc&&Utils$1.setToSJISFunction(t.toSJISFunc)),createSymbol(e,n,i,r)};var canvas={},utils$9={};!function(e){function t(e){if("number"==typeof e&&(e=e.toString()),"string"!=typeof e)throw new Error("Color should be defined as hex string");let t=e.slice().replace("#","").split("");if(t.length<3||5===t.length||t.length>8)throw new Error("Invalid hex color: "+e);3!==t.length&&4!==t.length||(t=Array.prototype.concat.apply([],t.map((function(e){return[e,e]})))),6===t.length&&t.push("F","F");const n=parseInt(t.join(""),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:255&n,hex:"#"+t.slice(0,6).join("")}}e.getOptions=function(e){e||(e={}),e.color||(e.color={});const n=void 0===e.margin||null===e.margin||e.margin<0?4:e.margin,r=e.width&&e.width>=21?e.width:void 0,i=e.scale||4;return{width:r,scale:r?4:i,margin:n,color:{dark:t(e.color.dark||"#000000ff"),light:t(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}},e.getScale=function(e,t){return t.width&&t.width>=e+2*t.margin?t.width/(e+2*t.margin):t.scale},e.getImageWidth=function(t,n){const r=e.getScale(t,n);return Math.floor((t+2*n.margin)*r)},e.qrToImageData=function(t,n,r){const i=n.modules.size,o=n.modules.data,s=e.getScale(i,r),a=Math.floor((i+2*r.margin)*s),u=r.margin*s,c=[r.color.light,r.color.dark];for(let e=0;e<a;e++)for(let n=0;n<a;n++){let l=4*(e*a+n),f=r.color.light;if(e>=u&&n>=u&&e<a-u&&n<a-u){f=c[o[Math.floor((e-u)/s)*i+Math.floor((n-u)/s)]?1:0]}t[l++]=f.r,t[l++]=f.g,t[l++]=f.b,t[l]=f.a}}}(utils$9),function(e){const t=utils$9;e.render=function(e,n,r){let i=r,o=n;void 0!==i||n&&n.getContext||(i=n,n=void 0),n||(o=function(){try{return document.createElement("canvas")}catch(e){throw new Error("You need to specify a canvas element")}}()),i=t.getOptions(i);const s=t.getImageWidth(e.modules.size,i),a=o.getContext("2d"),u=a.createImageData(s,s);return t.qrToImageData(u.data,e,i),function(e,t,n){e.clearRect(0,0,t.width,t.height),t.style||(t.style={}),t.height=n,t.width=n,t.style.height=n+"px",t.style.width=n+"px"}(a,o,s),a.putImageData(u,0,0),o},e.renderToDataURL=function(t,n,r){let i=r;void 0!==i||n&&n.getContext||(i=n,n=void 0),i||(i={});const o=e.render(t,n,i),s=i.type||"image/png",a=i.rendererOpts||{};return o.toDataURL(s,a.quality)}}(canvas);var svgTag={};const Utils=utils$9;function getColorAttrib(e,t){const n=e.a/255,r=t+'="'+e.hex+'"';return n<1?r+" "+t+'-opacity="'+n.toFixed(2).slice(1)+'"':r}function svgCmd(e,t,n){let r=e+t;return void 0!==n&&(r+=" "+n),r}function qrToPath(e,t,n){let r="",i=0,o=!1,s=0;for(let a=0;a<e.length;a++){const u=Math.floor(a%t),c=Math.floor(a/t);u||o||(o=!0),e[a]?(s++,a>0&&u>0&&e[a-1]||(r+=o?svgCmd("M",u+n,.5+c+n):svgCmd("m",i,0),i=0,o=!1),u+1<t&&e[a+1]||(r+=svgCmd("h",s),s=0)):i++}return r}svgTag.render=function(e,t,n){const r=Utils.getOptions(t),i=e.modules.size,o=e.modules.data,s=i+2*r.margin,a=r.color.light.a?"<path "+getColorAttrib(r.color.light,"fill")+' d="M0 0h'+s+"v"+s+'H0z"/>':"",u="<path "+getColorAttrib(r.color.dark,"stroke")+' d="'+qrToPath(o,i,r.margin)+'"/>',c='viewBox="0 0 '+s+" "+s+'"',l='<svg xmlns="http://www.w3.org/2000/svg" '+(r.width?'width="'+r.width+'" height="'+r.width+'" ':"")+c+' shape-rendering="crispEdges">'+a+u+"</svg>\n";return"function"==typeof n&&n(null,l),l};const canPromise=canPromise$1,QRCode=qrcode$1,CanvasRenderer=canvas,SvgRenderer=svgTag;function renderCanvas(e,t,n,r,i){const o=[].slice.call(arguments,1),s=o.length,a="function"==typeof o[s-1];if(!a&&!canPromise())throw new Error("Callback required as last argument");if(!a){if(s<1)throw new Error("Too few arguments provided");return 1===s?(n=t,t=r=void 0):2!==s||t.getContext||(r=n,n=t,t=void 0),new Promise((function(i,o){try{const o=QRCode.create(n,r);i(e(o,t,r))}catch(s){o(s)}}))}if(s<2)throw new Error("Too few arguments provided");2===s?(i=n,n=t,t=r=void 0):3===s&&(t.getContext&&void 0===i?(i=r,r=void 0):(i=r,r=n,n=t,t=void 0));try{const o=QRCode.create(n,r);i(null,e(o,t,r))}catch(u){i(u)}}browser.create=QRCode.create,browser.toCanvas=renderCanvas.bind(null,CanvasRenderer.render),browser.toDataURL=renderCanvas.bind(null,CanvasRenderer.renderToDataURL),browser.toString=renderCanvas.bind(null,(function(e,t,n){return SvgRenderer.render(e,n)}));const _sfc_main$2=Vue.defineComponent({name:"magic-ui-qrcode",props:{config:{type:Object,default:()=>({})},model:{type:Object,default:()=>({})}},setup(e){useApp(e);const t=Vue.ref();return Vue.watch((()=>e.config.url),((e="")=>{browser.toDataURL(e,((e,n)=>{e&&console.error(e),t.value=n}))}),{immediate:!0}),{imgUrl:t}}}),_hoisted_1=["src"];function _sfc_render$2(e,t,n,r,i,o){return Vue.openBlock(),Vue.createElementBlock("img",{class:"magic-ui-qrcode",src:e.imgUrl},null,8,_hoisted_1)}const qrcode=_export_sfc(_sfc_main$2,[["render",_sfc_render$2],["__file","/data/magic/tmagic-editor/packages/ui/src/qrcode/src/index.vue"]]),_sfc_main$1=Vue.defineComponent({name:"magic-ui-overlay",props:{config:{type:Object,default:()=>({})},model:{type:Object,default:()=>({})}},setup(e){var t;const n=Vue.ref(!1),r=useApp(e),i=null==r||null===(t=r.page)||void 0===t?void 0:t.getNode(e.config.id),o=()=>{n.value=!0,r&&r.emit("overlay:open",i)},s=()=>{n.value=!1,r&&r.emit("overlay:close",i)};return null==r||r.on("editor:select",((t,n)=>{n.find((t=>t.id===e.config.id))?o():s()})),{visible:n,openOverlay:o,closeOverlay:s}}});function _sfc_render$1(e,t,n,r,i,o){const s=Vue.resolveComponent("magic-ui-container");return e.visible?(Vue.openBlock(),Vue.createBlock(s,{key:0,class:"magic-ui-overlay",config:{items:e.config.items}},{default:Vue.withCtx((()=>[Vue.renderSlot(e.$slots,"default")])),_:3},8,["config"])):Vue.createCommentVNode("v-if",!0)}const overlay=_export_sfc(_sfc_main$1,[["render",_sfc_render$1],["__file","/data/magic/tmagic-editor/packages/ui/src/overlay/src/index.vue"]]),components={page:page,container:container,button:button,text:text,img:img,qrcode:qrcode,overlay:overlay},plugins={};var axios$3={exports:{}},axios$2={exports:{}},bind$2=function(e,t){return function(){for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];return e.apply(t,n)}},bind$1=bind$2,toString=Object.prototype.toString;function isArray(e){return Array.isArray(e)}function isUndefined(e){return void 0===e}function isBuffer(e){return null!==e&&!isUndefined(e)&&null!==e.constructor&&!isUndefined(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}function isArrayBuffer(e){return"[object ArrayBuffer]"===toString.call(e)}function isFormData(e){return"[object FormData]"===toString.call(e)}function isArrayBufferView(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&isArrayBuffer(e.buffer)}function isString(e){return"string"==typeof e}function isNumber(e){return"number"==typeof e}function isObject(e){return null!==e&&"object"==typeof e}function isPlainObject(e){if("[object Object]"!==toString.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function isDate(e){return"[object Date]"===toString.call(e)}function isFile(e){return"[object File]"===toString.call(e)}function isBlob(e){return"[object Blob]"===toString.call(e)}function isFunction(e){return"[object Function]"===toString.call(e)}function isStream(e){return isObject(e)&&isFunction(e.pipe)}function isURLSearchParams(e){return"[object URLSearchParams]"===toString.call(e)}function trim(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function isStandardBrowserEnv(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)}function forEach(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),isArray(e))for(var n=0,r=e.length;n<r;n++)t.call(null,e[n],n,e);else for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.call(null,e[i],i,e)}function merge(){var e={};function t(t,n){isPlainObject(e[n])&&isPlainObject(t)?e[n]=merge(e[n],t):isPlainObject(t)?e[n]=merge({},t):isArray(t)?e[n]=t.slice():e[n]=t}for(var n=0,r=arguments.length;n<r;n++)forEach(arguments[n],t);return e}function extend(e,t,n){return forEach(t,(function(t,r){e[r]=n&&"function"==typeof t?bind$1(t,n):t})),e}function stripBOM(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e}var utils$8={isArray:isArray,isArrayBuffer:isArrayBuffer,isBuffer:isBuffer,isFormData:isFormData,isArrayBufferView:isArrayBufferView,isString:isString,isNumber:isNumber,isObject:isObject,isPlainObject:isPlainObject,isUndefined:isUndefined,isDate:isDate,isFile:isFile,isBlob:isBlob,isFunction:isFunction,isStream:isStream,isURLSearchParams:isURLSearchParams,isStandardBrowserEnv:isStandardBrowserEnv,forEach:forEach,merge:merge,extend:extend,trim:trim,stripBOM:stripBOM},utils$7=utils$8;function encode(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var buildURL$1=function(e,t,n){if(!t)return e;var r;if(n)r=n(t);else if(utils$7.isURLSearchParams(t))r=t.toString();else{var i=[];utils$7.forEach(t,(function(e,t){null!=e&&(utils$7.isArray(e)?t+="[]":e=[e],utils$7.forEach(e,(function(e){utils$7.isDate(e)?e=e.toISOString():utils$7.isObject(e)&&(e=JSON.stringify(e)),i.push(encode(t)+"="+encode(e))})))})),r=i.join("&")}if(r){var o=e.indexOf("#");-1!==o&&(e=e.slice(0,o)),e+=(-1===e.indexOf("?")?"?":"&")+r}return e},utils$6=utils$8;function InterceptorManager$1(){this.handlers=[]}InterceptorManager$1.prototype.use=function(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1},InterceptorManager$1.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},InterceptorManager$1.prototype.forEach=function(e){utils$6.forEach(this.handlers,(function(t){null!==t&&e(t)}))};var InterceptorManager_1=InterceptorManager$1,utils$5=utils$8,normalizeHeaderName=function(e,t){utils$5.forEach(e,(function(n,r){r!==t&&r.toUpperCase()===t.toUpperCase()&&(e[t]=n,delete e[r])}))},enhanceError=function(e,t,n,r,i){return e.config=t,n&&(e.code=n),e.request=r,e.response=i,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}},e},createError,hasRequiredCreateError,settle,hasRequiredSettle,cookies,hasRequiredCookies,isAbsoluteURL,hasRequiredIsAbsoluteURL,combineURLs,hasRequiredCombineURLs,buildFullPath,hasRequiredBuildFullPath,parseHeaders,hasRequiredParseHeaders,isURLSameOrigin,hasRequiredIsURLSameOrigin,Cancel_1,hasRequiredCancel,xhr,hasRequiredXhr,defaults_1,hasRequiredDefaults;function requireCreateError(){if(hasRequiredCreateError)return createError;hasRequiredCreateError=1;var e=enhanceError;return createError=function(t,n,r,i,o){var s=new Error(t);return e(s,n,r,i,o)},createError}function requireSettle(){if(hasRequiredSettle)return settle;hasRequiredSettle=1;var e=requireCreateError();return settle=function(t,n,r){var i=r.config.validateStatus;r.status&&i&&!i(r.status)?n(e("Request failed with status code "+r.status,r.config,null,r.request,r)):t(r)}}function requireCookies(){if(hasRequiredCookies)return cookies;hasRequiredCookies=1;var e=utils$8;return cookies=e.isStandardBrowserEnv()?{write:function(t,n,r,i,o,s){var a=[];a.push(t+"="+encodeURIComponent(n)),e.isNumber(r)&&a.push("expires="+new Date(r).toGMTString()),e.isString(i)&&a.push("path="+i),e.isString(o)&&a.push("domain="+o),!0===s&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}}function requireIsAbsoluteURL(){return hasRequiredIsAbsoluteURL?isAbsoluteURL:(hasRequiredIsAbsoluteURL=1,isAbsoluteURL=function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)})}function requireCombineURLs(){return hasRequiredCombineURLs?combineURLs:(hasRequiredCombineURLs=1,combineURLs=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e})}function requireBuildFullPath(){if(hasRequiredBuildFullPath)return buildFullPath;hasRequiredBuildFullPath=1;var e=requireIsAbsoluteURL(),t=requireCombineURLs();return buildFullPath=function(n,r){return n&&!e(r)?t(n,r):r}}function requireParseHeaders(){if(hasRequiredParseHeaders)return parseHeaders;hasRequiredParseHeaders=1;var e=utils$8,t=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];return parseHeaders=function(n){var r,i,o,s={};return n?(e.forEach(n.split("\n"),(function(n){if(o=n.indexOf(":"),r=e.trim(n.substr(0,o)).toLowerCase(),i=e.trim(n.substr(o+1)),r){if(s[r]&&t.indexOf(r)>=0)return;s[r]="set-cookie"===r?(s[r]?s[r]:[]).concat([i]):s[r]?s[r]+", "+i:i}})),s):s}}function requireIsURLSameOrigin(){if(hasRequiredIsURLSameOrigin)return isURLSameOrigin;hasRequiredIsURLSameOrigin=1;var e=utils$8;return isURLSameOrigin=e.isStandardBrowserEnv()?function(){var t,n=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function i(e){var t=e;return n&&(r.setAttribute("href",t),t=r.href),r.setAttribute("href",t),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}return t=i(window.location.href),function(n){var r=e.isString(n)?i(n):n;return r.protocol===t.protocol&&r.host===t.host}}():function(){return!0}}function requireCancel(){if(hasRequiredCancel)return Cancel_1;function e(e){this.message=e}return hasRequiredCancel=1,e.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},e.prototype.__CANCEL__=!0,Cancel_1=e}function requireXhr(){if(hasRequiredXhr)return xhr;hasRequiredXhr=1;var e=utils$8,t=requireSettle(),n=requireCookies(),r=buildURL$1,i=requireBuildFullPath(),o=requireParseHeaders(),s=requireIsURLSameOrigin(),a=requireCreateError(),u=requireDefaults(),c=requireCancel();return xhr=function(l){return new Promise((function(f,d){var h,p=l.data,g=l.headers,m=l.responseType;function v(){l.cancelToken&&l.cancelToken.unsubscribe(h),l.signal&&l.signal.removeEventListener("abort",h)}e.isFormData(p)&&delete g["Content-Type"];var y=new XMLHttpRequest;if(l.auth){var E=l.auth.username||"",C=l.auth.password?unescape(encodeURIComponent(l.auth.password)):"";g.Authorization="Basic "+btoa(E+":"+C)}var $=i(l.baseURL,l.url);function _(){if(y){var e="getAllResponseHeaders"in y?o(y.getAllResponseHeaders()):null,n={data:m&&"text"!==m&&"json"!==m?y.response:y.responseText,status:y.status,statusText:y.statusText,headers:e,config:l,request:y};t((function(e){f(e),v()}),(function(e){d(e),v()}),n),y=null}}if(y.open(l.method.toUpperCase(),r($,l.params,l.paramsSerializer),!0),y.timeout=l.timeout,"onloadend"in y?y.onloadend=_:y.onreadystatechange=function(){y&&4===y.readyState&&(0!==y.status||y.responseURL&&0===y.responseURL.indexOf("file:"))&&setTimeout(_)},y.onabort=function(){y&&(d(a("Request aborted",l,"ECONNABORTED",y)),y=null)},y.onerror=function(){d(a("Network Error",l,null,y)),y=null},y.ontimeout=function(){var e=l.timeout?"timeout of "+l.timeout+"ms exceeded":"timeout exceeded",t=l.transitional||u.transitional;l.timeoutErrorMessage&&(e=l.timeoutErrorMessage),d(a(e,l,t.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",y)),y=null},e.isStandardBrowserEnv()){var w=(l.withCredentials||s($))&&l.xsrfCookieName?n.read(l.xsrfCookieName):void 0;w&&(g[l.xsrfHeaderName]=w)}"setRequestHeader"in y&&e.forEach(g,(function(e,t){void 0===p&&"content-type"===t.toLowerCase()?delete g[t]:y.setRequestHeader(t,e)})),e.isUndefined(l.withCredentials)||(y.withCredentials=!!l.withCredentials),m&&"json"!==m&&(y.responseType=l.responseType),"function"==typeof l.onDownloadProgress&&y.addEventListener("progress",l.onDownloadProgress),"function"==typeof l.onUploadProgress&&y.upload&&y.upload.addEventListener("progress",l.onUploadProgress),(l.cancelToken||l.signal)&&(h=function(e){y&&(d(!e||e&&e.type?new c("canceled"):e),y.abort(),y=null)},l.cancelToken&&l.cancelToken.subscribe(h),l.signal&&(l.signal.aborted?h():l.signal.addEventListener("abort",h))),p||(p=null),y.send(p)}))},xhr}function requireDefaults(){if(hasRequiredDefaults)return defaults_1;hasRequiredDefaults=1;var e=utils$8,t=normalizeHeaderName,n=enhanceError,r={"Content-Type":"application/x-www-form-urlencoded"};function i(t,n){!e.isUndefined(t)&&e.isUndefined(t["Content-Type"])&&(t["Content-Type"]=n)}var o,s={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(o=requireXhr()),o),transformRequest:[function(n,r){return t(r,"Accept"),t(r,"Content-Type"),e.isFormData(n)||e.isArrayBuffer(n)||e.isBuffer(n)||e.isStream(n)||e.isFile(n)||e.isBlob(n)?n:e.isArrayBufferView(n)?n.buffer:e.isURLSearchParams(n)?(i(r,"application/x-www-form-urlencoded;charset=utf-8"),n.toString()):e.isObject(n)||r&&"application/json"===r["Content-Type"]?(i(r,"application/json"),function(t,n,r){if(e.isString(t))try{return(n||JSON.parse)(t),e.trim(t)}catch(i){if("SyntaxError"!==i.name)throw i}return(r||JSON.stringify)(t)}(n)):n}],transformResponse:[function(t){var r=this.transitional||s.transitional,i=r&&r.silentJSONParsing,o=r&&r.forcedJSONParsing,a=!i&&"json"===this.responseType;if(a||o&&e.isString(t)&&t.length)try{return JSON.parse(t)}catch(u){if(a){if("SyntaxError"===u.name)throw n(u,this,"E_JSON_PARSE");throw u}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};return e.forEach(["delete","get","head"],(function(e){s.headers[e]={}})),e.forEach(["post","put","patch"],(function(t){s.headers[t]=e.merge(r)})),defaults_1=s}var utils$4=utils$8,defaults$2=requireDefaults(),transformData$1=function(e,t,n){var r=this||defaults$2;return utils$4.forEach(n,(function(n){e=n.call(r,e,t)})),e},isCancel$1,hasRequiredIsCancel;function requireIsCancel(){return hasRequiredIsCancel?isCancel$1:(hasRequiredIsCancel=1,isCancel$1=function(e){return!(!e||!e.__CANCEL__)})}var utils$3=utils$8,transformData=transformData$1,isCancel=requireIsCancel(),defaults$1=requireDefaults(),Cancel=requireCancel();function throwIfCancellationRequested(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Cancel("canceled")}var dispatchRequest$1=function(e){return throwIfCancellationRequested(e),e.headers=e.headers||{},e.data=transformData.call(e,e.data,e.headers,e.transformRequest),e.headers=utils$3.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),utils$3.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||defaults$1.adapter)(e).then((function(t){return throwIfCancellationRequested(e),t.data=transformData.call(e,t.data,t.headers,e.transformResponse),t}),(function(t){return isCancel(t)||(throwIfCancellationRequested(e),t&&t.response&&(t.response.data=transformData.call(e,t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))},utils$2=utils$8,mergeConfig$2=function(e,t){t=t||{};var n={};function r(e,t){return utils$2.isPlainObject(e)&&utils$2.isPlainObject(t)?utils$2.merge(e,t):utils$2.isPlainObject(t)?utils$2.merge({},t):utils$2.isArray(t)?t.slice():t}function i(n){return utils$2.isUndefined(t[n])?utils$2.isUndefined(e[n])?void 0:r(void 0,e[n]):r(e[n],t[n])}function o(e){if(!utils$2.isUndefined(t[e]))return r(void 0,t[e])}function s(n){return utils$2.isUndefined(t[n])?utils$2.isUndefined(e[n])?void 0:r(void 0,e[n]):r(void 0,t[n])}function a(n){return n in t?r(e[n],t[n]):n in e?r(void 0,e[n]):void 0}var u={url:o,method:o,data:o,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a};return utils$2.forEach(Object.keys(e).concat(Object.keys(t)),(function(e){var t=u[e]||i,r=t(e);utils$2.isUndefined(r)&&t!==a||(n[e]=r)})),n},data,hasRequiredData;function requireData(){return hasRequiredData?data:(hasRequiredData=1,data={version:"0.25.0"})}var VERSION=requireData().version,validators$1={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){validators$1[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}}));var deprecatedWarnings={};function assertOptions(e,t,n){if("object"!=typeof e)throw new TypeError("options must be an object");for(var r=Object.keys(e),i=r.length;i-- >0;){var o=r[i],s=t[o];if(s){var a=e[o],u=void 0===a||s(a,o,e);if(!0!==u)throw new TypeError("option "+o+" must be "+u)}else if(!0!==n)throw Error("Unknown option "+o)}}validators$1.transitional=function(e,t,n){function r(e,t){return"[Axios v"+VERSION+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return function(n,i,o){if(!1===e)throw new Error(r(i," has been removed"+(t?" in "+t:"")));return t&&!deprecatedWarnings[i]&&(deprecatedWarnings[i]=!0,console.warn(r(i," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,i,o)}};var validator$1={assertOptions:assertOptions,validators:validators$1},utils$1=utils$8,buildURL=buildURL$1,InterceptorManager=InterceptorManager_1,dispatchRequest=dispatchRequest$1,mergeConfig$1=mergeConfig$2,validator=validator$1,validators=validator.validators;function Axios$1(e){this.defaults=e,this.interceptors={request:new InterceptorManager,response:new InterceptorManager}}Axios$1.prototype.request=function(e,t){if("string"==typeof e?(t=t||{}).url=e:t=e||{},!t.url)throw new Error("Provided config url is not valid");(t=mergeConfig$1(this.defaults,t)).method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var n=t.transitional;void 0!==n&&validator.assertOptions(n,{silentJSONParsing:validators.transitional(validators.boolean),forcedJSONParsing:validators.transitional(validators.boolean),clarifyTimeoutError:validators.transitional(validators.boolean)},!1);var r=[],i=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(i=i&&e.synchronous,r.unshift(e.fulfilled,e.rejected))}));var o,s=[];if(this.interceptors.response.forEach((function(e){s.push(e.fulfilled,e.rejected)})),!i){var a=[dispatchRequest,void 0];for(Array.prototype.unshift.apply(a,r),a=a.concat(s),o=Promise.resolve(t);a.length;)o=o.then(a.shift(),a.shift());return o}for(var u=t;r.length;){var c=r.shift(),l=r.shift();try{u=c(u)}catch(f){l(f);break}}try{o=dispatchRequest(u)}catch(f){return Promise.reject(f)}for(;s.length;)o=o.then(s.shift(),s.shift());return o},Axios$1.prototype.getUri=function(e){if(!e.url)throw new Error("Provided config url is not valid");return e=mergeConfig$1(this.defaults,e),buildURL(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},utils$1.forEach(["delete","get","head","options"],(function(e){Axios$1.prototype[e]=function(t,n){return this.request(mergeConfig$1(n||{},{method:e,url:t,data:(n||{}).data}))}})),utils$1.forEach(["post","put","patch"],(function(e){Axios$1.prototype[e]=function(t,n,r){return this.request(mergeConfig$1(r||{},{method:e,url:t,data:n}))}}));var Axios_1=Axios$1,CancelToken_1,hasRequiredCancelToken,spread,hasRequiredSpread,isAxiosError,hasRequiredIsAxiosError;function requireCancelToken(){if(hasRequiredCancelToken)return CancelToken_1;hasRequiredCancelToken=1;var e=requireCancel();function t(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");var n;this.promise=new Promise((function(e){n=e}));var r=this;this.promise.then((function(e){if(r._listeners){var t,n=r._listeners.length;for(t=0;t<n;t++)r._listeners[t](e);r._listeners=null}})),this.promise.then=function(e){var t,n=new Promise((function(e){r.subscribe(e),t=e})).then(e);return n.cancel=function(){r.unsubscribe(t)},n},t((function(t){r.reason||(r.reason=new e(t),n(r.reason))}))}return t.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},t.prototype.subscribe=function(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]},t.prototype.unsubscribe=function(e){if(this._listeners){var t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}},t.source=function(){var e;return{token:new t((function(t){e=t})),cancel:e}},CancelToken_1=t}function requireSpread(){return hasRequiredSpread?spread:(hasRequiredSpread=1,spread=function(e){return function(t){return e.apply(null,t)}})}function requireIsAxiosError(){if(hasRequiredIsAxiosError)return isAxiosError;hasRequiredIsAxiosError=1;var e=utils$8;return isAxiosError=function(t){return e.isObject(t)&&!0===t.isAxiosError}}var utils=utils$8,bind=bind$2,Axios=Axios_1,mergeConfig=mergeConfig$2,defaults=requireDefaults();function createInstance(e){var t=new Axios(e),n=bind(Axios.prototype.request,t);return utils.extend(n,Axios.prototype,t),utils.extend(n,t),n.create=function(t){return createInstance(mergeConfig(e,t))},n}var axios$1=createInstance(defaults);axios$1.Axios=Axios,axios$1.Cancel=requireCancel(),axios$1.CancelToken=requireCancelToken(),axios$1.isCancel=requireIsCancel(),axios$1.VERSION=requireData().version,axios$1.all=function(e){return Promise.all(e)},axios$1.spread=requireSpread(),axios$1.isAxiosError=requireIsAxiosError(),axios$2.exports=axios$1,axios$2.exports.default=axios$1,function(e){e.exports=axios$2.exports}(axios$3);const axios=getDefaultExportFromCjs(axios$3.exports),service=axios.create({withCredentials:!0,timeout:7e3}),requestHandler=function(e){return e},responseHandler=function(e){return e};service.interceptors.request.use(requestHandler),service.interceptors.response.use(responseHandler);const request={install(e){e.provide("request",service)}},_sfc_main=Vue.defineComponent({name:"App",setup(){var e;const t=Vue.inject("app");return{pageConfig:Vue.reactive((null==t||null===(e=t.page)||void 0===e?void 0:e.data)||{})}}});function _sfc_render(e,t,n,r,i,o){const s=Vue.resolveComponent("magic-ui-page");return Vue.openBlock(),Vue.createBlock(s,{config:e.pageConfig},null,8,["config"])}const AppComponent=_export_sfc(_sfc_main,[["render",_sfc_render],["__file","/data/magic/tmagic-editor/runtime/vue3/page/App.vue"]]),getLocalConfig=()=>{const configStr=localStorage.getItem("magicDSL");if(!configStr)return[];try{return[eval(`(${configStr})`)]}catch(err){return[]}},magicApp=Vue.createApp(AppComponent);magicApp.use(request),Object.values(components).forEach((e=>{magicApp.component(e.name,e)})),Object.values(plugins).forEach((e=>{magicApp.use(e)}));const app=new App({config:((getUrlParam("localPreview")?getLocalConfig():window.magicDSL)||[])[0]||{},curPage:getUrlParam("page")});magicApp.config.globalProperties.app=app,magicApp.provide("app",app),magicApp.mount("#app")}}}))})();
//# sourceMappingURL=index-legacy.07638326.js.map