@meituan-nocode/vite-plugin-nocode-compiler 0.5.0 → 0.5.1-beta.0

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/dist/index.cjs CHANGED
@@ -179,7 +179,7 @@ function readJsonBody(req) {
179
179
  }
180
180
 
181
181
  // package.json
182
- var version = "0.5.0";
182
+ var version = "0.5.1-beta.0";
183
183
 
184
184
  // src/design-mode/types.ts
185
185
  var SANDBOX_SCRIPT_PATH = "/sandbox-script.js";
@@ -376,7 +376,7 @@ function createVirtualCodeMiddleware(server, options, projectRoot) {
376
376
 
377
377
  // src/design-mode/sandbox-script.ts
378
378
  function getSandboxScriptContent() {
379
- return '(()=>{var e={6:(e,t,n)=>{var r=n(714).Symbol;e.exports=r},12:(e,t,n)=>{var r=n(400),o=n(835),i=n(639),s=Math.max,a=Math.min;e.exports=function(e,t,n){var c,u,l,d,f,h,p=0,g=!1,m=!1,v=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function y(t){var n=c,r=u;return c=u=void 0,p=t,d=e.apply(r,n)}function b(e){var n=e-h;return void 0===h||n>=t||n<0||m&&e-p>=l}function w(){var e=o();if(b(e))return E(e);f=setTimeout(w,function(e){var n=t-(e-h);return m?a(n,l-(e-p)):n}(e))}function E(e){return f=void 0,v&&c?y(e):(c=u=void 0,d)}function N(){var e=o(),n=b(e);if(c=arguments,u=this,h=e,n){if(void 0===f)return function(e){return p=e,f=setTimeout(w,t),g?y(e):d}(h);if(m)return clearTimeout(f),f=setTimeout(w,t),y(h)}return void 0===f&&(f=setTimeout(w,t)),d}return t=i(t)||0,r(n)&&(g=!!n.leading,l=(m="maxWait"in n)?s(i(n.maxWait)||0,t):l,v="trailing"in n?!!n.trailing:v),N.cancel=function(){void 0!==f&&clearTimeout(f),p=0,c=h=u=f=void 0},N.flush=function(){return void 0===f?d:E(o())},N}},103:(e,t,n)=>{var r=n(997),o=/^\\s+/;e.exports=function(e){return e?e.slice(0,r(e)+1).replace(o,""):e}},271:(e,t,n)=>{var r=n(6),o=n(650),i=n(881),s=r?r.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":s&&s in Object(e)?o(e):i(e)}},400:e=>{e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},583:e=>{e.exports=function(e){return null!=e&&"object"==typeof e}},603:(e,t,n)=>{var r="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g;e.exports=r},639:(e,t,n)=>{var r=n(103),o=n(400),i=n(975),s=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,c=/^0o[0-7]+$/i,u=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(i(e))return NaN;if(o(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=o(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=r(e);var n=a.test(e);return n||c.test(e)?u(e.slice(2),n?2:8):s.test(e)?NaN:+e}},650:(e,t,n)=>{var r=n(6),o=Object.prototype,i=o.hasOwnProperty,s=o.toString,a=r?r.toStringTag:void 0;e.exports=function(e){var t=i.call(e,a),n=e[a];try{e[a]=void 0;var r=!0}catch(e){}var o=s.call(e);return r&&(t?e[a]=n:delete e[a]),o}},714:(e,t,n)=>{var r=n(603),o="object"==typeof self&&self&&self.Object===Object&&self,i=r||o||Function("return this")();e.exports=i},835:(e,t,n)=>{var r=n(714);e.exports=function(){return r.Date.now()}},881:e=>{var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},975:(e,t,n)=>{var r=n(271),o=n(583);e.exports=function(e){return"symbol"==typeof e||o(e)&&"[object Symbol]"==r(e)}},997:e=>{var t=/\\s/;e.exports=function(e){for(var n=e.length;n--&&t.test(e.charAt(n)););return n}}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";var e=n(12),t=n.n(e),r=class extends Error{code;constructor(e,t){super(t),this.name="PenpalError",this.code=e}},o=e=>({name:e.name,message:e.message,stack:e.stack,penpalCode:e instanceof r?e.code:void 0}),i=Symbol("Reply"),s=class{value;transferables;#e=i;constructor(e,t){this.value=e,this.transferables=t?.transferables}},a="penpal",c=e=>"object"==typeof e&&null!==e,u=e=>"function"==typeof e,l=e=>"SYN"===e.type,d=e=>"ACK1"===e.type,f=e=>"ACK2"===e.type,h=e=>"CALL"===e.type,p=e=>"REPLY"===e.type,g=(e,t=[])=>{const n=[];for(const r of Object.keys(e)){const o=e[r];u(o)?n.push([...t,r]):c(o)&&n.push(...g(o,[...t,r]))}return n},m=e=>e.join("."),v=(e,t,n)=>({namespace:a,channel:e,type:"REPLY",callId:t,isError:!0,...n instanceof Error?{value:o(n),isSerializedErrorInstance:!0}:{value:n}}),y=crypto.randomUUID?.bind(crypto)??(()=>new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")),b=Symbol("CallOptions"),w=class{transferables;timeout;#e=b;constructor(e){this.transferables=e?.transferables,this.timeout=e?.timeout}},E=new Set(["apply","call","bind"]),N=(e,t,n=[])=>new Proxy(n.length?()=>{}:Object.create(null),{get(r,o){if("then"!==o)return n.length&&E.has(o)?Reflect.get(r,o):N(e,t,[...n,o])},apply:(t,r,o)=>e(n,o)}),S=e=>new r("CONNECTION_DESTROYED",`Method call ${m(e)}() failed due to destroyed connection`),C="deprecated-penpal",x=e=>e.join("."),O=e=>new r("TRANSMISSION_FAILED",`Unexpected message to translate: ${(e=>{try{return JSON.stringify(e)}catch(t){return String(e)}})(e)}`),I=({messenger:e,methods:t,timeout:n,channel:o,log:i})=>{const b=y();let E;const x=[];let O=!1;const I=g(t),{promise:M,resolve:T,reject:P}=(()=>{let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}})(),A=void 0!==n?setTimeout(()=>{P(new r("CONNECTION_TIMEOUT",`Connection timed out after ${n}ms`))},n):void 0,R=()=>{for(const e of x)e()},L=()=>{if(O)return;x.push(((e,t,n,o)=>{let i=!1;const l=async l=>{if(i)return;if(!h(l))return;o?.(`Received ${m(l.methodPath)}() call`,l);const{methodPath:d,args:f,id:p}=l;let g,y;try{const e=((e,t)=>{const n=e.reduce((e,t)=>c(e)?e[t]:void 0,t);return u(n)?n:void 0})(d,t);if(!e)throw new r("METHOD_NOT_FOUND",`Method \\`${m(d)}\\` is not found.`);let o=await e(...f);o instanceof s&&(y=o.transferables,o=await o.value),g={namespace:a,channel:n,type:"REPLY",callId:p,value:o}}catch(e){g=v(n,p,e)}if(!i)try{o?.(`Sending ${m(d)}() reply`,g),e.sendMessage(g,y)}catch(t){throw"DataCloneError"===t.name&&(g=v(n,p,t),o?.(`Sending ${m(d)}() reply`,g),e.sendMessage(g)),t}};return e.addMessageHandler(l),()=>{i=!0,e.removeMessageHandler(l)}})(e,t,o,i));const{remoteProxy:n,destroy:l}=((e,t,n)=>{let o=!1;const i=new Map,s=e=>{if(!p(e))return;const{callId:t,value:o,isError:s,isSerializedErrorInstance:a}=e,c=i.get(t);c&&(i.delete(t),n?.(`Received ${m(c.methodPath)}() call`,e),s?c.reject(a?(({name:e,message:t,stack:n,penpalCode:o})=>{const i=o?new r(o,t):new Error(t);return i.name=e,i.stack=n,i})(o):o):c.resolve(o))};return e.addMessageHandler(s),{remoteProxy:N((s,c)=>{if(o)throw S(s);const u=y(),l=c[c.length-1],d=l instanceof w,{timeout:f,transferables:h}=d?l:{},p=d?c.slice(0,-1):c;return new Promise((o,c)=>{const l=void 0!==f?window.setTimeout(()=>{i.delete(u),c(new r("METHOD_CALL_TIMEOUT",`Method call ${m(s)}() timed out after ${f}ms`))},f):void 0;i.set(u,{methodPath:s,resolve:o,reject:c,timeoutId:l});try{const r={namespace:a,channel:t,type:"CALL",id:u,methodPath:s,args:p};n?.(`Sending ${m(s)}() call`,r),e.sendMessage(r,h)}catch(e){c(new r("TRANSMISSION_FAILED",e.message))}})},n),destroy:()=>{o=!0,e.removeMessageHandler(s);for(const{methodPath:e,reject:t,timeoutId:n}of i.values())clearTimeout(n),t(S(e));i.clear()}}})(e,o,i);x.push(l),clearTimeout(A),O=!0,T({remoteProxy:n,destroy:R})},D=()=>{const t={namespace:a,type:"SYN",channel:o,participantId:b};i?.("Sending handshake SYN",t);try{e.sendMessage(t)}catch(e){P(new r("TRANSMISSION_FAILED",e.message))}},F=t=>{l(t)&&(t=>{if(i?.("Received handshake SYN",t),t.participantId===E&&E!==C)return;if(E=t.participantId,D(),!(b>E||E===C))return;const n={namespace:a,channel:o,type:"ACK1",methodPaths:I};i?.("Sending handshake ACK1",n);try{e.sendMessage(n)}catch(e){return void P(new r("TRANSMISSION_FAILED",e.message))}})(t),d(t)&&(t=>{i?.("Received handshake ACK1",t);const n={namespace:a,channel:o,type:"ACK2"};i?.("Sending handshake ACK2",n);try{e.sendMessage(n)}catch(e){return void P(new r("TRANSMISSION_FAILED",e.message))}L()})(t),f(t)&&(e=>{i?.("Received handshake ACK2",e),L()})(t)};return e.addMessageHandler(F),x.push(()=>e.removeMessageHandler(F)),D(),M},M=new WeakSet,T=class{#t;#n;#r;#o;#i;#s=new Set;#a;#c=!1;constructor({remoteWindow:e,allowedOrigins:t}){if(!e)throw new r("INVALID_ARGUMENT","remoteWindow must be defined");this.#t=e,this.#n=t?.length?t:[window.origin]}initialize=({log:e,validateReceivedMessage:t})=>{this.#r=e,this.#o=t,window.addEventListener("message",this.#u)};sendMessage=(e,t)=>{if(l(e)){const n=this.#l(e);return void this.#t.postMessage(e,{targetOrigin:n,transfer:t})}if(d(e)||this.#c){const n=this.#c?(e=>{if(d(e))return{penpal:"synAck",methodNames:e.methodPaths.map(x)};if(h(e))return{penpal:"call",id:e.id,methodName:x(e.methodPath),args:e.args};if(p(e))return e.isError?{penpal:"reply",id:e.callId,resolution:"rejected",...e.isSerializedErrorInstance?{returnValue:e.value,returnValueIsError:!0}:{returnValue:e.value}}:{penpal:"reply",id:e.callId,resolution:"fulfilled",returnValue:e.value};throw O(e)})(e):e,r=this.#l(e);return void this.#t.postMessage(n,{targetOrigin:r,transfer:t})}if(f(e)){const{port1:n,port2:r}=new MessageChannel;this.#a=n,n.addEventListener("message",this.#d),n.start();const o=[r,...t||[]],i=this.#l(e);return void this.#t.postMessage(e,{targetOrigin:i,transfer:o})}if(!this.#a)throw new r("TRANSMISSION_FAILED","Cannot send message because the MessagePort is not connected");this.#a.postMessage(e,{transfer:t})};addMessageHandler=e=>{this.#s.add(e)};removeMessageHandler=e=>{this.#s.delete(e)};destroy=()=>{window.removeEventListener("message",this.#u),this.#f(),this.#s.clear()};#h=e=>this.#n.some(t=>t instanceof RegExp?t.test(e):t===e||"*"===t);#l=e=>{if(l(e))return"*";if(!this.#i)throw new r("TRANSMISSION_FAILED","Cannot send message because the remote origin is not established");return"null"===this.#i&&this.#n.includes("*")?"*":this.#i};#f=()=>{this.#a?.removeEventListener("message",this.#d),this.#a?.close(),this.#a=void 0};#u=({source:e,origin:t,ports:n,data:r})=>{if(e===this.#t){if((e=>c(e)&&"penpal"in e)(r)){this.#r?.("Please upgrade the child window to the latest version of Penpal."),this.#c=!0;try{r=(e=>{if("syn"===e.penpal)return{namespace:a,channel:void 0,type:"SYN",participantId:C};if("ack"===e.penpal)return{namespace:a,channel:void 0,type:"ACK2"};if("call"===e.penpal)return{namespace:a,channel:void 0,type:"CALL",id:e.id,methodPath:(t=e.methodName,t.split(".")),args:e.args};var t;if("reply"===e.penpal)return"fulfilled"===e.resolution?{namespace:a,channel:void 0,type:"REPLY",callId:e.id,value:e.returnValue}:{namespace:a,channel:void 0,type:"REPLY",callId:e.id,isError:!0,...e.returnValueIsError?{value:e.returnValue,isSerializedErrorInstance:!0}:{value:e.returnValue}};throw O(e)})(r)}catch(e){return void this.#r?.(`Failed to translate deprecated message: ${e.message}`)}}if(this.#o?.(r))if(this.#h(t)){if(l(r)&&(this.#f(),this.#i=t),f(r)&&!this.#c){if(this.#a=n[0],!this.#a)return void this.#r?.("Ignoring ACK2 because it did not include a MessagePort");this.#a.addEventListener("message",this.#d),this.#a.start()}for(const e of this.#s)e(r)}else this.#r?.(`Received a message from origin \\`${t}\\` which did not match allowed origins \\`[${this.#n.join(", ")}]\\``)}};#d=({data:e})=>{if(this.#o?.(e))for(const t of this.#s)t(e)}},P=document,A=window,R=Array.prototype,L=R.filter,D=R.indexOf,F=R.map,$=R.push,j=R.reverse,_=R.slice,k=R.splice,W=/^#[\\w-]*$/,z=/^\\.[\\w-]*$/,H=/<.+>/,U=/^\\w+$/;function V(e,t){return void 0===t&&(t=P),z.test(e)?t.getElementsByClassName(e.slice(1)):U.test(e)?t.getElementsByTagName(e):t.querySelectorAll(e)}function B(e,t){if(void 0===t&&(t=P),e){if(e.__cash)return e;var n=e;if(te(e)){if(t.__cash&&(t=t[0]),!(n=W.test(e)?t.getElementById(e.slice(1)):H.test(e)?_e(e):V(e,t)))return}else if(ee(e))return this.ready(e);(n.nodeType||n===A)&&(n=[n]),this.length=n.length;for(var r=0,o=this.length;r<o;r++)this[r]=n[r]}}function Y(e,t){return new B(e,t)}var q=Y.fn=Y.prototype=B.prototype={constructor:Y,__cash:!0,length:0,splice:k};q.get=function(e){return void 0===e?_.call(this):this[e<0?e+this.length:e]},q.eq=function(e){return Y(this.get(e))},q.first=function(){return this.eq(0)},q.last=function(){return this.eq(-1)},q.map=function(e){return Y(F.call(this,function(t,n){return e.call(t,n,t)}))},q.slice=function(){return Y(_.apply(this,arguments))};var K=/(?:^\\w|[A-Z]|\\b\\w)/g,G=/[\\s-_]+/g;function X(e){return e.replace(K,function(e,t){return e[t?"toUpperCase":"toLowerCase"]()}).replace(G,"")}function J(e,t){for(var n=0,r=e.length;n<r&&!1!==t.call(e[n],e[n],n,e);n++);}Y.camelCase=X,Y.each=J,q.each=function(e){return J(this,function(t,n){return e.call(t,n,t)}),this},q.removeProp=function(e){return this.each(function(t,n){delete n[e]})},Y.extend=q.extend=function(e){void 0===e&&(e=this);for(var t=arguments,n=t.length,r=n<2?0:1;r<n;r++)for(var o in t[r])e[o]=t[r][o];return e};var Z=1;function Q(e,t){var n=e&&(e.matches||e.webkitMatchesSelector||e.mozMatchesSelector||e.msMatchesSelector||e.oMatchesSelector);return!!n&&n.call(e,t)}function ee(e){return"function"==typeof e}function te(e){return"string"==typeof e}function ne(e){return!isNaN(parseFloat(e))&&isFinite(e)}Y.guid=Z,Y.matches=Q,Y.isFunction=ee,Y.isString=te,Y.isNumeric=ne;var re=Array.isArray;function oe(e){return te(e)?function(t,n){return Q(n,e)}:e.__cash?function(t,n){return e.is(n)}:function(e,t,n){return t===n}}Y.isArray=re,q.prop=function(e,t){if(e){if(te(e))return arguments.length<2?this[0]&&this[0][e]:this.each(function(n,r){r[e]=t});for(var n in e)this.prop(n,e[n]);return this}},q.filter=function(e){if(!e)return Y();var t=ee(e)?e:oe(e);return Y(L.call(this,function(n,r){return t.call(n,r,n,e)}))};var ie=/\\S+/g;function se(e){return te(e)&&e.match(ie)||[]}function ae(e){return e.filter(function(e,t,n){return n.indexOf(e)===t})}function ce(e,t,n){if(1===e.nodeType){var r=A.getComputedStyle(e,null);return t?n?r.getPropertyValue(t):r[t]:r}}function ue(e,t){return parseInt(ce(e,t),10)||0}q.hasClass=function(e){var t=se(e),n=!1;return t.length&&this.each(function(e,r){return!(n=r.classList.contains(t[0]))}),n},q.removeAttr=function(e){var t=se(e);return t.length?this.each(function(e,n){J(t,function(e){n.removeAttribute(e)})}):this},q.attr=function(e,t){if(e){if(te(e)){if(arguments.length<2){if(!this[0])return;var n=this[0].getAttribute(e);return null===n?void 0:n}return null===t?this.removeAttr(e):this.each(function(n,r){r.setAttribute(e,t)})}for(var r in e)this.attr(r,e[r]);return this}},q.toggleClass=function(e,t){var n=se(e),r=void 0!==t;return n.length?this.each(function(e,o){J(n,function(e){r?t?o.classList.add(e):o.classList.remove(e):o.classList.toggle(e)})}):this},q.addClass=function(e){return this.toggleClass(e,!0)},q.removeClass=function(e){return arguments.length?this.toggleClass(e,!1):this.attr("class","")},Y.unique=ae,q.add=function(e,t){return Y(ae(this.get().concat(Y(e,t).get())))};var le=/^--/;function de(e){return le.test(e)}var fe={},he=P.createElement("div").style,pe=["webkit","moz","ms","o"];function ge(e,t){if(void 0===t&&(t=de(e)),t)return e;if(!fe[e]){var n=X(e),r=""+n.charAt(0).toUpperCase()+n.slice(1);J((n+" "+pe.join(r+" ")+r).split(" "),function(t){if(t in he)return fe[e]=t,!1})}return fe[e]}Y.prefixedProp=ge;var me={animationIterationCount:!0,columnCount:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0};function ve(e,t,n){return void 0===n&&(n=de(e)),n||me[e]||!ne(t)?t:t+"px"}q.css=function(e,t){if(te(e)){var n=de(e);return e=ge(e,n),arguments.length<2?this[0]&&ce(this[0],e,n):e?(t=ve(e,t,n),this.each(function(r,o){1===o.nodeType&&(n?o.style.setProperty(e,t):o.style[e]=t)})):this}for(var r in e)this.css(r,e[r]);return this};var ye="__cashData",be=/^data-(.*)/;function we(e){return e[ye]=e[ye]||{}}function Ee(e,t){var n=we(e);if(t){if(!(t in n)){var r=e.dataset?e.dataset[t]||e.dataset[X(t)]:Y(e).attr("data-"+t);if(void 0!==r){try{r=JSON.parse(r)}catch(e){}n[t]=r}}return n[t]}return n}function Ne(e,t){return ue(e,"border"+(t?"Left":"Top")+"Width")+ue(e,"padding"+(t?"Left":"Top"))+ue(e,"padding"+(t?"Right":"Bottom"))+ue(e,"border"+(t?"Right":"Bottom")+"Width")}function Se(e,t){for(var n=0,r=t.length;n<r;n++)if(e.indexOf(t[n])<0)return!1;return!0}function Ce(e,t,n){J(e[n],function(e){e[0];var r=e[1];t.removeEventListener(n,r)}),delete e[n]}Y.hasData=function(e){return ye in e},q.data=function(e,t){var n=this;if(!e){if(!this[0])return;return J(this[0].attributes,function(e){var t=e.name.match(be);t&&n.data(t[1])}),Ee(this[0])}if(te(e))return void 0===t?this[0]&&Ee(this[0],e):this.each(function(n,r){return function(e,t,n){we(e)[t]=n}(r,e,t)});for(var r in e)this.data(r,e[r]);return this},q.removeData=function(e){return this.each(function(t,n){return function(e,t){void 0===t?delete e[ye]:delete we(e)[t]}(n,e)})},J(["Width","Height"],function(e){q["inner"+e]=function(){if(this[0])return this[0]===A?A["inner"+e]:this[0]["client"+e]}}),J(["width","height"],function(e,t){q[e]=function(n){return this[0]?arguments.length?(n=parseInt(n,10),this.each(function(r,o){if(1===o.nodeType){var i=ce(o,"boxSizing");o.style[e]=ve(e,n+("border-box"===i?Ne(o,!t):0))}})):this[0]===A?this[0][X("outer-"+e)]:this[0].getBoundingClientRect()[e]-Ne(this[0],!t):void 0===n?void 0:this}}),J(["Width","Height"],function(e,t){q["outer"+e]=function(n){if(this[0])return this[0]===A?A["outer"+e]:this[0]["offset"+e]+(n?ue(this[0],"margin"+(t?"Top":"Left"))+ue(this[0],"margin"+(t?"Bottom":"Right")):0)}});var xe="__cashEvents";function Oe(e){return e[xe]=e[xe]||{}}function Ie(e){var t=e.split(".");return[t[0],t.slice(1).sort()]}function Me(e,t,n,r){var o=Oe(e);if(t){var i=o[t];if(!i)return;r&&(r.guid=r.guid||Z++),o[t]=i.filter(function(o){var i=o[0],s=o[1];if(r&&s.guid!==r.guid||!Se(i,n))return!0;e.removeEventListener(t,s)})}else if(n&&n.length)for(t in o)Me(e,t,n,r);else for(t in o)Ce(o,e,t)}q.off=function(e,t){var n=this;return void 0===e?this.each(function(e,t){return Me(t)}):J(se(e),function(e){var r=Ie(e),o=r[0],i=r[1];n.each(function(e,n){return Me(n,o,i,t)})}),this},q.on=function(e,t,n,r){var o=this;if(!te(e)){for(var i in e)this.on(i,t,e[i]);return this}return ee(t)&&(n=t,t=!1),J(se(e),function(e){var i=Ie(e),s=i[0],a=i[1];o.each(function(e,o){var i=function e(i){if(!i.namespace||Se(a,i.namespace.split("."))){var c=o;if(t){for(var u=i.target;!Q(u,t);){if(u===o)return;if(!(u=u.parentNode))return}c=u}i.namespace=i.namespace||"";var l=n.call(c,i,i.data);r&&Me(o,s,a,e),!1===l&&(i.preventDefault(),i.stopPropagation())}};i.guid=n.guid=n.guid||Z++,function(e,t,n,r){r.guid=r.guid||Z++;var o=Oe(e);o[t]=o[t]||[],o[t].push([n,r]),e.addEventListener(t,r)}(o,s,a,i)})}),this},q.one=function(e,t,n){return this.on(e,t,n,!0)},q.ready=function(e){var t=function(){return e(Y)};return"loading"!==P.readyState?setTimeout(t):P.addEventListener("DOMContentLoaded",t),this},q.trigger=function(e,t){var n=e;if(te(e)){var r=Ie(e),o=r[0],i=r[1];(n=P.createEvent("HTMLEvents")).initEvent(o,!0,!0),n.namespace=i.join(".")}return n.data=t,this.each(function(e,t){t.dispatchEvent(n)})};var Te=/select-one/i,Pe=/select-multiple/i;function Ae(e){var t=e.type;return Te.test(t)?function(e){return e.selectedIndex<0?null:e.options[e.selectedIndex].value}(e):Pe.test(t)?function(e){var t=[];return J(e.options,function(e){!e.selected||e.disabled||e.parentNode.disabled||t.push(e.value)}),t}(e):e.value}var Re=/%20/g,Le=/file|reset|submit|button|image/i,De=/radio|checkbox/i;q.serialize=function(){var e="";return this.each(function(t,n){J(n.elements||[n],function(t){if(!t.disabled&&t.name&&"FIELDSET"!==t.tagName&&!Le.test(t.type)&&(!De.test(t.type)||t.checked)){var n=Ae(t);void 0!==n&&J(re(n)?n:[n],function(n){e+=function(e,t){return"&"+encodeURIComponent(e)+"="+encodeURIComponent(t).replace(Re,"+")}(t.name,n)})}})}),e.substr(1)},q.val=function(e){return void 0===e?this[0]&&Ae(this[0]):this.each(function(t,n){var r=Pe.test(n.type),o=null===e?r?[]:"":e;r&&re(o)?J(n.options,function(e){e.selected=o.indexOf(e.value)>=0}):n.value=o})},q.clone=function(){return this.map(function(e,t){return t.cloneNode(!0)})},q.detach=function(){return this.each(function(e,t){t.parentNode&&t.parentNode.removeChild(t)})};var Fe,$e=/^\\s*<(\\w+)[^>]*>/,je=/^\\s*<(\\w+)\\s*\\/?>(?:<\\/\\1>)?\\s*$/;function _e(e){if(function(){if(!Fe){var e=P.createElement("table"),t=P.createElement("tr");Fe={"*":P.createElement("div"),tr:P.createElement("tbody"),td:t,th:t,thead:e,tbody:e,tfoot:e}}}(),!te(e))return[];if(je.test(e))return[P.createElement(RegExp.$1)];var t=$e.test(e)&&RegExp.$1,n=Fe[t]||Fe["*"];return n.innerHTML=e,Y(n.childNodes).detach().get()}function ke(e,t,n){if(void 0!==t){var r=te(t);!r&&t.length?J(t,function(t){return ke(e,t,n)}):J(e,r?function(e){e.insertAdjacentHTML(n?"afterbegin":"beforeend",t)}:function(e,r){return function(e,t,n){n?e.insertBefore(t,e.childNodes[0]):e.appendChild(t)}(e,r?t.cloneNode(!0):t,n)})}}Y.parseHTML=_e,q.empty=function(){var e=this[0];if(e)for(;e.firstChild;)e.removeChild(e.firstChild);return this},q.append=function(){var e=this;return J(arguments,function(t){ke(e,t)}),this},q.appendTo=function(e){return ke(Y(e),this),this},q.html=function(e){if(void 0===e)return this[0]&&this[0].innerHTML;var t=e.nodeType?e[0].outerHTML:e;return this.each(function(e,n){n.innerHTML=t})},q.insertAfter=function(e){var t=this;return Y(e).each(function(e,n){var r=n.parentNode;t.each(function(t,o){r.insertBefore(e?o.cloneNode(!0):o,n.nextSibling)})}),this},q.after=function(){var e=this;return J(j.apply(arguments),function(t){j.apply(Y(t).slice()).insertAfter(e)}),this},q.insertBefore=function(e){var t=this;return Y(e).each(function(e,n){var r=n.parentNode;t.each(function(t,o){r.insertBefore(e?o.cloneNode(!0):o,n)})}),this},q.before=function(){var e=this;return J(arguments,function(t){Y(t).insertBefore(e)}),this},q.prepend=function(){var e=this;return J(arguments,function(t){ke(e,t,!0)}),this},q.prependTo=function(e){return ke(Y(e),j.apply(this.slice()),!0),this},q.remove=function(){return this.detach().off()},q.replaceWith=function(e){var t=this;return this.each(function(n,r){var o=r.parentNode;if(o){var i=n?Y(e).clone():Y(e);if(!i[0])return t.remove(),!1;o.replaceChild(i[0],r),Y(i[0]).after(i.slice(1))}})},q.replaceAll=function(e){return Y(e).replaceWith(this),this},q.text=function(e){return void 0===e?this[0]?this[0].textContent:"":this.each(function(t,n){n.textContent=e})};var We=P.documentElement;q.offset=function(){var e=this[0];if(e){var t=e.getBoundingClientRect();return{top:t.top+A.pageYOffset-We.clientTop,left:t.left+A.pageXOffset-We.clientLeft}}},q.offsetParent=function(){return Y(this[0]&&this[0].offsetParent)},q.position=function(){var e=this[0];if(e)return{left:e.offsetLeft,top:e.offsetTop}},q.children=function(e){var t=[];return this.each(function(e,n){$.apply(t,n.children)}),t=Y(ae(t)),e?t.filter(function(t,n){return Q(n,e)}):t},q.contents=function(){var e=[];return this.each(function(t,n){$.apply(e,"IFRAME"===n.tagName?[n.contentDocument]:n.childNodes)}),Y(e.length&&ae(e))},q.find=function(e){for(var t=[],n=0,r=this.length;n<r;n++){var o=V(e,this[n]);o.length&&$.apply(t,o)}return Y(t.length&&ae(t))},q.has=function(e){var t=te(e)?function(t,n){return!!V(e,n).length}:function(t,n){return n.contains(e)};return this.filter(t)},q.is=function(e){if(!e||!this[0])return!1;var t=oe(e),n=!1;return this.each(function(r,o){return!(n=t(r,o,e))}),n},q.next=function(){return Y(this[0]&&this[0].nextElementSibling)},q.not=function(e){if(!e||!this[0])return this;var t=oe(e);return this.filter(function(n,r){return!t(n,r,e)})},q.parent=function(){var e=[];return this.each(function(t,n){n&&n.parentNode&&e.push(n.parentNode)}),Y(ae(e))},q.index=function(e){var t=e?Y(e)[0]:this[0],n=e?this:Y(t).parent().children();return D.call(n,t)},q.closest=function(e){return e&&this[0]?this.is(e)?this.filter(e):this.parent().closest(e):Y()},q.parents=function(e){var t,n=[];return this.each(function(r,o){for(t=o;t&&t.parentNode&&t!==P.body.parentNode;)t=t.parentNode,(!e||e&&Q(t,e))&&n.push(t)}),Y(ae(n))},q.prev=function(){return Y(this[0]&&this[0].previousElementSibling)},q.siblings=function(){var e=this[0];return this.parent().children().filter(function(t,n){return n!==e})};const ze=Y,He=new class{getFiberNode(e){try{const t=Object.keys(e).find(e=>e.startsWith("__reactFiber$")||e.startsWith("__reactInternalInstance$"));return t?e[t]:null}catch(e){return console.warn("[ReactFiberService] Error getting fiber node:",e),null}}getDebugOwner(e){const t=this.getFiberNode(e);return t?._debugOwner??null}getDebugSource(e){const t=this.getFiberNode(e);return t?._debugSource??null}getOwnerDebugSource(e){const t=this.getDebugOwner(e);return t?._debugSource??null}hasDirectSourceInfo(e){return!!e.getAttribute("data-nocode-id")||!!this.getDebugSource(e)}hasOwnerNocodeId(e){const t=this.getDebugOwner(e);if(!t?.memoizedProps)return!1;const n=t.memoizedProps["data-nocode-id"];return"string"==typeof n&&n.length>0}getOwnerNocodeId(e){const t=this.getDebugOwner(e);if(!t?.memoizedProps)return null;const n=t.memoizedProps["data-nocode-id"];return"string"==typeof n?n:null}isSelectableElement(e){if(this.hasDirectSourceInfo(e))return!0;const t=this.getFiberNode(e),n=this.getOwnerDebugSource(e);return!!(t?.return&&5!==t.return.tag&&this.hasOwnerNocodeId(e)&&n)}isComponent(e){if(!this.isSelectableElement(e))return!1;if(e.getAttribute("data-nocode-components-name"))return!0;if(this.getDebugSource(e))return!1;const t=this.getFiberNode(e);return!(!t?.return||5===t.return.tag)}getComponentName(e){const t=e.getAttribute("data-nocode-tag-name");if(t)return t;const n=this.getDebugOwner(e);if(n?.type){const e=n.type;if("function"==typeof e){const t=e.displayName||e.name||"Unknown";return this.normalizeComponentName(t)}if("string"==typeof e)return e}return e.tagName.toLowerCase()}normalizeComponentName(e){return e.replace(/\\d+$/,"")}getComponentProps(e){if(!this.isComponent(e))return;const t=this.getDebugOwner(e);return t?.memoizedProps?this.sanitizeProps(t.memoizedProps):void 0}sanitizeProps(e){const t={};for(const[n,r]of Object.entries(e)){if("children"===n||n.startsWith("_"))continue;const e=this.sanitizeValue(r);void 0!==e&&(t[n]=e)}return t}sanitizeValue(e){if(null===e)return null;if(void 0===e)return;if("function"==typeof e)return;if("symbol"==typeof e)return;if("object"!=typeof e)return e;if("$$typeof"in e)return;if(e instanceof Node)return;if(Array.isArray(e)){const t=[];for(const n of e){const e=this.sanitizeValue(n);void 0!==e&&t.push(e)}return t}const t={};for(const[n,r]of Object.entries(e)){if(n.startsWith("_"))continue;const e=this.sanitizeValue(r);void 0!==e&&(t[n]=e)}return t}buildComponentInfo(e){const t=this.isComponent(e),n={isComponent:t,componentType:t?"component":"host",name:t?this.getComponentName(e):e.tagName.toLowerCase()},r=e.getAttribute("data-nocode-components-name"),o=e.getAttribute("data-nocode-components-version");if(r&&(n.componentsName=r),o&&(n.componentsVersion=o),t){const t=this.getComponentProps(e)??{},r=this.removeSpecialProps(t);n.props=r}return n}removeSpecialProps(e){const t={};for(const[n,r]of Object.entries(e))"componentsName"!==n&&"componentsVersion"!==n&&(n.startsWith("data-nocode-")||(t[n]=r));return t}},Ue="data-dnd";function Ve(e){if(!e)return{};const t=e.split(":");if(t.length>=3){const n=t.pop(),r=t.pop(),o=t.join(":");return{id:e,filename:decodeURIComponent(o),component:r,codeId:n}}return 2===t.length?{id:e,component:t[0],codeId:t[1]}:{id:e}}const Be=`[${Ue}]`;function Ye(e,t){const n=t??0;return 0===n?document.querySelector(`[${Ue}="${e}"]`):document.querySelectorAll(`[${Ue}="${e}"]`)[n]??null}const qe=(e,t)=>{const n=e.getBoundingClientRect(),{x:r,y:o}=((e,t)=>{let n=e.x,r=e.y;if(t){const e=t.getBoundingClientRect();n-=e.left,r-=e.top}return{x:n,y:r}})({x:n.left,y:n.top},t);return{width:e.offsetWidth||Math.round(n.width),height:e.offsetHeight||Math.round(n.height),top:o,left:r}},Ke=(e,t)=>{const n=qe(e,t),r=function(e){return e.dataset}(e),o=Ge(e),i=Xe(e),s=(e=>{const t=window.getComputedStyle(e);return{display:t.display,flexDirection:t.flexDirection,flexWrap:t.flexWrap,position:t.position}})(e),a=r.dnd||"",c=Ve(a),u=function(e){return He.buildComponentInfo(e)}(e),l=function(e){return"true"===e.getAttribute("data-nocode-container-placeholder")}(e),d=(e=>{const t=e.querySelectorAll(`:scope > ${Be}`);if(!t.length)return[];const n=[];return t.forEach(e=>{const t=e;n.push(qe(t))}),n})(e);let f;if(a){const t=document.querySelectorAll(`[${Ue}="${a}"]`);if(t.length>1)for(let n=0;n<t.length;n++)if(t[n]===e){f=n;break}}return{id:a,codeId:c.codeId,name:c.component||e.tagName.toLowerCase(),filename:c.filename,bounding:n,display:o,computedStyle:s,text:i,containerPlaceholder:l||void 0,componentInfo:u,childrenBoundings:d.length>0?d:void 0,dndIndex:f}},Ge=e=>ze(e).css("display"),Xe=e=>{const t=[];return e.childNodes.forEach(e=>{if(e.nodeType===Node.TEXT_NODE){const n=e.textContent?.trim()||"";n&&t.push(n)}}),t.join(" ")};function Je(e){const t=["div","p","section","article","main","header","footer","nav","h1","h2","h3","h4","h5","h6","span","a","button","i","input","textarea","select","label","form","ul","ol","li","table","thead","tbody","tr","td","th","img","video","audio","canvas","svg"];try{const n=e.tagName.toLowerCase();if(!t.includes(n))return!1;const r=window.getComputedStyle(e);if("none"===r.display||"hidden"===r.visibility||"0"===r.opacity)return!1;const o=e.getBoundingClientRect();return!("inline"!==r.display&&"inline-block"!==r.display&&(0===o.width||0===o.height))}catch(e){return console.warn("Element validation failed:",e),!1}}function Ze(e,t=20){let n=e,r=0;for(;n&&r<t;){if(n.getAttribute(Ue))return n;n=n.parentElement,r++}return null}function Qe(e){const t=window.getComputedStyle(e),n={};for(let e=0;e<t.length;e++){const r=t[e];n[r]=t.getPropertyValue(r)}return n}let et=null;function tt(e){return(...t)=>{try{const n=e(...t);return n&&"function"==typeof n.then?n.catch(n=>(console.error(`Async error in ${e.name}:`,n),console.error("Error stack:",n.stack),console.error("Function arguments:",t),null)):n}catch(n){return console.error(`Sync error in ${e.name}:`,n),n instanceof Error&&console.error("Error stack:",n.stack),console.error("Function arguments:",t),null}}}const nt={getDraggableParentsData:(e,t)=>{const n=function(e,t){const n=((e,t)=>{const n=document.elementFromPoint(e,t);if(!n)return null;const r=n=>{if(n?.shadowRoot){const o=n.shadowRoot.elementFromPoint(e,t);return o===n?n:o?.shadowRoot?r(o):o||n}return n};return r(n)})(e,t);if(!n)return null;let r=n;if(!Je(r)){let e=r.parentElement,t=0;const n=20;for(;e&&t<n;){if(Je(e)){r=e;break}e=e.parentElement,t++}if(!Je(r))return null}const o=Ze(r);return o&&Je(o)?o:null}(e.x,e.y);if(!n)return;const r=(e=>{const t=ze(e).closest(Be).get(0),n=ze(e).parents(Be).get();return n[0]!==t&&n.unshift(t),n})(n);if(r.length){if(t){const e=r.map(e=>Ke(e));return{...e[0],computedStyle:Qe(n),parents:e.slice(1)}}return{...Ke(r[0]),computedStyle:Qe(r[0])}}},getElementDataById:(e,t)=>{const n=Ye(e,t);if(n)return{...Ke(n),computedStyle:Qe(n)};console.warn("[getElementDataById] Element not found for domId:",e,"dndIndex:",t)},getEditableTextElementAtPosition:e=>{const t=function(e,t){if(document.caretPositionFromPoint){const n=document.caretPositionFromPoint(e,t);return n?.offsetNode??null}if(document.caretRangeFromPoint){const n=document.caretRangeFromPoint(e,t);return n?.startContainer??null}return document.elementFromPoint(e,t)}(e.x,e.y);if(!t)return void console.log("[getEditableTextElementAtPosition] No node at point:",e);if(t.nodeType!==Node.TEXT_NODE)return void console.log("[getEditableTextElementAtPosition] Not a text node:",t.nodeType);const n=t.textContent?.trim();if(!n)return void console.log("[getEditableTextElementAtPosition] Empty text node");const r=t.parentElement;if(!r)return void console.log("[getEditableTextElementAtPosition] No parent element");const o=Ze(r);if(o){if(function(e){const t=e.childNodes;let n=!1;for(let e=0;e<t.length;e++){const r=t[e];if(r.nodeType===Node.ELEMENT_NODE)return!1;if(r.nodeType===Node.TEXT_NODE){const e=r.textContent?.trim();e&&(n=!0)}}return n}(o))return console.log("[getEditableTextElementAtPosition] Found editable text element:",o.tagName,o.textContent),{...Ke(o),computedStyle:Qe(o)};console.log("[getEditableTextElementAtPosition] Element has child elements, cannot edit directly:",o.tagName)}else console.log("[getEditableTextElementAtPosition] No marked element found")},updateElementTextContent:(e,t)=>{const n=Ye(e);return n?(n.textContent=t,!0):(console.warn("[updateElementTextContent] Element not found:",e),!1)},scrollToElement:(e,t)=>{const n=Ye(e,t);return n?(n.scrollIntoView({behavior:"instant",block:"center",inline:"center"}),!0):(console.warn("[scrollToElement] Element not found for domId:",e,"dndIndex:",t),!1)},scrollPageBy:(e,t)=>(window.scrollBy(e,t),!0),highlightElement:(e,t)=>{if(et&&(et.style.outline="",et.style.outlineOffset="",et=null),!e)return!0;const n=Ye(e,t);return n?(n.style.outline="2px solid rgba(54, 210, 190, 0.8)",n.style.outlineOffset="-1px",et=n,!0):(console.warn("[highlightElement] Element not found:",e,"dndIndex:",t),!1)},getProjectLibVersions:function(){try{const e=document.body;if(!e)return console.warn("[sandbox] document.body is not available"),null;const t=e.getAttribute("data-nocode-lib-versions");if(!t)return console.warn("[sandbox] data-nocode-lib-versions attribute not found on body"),null;const n=JSON.parse(t);return"object"!=typeof n||null===n?(console.warn("[sandbox] data-nocode-lib-versions is not a valid object"),null):n}catch(e){return console.error("[sandbox] Failed to parse data-nocode-lib-versions:",e),null}},getCompilerVersion:function(){try{const e=document.body;return e?e.getAttribute("data-nocode-compiler-version"):null}catch(e){return console.error("[sandbox] Failed to get compiler version:",e),null}},getRuntimeNodeTree:()=>{try{const e=document.querySelectorAll(Be);if(!e.length)return[];const t=new Map;e.forEach(e=>{const n=e.getAttribute(Ue)||"";if(!n)return;const r=Ve(n);t.set(e,{id:n,component:r.component||e.tagName.toLowerCase(),children:[]})});const n=[];e.forEach(e=>{const r=t.get(e);if(!r)return;let o,i=e.parentElement;for(;i;){if(t.has(i)){o=t.get(i);break}i=i.parentElement}o?o.children.push(r):n.push(r)});const r=e=>{e.children&&0===e.children.length?delete e.children:e.children&&e.children.forEach(r)};return n.forEach(r),n}catch(e){return console.error("[sandbox] Failed to build runtime node tree:",e),[]}},setElementStyle:function(e,t){const n=function(e){return document.querySelector(`[${Ue}="${e}"]`)}(e);return n?(Object.entries(t).forEach(([e,t])=>{n.style[e]=t}),!0):(console.warn("[setElementStyle] Element not found for domId:",e),!1)}},rt=Object.fromEntries(Object.entries(nt).map(([e,t])=>[e,tt(t)])),ot="nocode-design-mode";let it=null,st=!1,at=null;const ct=t()(()=>{it?.onWindowMutated&&(console.log(`${ot} - Notifying parent of DOM mutation`),it.onWindowMutated({added:{},removed:{}}))},100),ut=async()=>{if(st||it)return it;st=!0,console.log(`${ot} - Creating penpal connection`);const e=(({messenger:e,methods:t={},timeout:n,channel:o,log:i})=>{if(!e)throw new r("INVALID_ARGUMENT","messenger must be defined");if(M.has(e))throw new r("INVALID_ARGUMENT","A messenger can only be used for a single connection");M.add(e);const s=[e.destroy],u=(e=>{let t,n=!1;return(...r)=>(n||(n=!0,t=e(...r)),t)})(t=>{if(t){const t={namespace:a,channel:o,type:"DESTROY"};try{e.sendMessage(t)}catch(e){}}for(const e of s)e();i?.("Connection destroyed")}),l=e=>(e=>c(e)&&e.namespace===a)(e)&&e.channel===o;return{promise:(async()=>{try{e.initialize({log:i,validateReceivedMessage:l}),e.addMessageHandler(e=>{(e=>"DESTROY"===e.type)(e)&&u(!1)});const{remoteProxy:r,destroy:a}=await I({messenger:e,methods:t,timeout:n,channel:o,log:i});return s.push(a),r}catch(e){throw u(!0),e}})(),destroy:()=>{u(!0)}}})({messenger:new T({remoteWindow:window===window.top?(console.warn(`${ot} - Not in an iframe, using window.parent as fallback`),window.parent):window.parent===window.top?window.parent:window.top?(console.log(`${ot} - Using window.top for nested iframe scenario`),window.top):window.parent,allowedOrigins:["*"]}),methods:rt});return e.promise.then(e=>{if(!e)return console.error(`${ot} - Failed to setup penpal connection: child is null`),void lt();it=e,console.log(`${ot} - Penpal connection set`),(()=>{if(at)return;at=new MutationObserver(e=>{e.some(e=>{const t=e.target;return"SCRIPT"!==t.tagName&&"STYLE"!==t.tagName&&("attributes"!==e.type||"style"===e.attributeName||"class"===e.attributeName)})&&ct()});const e=()=>{document.body&&at&&(at.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style","class"],characterData:!0}),console.log(`${ot} - MutationObserver started`))};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",e):e()})()}).finally(()=>{st=!1}),e.promise.catch(e=>{console.error(`${ot} - Failed to setup penpal connection:`,e),lt()}),it},lt=t()(()=>{st||(console.log(`${ot} - Reconnecting to penpal parent`),it=null,ut())},1e3);ut()})()})();';
379
+ return '(()=>{var e={6:(e,t,n)=>{var r=n(714).Symbol;e.exports=r},12:(e,t,n)=>{var r=n(400),o=n(835),i=n(639),s=Math.max,a=Math.min;e.exports=function(e,t,n){var c,l,u,d,f,h,p=0,g=!1,m=!1,v=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function y(t){var n=c,r=l;return c=l=void 0,p=t,d=e.apply(r,n)}function b(e){var n=e-h;return void 0===h||n>=t||n<0||m&&e-p>=u}function w(){var e=o();if(b(e))return E(e);f=setTimeout(w,function(e){var n=t-(e-h);return m?a(n,u-(e-p)):n}(e))}function E(e){return f=void 0,v&&c?y(e):(c=l=void 0,d)}function N(){var e=o(),n=b(e);if(c=arguments,l=this,h=e,n){if(void 0===f)return function(e){return p=e,f=setTimeout(w,t),g?y(e):d}(h);if(m)return clearTimeout(f),f=setTimeout(w,t),y(h)}return void 0===f&&(f=setTimeout(w,t)),d}return t=i(t)||0,r(n)&&(g=!!n.leading,u=(m="maxWait"in n)?s(i(n.maxWait)||0,t):u,v="trailing"in n?!!n.trailing:v),N.cancel=function(){void 0!==f&&clearTimeout(f),p=0,c=h=l=f=void 0},N.flush=function(){return void 0===f?d:E(o())},N}},103:(e,t,n)=>{var r=n(997),o=/^\\s+/;e.exports=function(e){return e?e.slice(0,r(e)+1).replace(o,""):e}},271:(e,t,n)=>{var r=n(6),o=n(650),i=n(881),s=r?r.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":s&&s in Object(e)?o(e):i(e)}},400:e=>{e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},583:e=>{e.exports=function(e){return null!=e&&"object"==typeof e}},603:(e,t,n)=>{var r="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g;e.exports=r},639:(e,t,n)=>{var r=n(103),o=n(400),i=n(975),s=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,c=/^0o[0-7]+$/i,l=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(i(e))return NaN;if(o(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=o(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=r(e);var n=a.test(e);return n||c.test(e)?l(e.slice(2),n?2:8):s.test(e)?NaN:+e}},650:(e,t,n)=>{var r=n(6),o=Object.prototype,i=o.hasOwnProperty,s=o.toString,a=r?r.toStringTag:void 0;e.exports=function(e){var t=i.call(e,a),n=e[a];try{e[a]=void 0;var r=!0}catch(e){}var o=s.call(e);return r&&(t?e[a]=n:delete e[a]),o}},714:(e,t,n)=>{var r=n(603),o="object"==typeof self&&self&&self.Object===Object&&self,i=r||o||Function("return this")();e.exports=i},835:(e,t,n)=>{var r=n(714);e.exports=function(){return r.Date.now()}},881:e=>{var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},975:(e,t,n)=>{var r=n(271),o=n(583);e.exports=function(e){return"symbol"==typeof e||o(e)&&"[object Symbol]"==r(e)}},997:e=>{var t=/\\s/;e.exports=function(e){for(var n=e.length;n--&&t.test(e.charAt(n)););return n}}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";var e=n(12),t=n.n(e),r=class extends Error{code;constructor(e,t){super(t),this.name="PenpalError",this.code=e}},o=e=>({name:e.name,message:e.message,stack:e.stack,penpalCode:e instanceof r?e.code:void 0}),i=Symbol("Reply"),s=class{value;transferables;#e=i;constructor(e,t){this.value=e,this.transferables=t?.transferables}},a="penpal",c=e=>"object"==typeof e&&null!==e,l=e=>"function"==typeof e,u=e=>"SYN"===e.type,d=e=>"ACK1"===e.type,f=e=>"ACK2"===e.type,h=e=>"CALL"===e.type,p=e=>"REPLY"===e.type,g=(e,t=[])=>{const n=[];for(const r of Object.keys(e)){const o=e[r];l(o)?n.push([...t,r]):c(o)&&n.push(...g(o,[...t,r]))}return n},m=e=>e.join("."),v=(e,t,n)=>({namespace:a,channel:e,type:"REPLY",callId:t,isError:!0,...n instanceof Error?{value:o(n),isSerializedErrorInstance:!0}:{value:n}}),y=crypto.randomUUID?.bind(crypto)??(()=>new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")),b=Symbol("CallOptions"),w=class{transferables;timeout;#e=b;constructor(e){this.transferables=e?.transferables,this.timeout=e?.timeout}},E=new Set(["apply","call","bind"]),N=(e,t,n=[])=>new Proxy(n.length?()=>{}:Object.create(null),{get(r,o){if("then"!==o)return n.length&&E.has(o)?Reflect.get(r,o):N(e,t,[...n,o])},apply:(t,r,o)=>e(n,o)}),S=e=>new r("CONNECTION_DESTROYED",`Method call ${m(e)}() failed due to destroyed connection`),x="deprecated-penpal",C=e=>e.join("."),O=e=>new r("TRANSMISSION_FAILED",`Unexpected message to translate: ${(e=>{try{return JSON.stringify(e)}catch(t){return String(e)}})(e)}`),I=({messenger:e,methods:t,timeout:n,channel:o,log:i})=>{const b=y();let E;const C=[];let O=!1;const I=g(t),{promise:A,resolve:M,reject:T}=(()=>{let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}})(),P=void 0!==n?setTimeout(()=>{T(new r("CONNECTION_TIMEOUT",`Connection timed out after ${n}ms`))},n):void 0,R=()=>{for(const e of C)e()},L=()=>{if(O)return;C.push(((e,t,n,o)=>{let i=!1;const u=async u=>{if(i)return;if(!h(u))return;o?.(`Received ${m(u.methodPath)}() call`,u);const{methodPath:d,args:f,id:p}=u;let g,y;try{const e=((e,t)=>{const n=e.reduce((e,t)=>c(e)?e[t]:void 0,t);return l(n)?n:void 0})(d,t);if(!e)throw new r("METHOD_NOT_FOUND",`Method \\`${m(d)}\\` is not found.`);let o=await e(...f);o instanceof s&&(y=o.transferables,o=await o.value),g={namespace:a,channel:n,type:"REPLY",callId:p,value:o}}catch(e){g=v(n,p,e)}if(!i)try{o?.(`Sending ${m(d)}() reply`,g),e.sendMessage(g,y)}catch(t){throw"DataCloneError"===t.name&&(g=v(n,p,t),o?.(`Sending ${m(d)}() reply`,g),e.sendMessage(g)),t}};return e.addMessageHandler(u),()=>{i=!0,e.removeMessageHandler(u)}})(e,t,o,i));const{remoteProxy:n,destroy:u}=((e,t,n)=>{let o=!1;const i=new Map,s=e=>{if(!p(e))return;const{callId:t,value:o,isError:s,isSerializedErrorInstance:a}=e,c=i.get(t);c&&(i.delete(t),n?.(`Received ${m(c.methodPath)}() call`,e),s?c.reject(a?(({name:e,message:t,stack:n,penpalCode:o})=>{const i=o?new r(o,t):new Error(t);return i.name=e,i.stack=n,i})(o):o):c.resolve(o))};return e.addMessageHandler(s),{remoteProxy:N((s,c)=>{if(o)throw S(s);const l=y(),u=c[c.length-1],d=u instanceof w,{timeout:f,transferables:h}=d?u:{},p=d?c.slice(0,-1):c;return new Promise((o,c)=>{const u=void 0!==f?window.setTimeout(()=>{i.delete(l),c(new r("METHOD_CALL_TIMEOUT",`Method call ${m(s)}() timed out after ${f}ms`))},f):void 0;i.set(l,{methodPath:s,resolve:o,reject:c,timeoutId:u});try{const r={namespace:a,channel:t,type:"CALL",id:l,methodPath:s,args:p};n?.(`Sending ${m(s)}() call`,r),e.sendMessage(r,h)}catch(e){c(new r("TRANSMISSION_FAILED",e.message))}})},n),destroy:()=>{o=!0,e.removeMessageHandler(s);for(const{methodPath:e,reject:t,timeoutId:n}of i.values())clearTimeout(n),t(S(e));i.clear()}}})(e,o,i);C.push(u),clearTimeout(P),O=!0,M({remoteProxy:n,destroy:R})},D=()=>{const t={namespace:a,type:"SYN",channel:o,participantId:b};i?.("Sending handshake SYN",t);try{e.sendMessage(t)}catch(e){T(new r("TRANSMISSION_FAILED",e.message))}},F=t=>{u(t)&&(t=>{if(i?.("Received handshake SYN",t),t.participantId===E&&E!==x)return;if(E=t.participantId,D(),!(b>E||E===x))return;const n={namespace:a,channel:o,type:"ACK1",methodPaths:I};i?.("Sending handshake ACK1",n);try{e.sendMessage(n)}catch(e){return void T(new r("TRANSMISSION_FAILED",e.message))}})(t),d(t)&&(t=>{i?.("Received handshake ACK1",t);const n={namespace:a,channel:o,type:"ACK2"};i?.("Sending handshake ACK2",n);try{e.sendMessage(n)}catch(e){return void T(new r("TRANSMISSION_FAILED",e.message))}L()})(t),f(t)&&(e=>{i?.("Received handshake ACK2",e),L()})(t)};return e.addMessageHandler(F),C.push(()=>e.removeMessageHandler(F)),D(),A},A=new WeakSet,M=class{#t;#n;#r;#o;#i;#s=new Set;#a;#c=!1;constructor({remoteWindow:e,allowedOrigins:t}){if(!e)throw new r("INVALID_ARGUMENT","remoteWindow must be defined");this.#t=e,this.#n=t?.length?t:[window.origin]}initialize=({log:e,validateReceivedMessage:t})=>{this.#r=e,this.#o=t,window.addEventListener("message",this.#l)};sendMessage=(e,t)=>{if(u(e)){const n=this.#u(e);return void this.#t.postMessage(e,{targetOrigin:n,transfer:t})}if(d(e)||this.#c){const n=this.#c?(e=>{if(d(e))return{penpal:"synAck",methodNames:e.methodPaths.map(C)};if(h(e))return{penpal:"call",id:e.id,methodName:C(e.methodPath),args:e.args};if(p(e))return e.isError?{penpal:"reply",id:e.callId,resolution:"rejected",...e.isSerializedErrorInstance?{returnValue:e.value,returnValueIsError:!0}:{returnValue:e.value}}:{penpal:"reply",id:e.callId,resolution:"fulfilled",returnValue:e.value};throw O(e)})(e):e,r=this.#u(e);return void this.#t.postMessage(n,{targetOrigin:r,transfer:t})}if(f(e)){const{port1:n,port2:r}=new MessageChannel;this.#a=n,n.addEventListener("message",this.#d),n.start();const o=[r,...t||[]],i=this.#u(e);return void this.#t.postMessage(e,{targetOrigin:i,transfer:o})}if(!this.#a)throw new r("TRANSMISSION_FAILED","Cannot send message because the MessagePort is not connected");this.#a.postMessage(e,{transfer:t})};addMessageHandler=e=>{this.#s.add(e)};removeMessageHandler=e=>{this.#s.delete(e)};destroy=()=>{window.removeEventListener("message",this.#l),this.#f(),this.#s.clear()};#h=e=>this.#n.some(t=>t instanceof RegExp?t.test(e):t===e||"*"===t);#u=e=>{if(u(e))return"*";if(!this.#i)throw new r("TRANSMISSION_FAILED","Cannot send message because the remote origin is not established");return"null"===this.#i&&this.#n.includes("*")?"*":this.#i};#f=()=>{this.#a?.removeEventListener("message",this.#d),this.#a?.close(),this.#a=void 0};#l=({source:e,origin:t,ports:n,data:r})=>{if(e===this.#t){if((e=>c(e)&&"penpal"in e)(r)){this.#r?.("Please upgrade the child window to the latest version of Penpal."),this.#c=!0;try{r=(e=>{if("syn"===e.penpal)return{namespace:a,channel:void 0,type:"SYN",participantId:x};if("ack"===e.penpal)return{namespace:a,channel:void 0,type:"ACK2"};if("call"===e.penpal)return{namespace:a,channel:void 0,type:"CALL",id:e.id,methodPath:(t=e.methodName,t.split(".")),args:e.args};var t;if("reply"===e.penpal)return"fulfilled"===e.resolution?{namespace:a,channel:void 0,type:"REPLY",callId:e.id,value:e.returnValue}:{namespace:a,channel:void 0,type:"REPLY",callId:e.id,isError:!0,...e.returnValueIsError?{value:e.returnValue,isSerializedErrorInstance:!0}:{value:e.returnValue}};throw O(e)})(r)}catch(e){return void this.#r?.(`Failed to translate deprecated message: ${e.message}`)}}if(this.#o?.(r))if(this.#h(t)){if(u(r)&&(this.#f(),this.#i=t),f(r)&&!this.#c){if(this.#a=n[0],!this.#a)return void this.#r?.("Ignoring ACK2 because it did not include a MessagePort");this.#a.addEventListener("message",this.#d),this.#a.start()}for(const e of this.#s)e(r)}else this.#r?.(`Received a message from origin \\`${t}\\` which did not match allowed origins \\`[${this.#n.join(", ")}]\\``)}};#d=({data:e})=>{if(this.#o?.(e))for(const t of this.#s)t(e)}},T=document,P=window,R=Array.prototype,L=R.filter,D=R.indexOf,F=R.map,$=R.push,j=R.reverse,_=R.slice,k=R.splice,W=/^#[\\w-]*$/,z=/^\\.[\\w-]*$/,H=/<.+>/,U=/^\\w+$/;function V(e,t){return void 0===t&&(t=T),z.test(e)?t.getElementsByClassName(e.slice(1)):U.test(e)?t.getElementsByTagName(e):t.querySelectorAll(e)}function B(e,t){if(void 0===t&&(t=T),e){if(e.__cash)return e;var n=e;if(te(e)){if(t.__cash&&(t=t[0]),!(n=W.test(e)?t.getElementById(e.slice(1)):H.test(e)?_e(e):V(e,t)))return}else if(ee(e))return this.ready(e);(n.nodeType||n===P)&&(n=[n]),this.length=n.length;for(var r=0,o=this.length;r<o;r++)this[r]=n[r]}}function Y(e,t){return new B(e,t)}var q=Y.fn=Y.prototype=B.prototype={constructor:Y,__cash:!0,length:0,splice:k};q.get=function(e){return void 0===e?_.call(this):this[e<0?e+this.length:e]},q.eq=function(e){return Y(this.get(e))},q.first=function(){return this.eq(0)},q.last=function(){return this.eq(-1)},q.map=function(e){return Y(F.call(this,function(t,n){return e.call(t,n,t)}))},q.slice=function(){return Y(_.apply(this,arguments))};var K=/(?:^\\w|[A-Z]|\\b\\w)/g,G=/[\\s-_]+/g;function X(e){return e.replace(K,function(e,t){return e[t?"toUpperCase":"toLowerCase"]()}).replace(G,"")}function J(e,t){for(var n=0,r=e.length;n<r&&!1!==t.call(e[n],e[n],n,e);n++);}Y.camelCase=X,Y.each=J,q.each=function(e){return J(this,function(t,n){return e.call(t,n,t)}),this},q.removeProp=function(e){return this.each(function(t,n){delete n[e]})},Y.extend=q.extend=function(e){void 0===e&&(e=this);for(var t=arguments,n=t.length,r=n<2?0:1;r<n;r++)for(var o in t[r])e[o]=t[r][o];return e};var Z=1;function Q(e,t){var n=e&&(e.matches||e.webkitMatchesSelector||e.mozMatchesSelector||e.msMatchesSelector||e.oMatchesSelector);return!!n&&n.call(e,t)}function ee(e){return"function"==typeof e}function te(e){return"string"==typeof e}function ne(e){return!isNaN(parseFloat(e))&&isFinite(e)}Y.guid=Z,Y.matches=Q,Y.isFunction=ee,Y.isString=te,Y.isNumeric=ne;var re=Array.isArray;function oe(e){return te(e)?function(t,n){return Q(n,e)}:e.__cash?function(t,n){return e.is(n)}:function(e,t,n){return t===n}}Y.isArray=re,q.prop=function(e,t){if(e){if(te(e))return arguments.length<2?this[0]&&this[0][e]:this.each(function(n,r){r[e]=t});for(var n in e)this.prop(n,e[n]);return this}},q.filter=function(e){if(!e)return Y();var t=ee(e)?e:oe(e);return Y(L.call(this,function(n,r){return t.call(n,r,n,e)}))};var ie=/\\S+/g;function se(e){return te(e)&&e.match(ie)||[]}function ae(e){return e.filter(function(e,t,n){return n.indexOf(e)===t})}function ce(e,t,n){if(1===e.nodeType){var r=P.getComputedStyle(e,null);return t?n?r.getPropertyValue(t):r[t]:r}}function le(e,t){return parseInt(ce(e,t),10)||0}q.hasClass=function(e){var t=se(e),n=!1;return t.length&&this.each(function(e,r){return!(n=r.classList.contains(t[0]))}),n},q.removeAttr=function(e){var t=se(e);return t.length?this.each(function(e,n){J(t,function(e){n.removeAttribute(e)})}):this},q.attr=function(e,t){if(e){if(te(e)){if(arguments.length<2){if(!this[0])return;var n=this[0].getAttribute(e);return null===n?void 0:n}return null===t?this.removeAttr(e):this.each(function(n,r){r.setAttribute(e,t)})}for(var r in e)this.attr(r,e[r]);return this}},q.toggleClass=function(e,t){var n=se(e),r=void 0!==t;return n.length?this.each(function(e,o){J(n,function(e){r?t?o.classList.add(e):o.classList.remove(e):o.classList.toggle(e)})}):this},q.addClass=function(e){return this.toggleClass(e,!0)},q.removeClass=function(e){return arguments.length?this.toggleClass(e,!1):this.attr("class","")},Y.unique=ae,q.add=function(e,t){return Y(ae(this.get().concat(Y(e,t).get())))};var ue=/^--/;function de(e){return ue.test(e)}var fe={},he=T.createElement("div").style,pe=["webkit","moz","ms","o"];function ge(e,t){if(void 0===t&&(t=de(e)),t)return e;if(!fe[e]){var n=X(e),r=""+n.charAt(0).toUpperCase()+n.slice(1);J((n+" "+pe.join(r+" ")+r).split(" "),function(t){if(t in he)return fe[e]=t,!1})}return fe[e]}Y.prefixedProp=ge;var me={animationIterationCount:!0,columnCount:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0};function ve(e,t,n){return void 0===n&&(n=de(e)),n||me[e]||!ne(t)?t:t+"px"}q.css=function(e,t){if(te(e)){var n=de(e);return e=ge(e,n),arguments.length<2?this[0]&&ce(this[0],e,n):e?(t=ve(e,t,n),this.each(function(r,o){1===o.nodeType&&(n?o.style.setProperty(e,t):o.style[e]=t)})):this}for(var r in e)this.css(r,e[r]);return this};var ye="__cashData",be=/^data-(.*)/;function we(e){return e[ye]=e[ye]||{}}function Ee(e,t){var n=we(e);if(t){if(!(t in n)){var r=e.dataset?e.dataset[t]||e.dataset[X(t)]:Y(e).attr("data-"+t);if(void 0!==r){try{r=JSON.parse(r)}catch(e){}n[t]=r}}return n[t]}return n}function Ne(e,t){return le(e,"border"+(t?"Left":"Top")+"Width")+le(e,"padding"+(t?"Left":"Top"))+le(e,"padding"+(t?"Right":"Bottom"))+le(e,"border"+(t?"Right":"Bottom")+"Width")}function Se(e,t){for(var n=0,r=t.length;n<r;n++)if(e.indexOf(t[n])<0)return!1;return!0}function xe(e,t,n){J(e[n],function(e){e[0];var r=e[1];t.removeEventListener(n,r)}),delete e[n]}Y.hasData=function(e){return ye in e},q.data=function(e,t){var n=this;if(!e){if(!this[0])return;return J(this[0].attributes,function(e){var t=e.name.match(be);t&&n.data(t[1])}),Ee(this[0])}if(te(e))return void 0===t?this[0]&&Ee(this[0],e):this.each(function(n,r){return function(e,t,n){we(e)[t]=n}(r,e,t)});for(var r in e)this.data(r,e[r]);return this},q.removeData=function(e){return this.each(function(t,n){return function(e,t){void 0===t?delete e[ye]:delete we(e)[t]}(n,e)})},J(["Width","Height"],function(e){q["inner"+e]=function(){if(this[0])return this[0]===P?P["inner"+e]:this[0]["client"+e]}}),J(["width","height"],function(e,t){q[e]=function(n){return this[0]?arguments.length?(n=parseInt(n,10),this.each(function(r,o){if(1===o.nodeType){var i=ce(o,"boxSizing");o.style[e]=ve(e,n+("border-box"===i?Ne(o,!t):0))}})):this[0]===P?this[0][X("outer-"+e)]:this[0].getBoundingClientRect()[e]-Ne(this[0],!t):void 0===n?void 0:this}}),J(["Width","Height"],function(e,t){q["outer"+e]=function(n){if(this[0])return this[0]===P?P["outer"+e]:this[0]["offset"+e]+(n?le(this[0],"margin"+(t?"Top":"Left"))+le(this[0],"margin"+(t?"Bottom":"Right")):0)}});var Ce="__cashEvents";function Oe(e){return e[Ce]=e[Ce]||{}}function Ie(e){var t=e.split(".");return[t[0],t.slice(1).sort()]}function Ae(e,t,n,r){var o=Oe(e);if(t){var i=o[t];if(!i)return;r&&(r.guid=r.guid||Z++),o[t]=i.filter(function(o){var i=o[0],s=o[1];if(r&&s.guid!==r.guid||!Se(i,n))return!0;e.removeEventListener(t,s)})}else if(n&&n.length)for(t in o)Ae(e,t,n,r);else for(t in o)xe(o,e,t)}q.off=function(e,t){var n=this;return void 0===e?this.each(function(e,t){return Ae(t)}):J(se(e),function(e){var r=Ie(e),o=r[0],i=r[1];n.each(function(e,n){return Ae(n,o,i,t)})}),this},q.on=function(e,t,n,r){var o=this;if(!te(e)){for(var i in e)this.on(i,t,e[i]);return this}return ee(t)&&(n=t,t=!1),J(se(e),function(e){var i=Ie(e),s=i[0],a=i[1];o.each(function(e,o){var i=function e(i){if(!i.namespace||Se(a,i.namespace.split("."))){var c=o;if(t){for(var l=i.target;!Q(l,t);){if(l===o)return;if(!(l=l.parentNode))return}c=l}i.namespace=i.namespace||"";var u=n.call(c,i,i.data);r&&Ae(o,s,a,e),!1===u&&(i.preventDefault(),i.stopPropagation())}};i.guid=n.guid=n.guid||Z++,function(e,t,n,r){r.guid=r.guid||Z++;var o=Oe(e);o[t]=o[t]||[],o[t].push([n,r]),e.addEventListener(t,r)}(o,s,a,i)})}),this},q.one=function(e,t,n){return this.on(e,t,n,!0)},q.ready=function(e){var t=function(){return e(Y)};return"loading"!==T.readyState?setTimeout(t):T.addEventListener("DOMContentLoaded",t),this},q.trigger=function(e,t){var n=e;if(te(e)){var r=Ie(e),o=r[0],i=r[1];(n=T.createEvent("HTMLEvents")).initEvent(o,!0,!0),n.namespace=i.join(".")}return n.data=t,this.each(function(e,t){t.dispatchEvent(n)})};var Me=/select-one/i,Te=/select-multiple/i;function Pe(e){var t=e.type;return Me.test(t)?function(e){return e.selectedIndex<0?null:e.options[e.selectedIndex].value}(e):Te.test(t)?function(e){var t=[];return J(e.options,function(e){!e.selected||e.disabled||e.parentNode.disabled||t.push(e.value)}),t}(e):e.value}var Re=/%20/g,Le=/file|reset|submit|button|image/i,De=/radio|checkbox/i;q.serialize=function(){var e="";return this.each(function(t,n){J(n.elements||[n],function(t){if(!t.disabled&&t.name&&"FIELDSET"!==t.tagName&&!Le.test(t.type)&&(!De.test(t.type)||t.checked)){var n=Pe(t);void 0!==n&&J(re(n)?n:[n],function(n){e+=function(e,t){return"&"+encodeURIComponent(e)+"="+encodeURIComponent(t).replace(Re,"+")}(t.name,n)})}})}),e.substr(1)},q.val=function(e){return void 0===e?this[0]&&Pe(this[0]):this.each(function(t,n){var r=Te.test(n.type),o=null===e?r?[]:"":e;r&&re(o)?J(n.options,function(e){e.selected=o.indexOf(e.value)>=0}):n.value=o})},q.clone=function(){return this.map(function(e,t){return t.cloneNode(!0)})},q.detach=function(){return this.each(function(e,t){t.parentNode&&t.parentNode.removeChild(t)})};var Fe,$e=/^\\s*<(\\w+)[^>]*>/,je=/^\\s*<(\\w+)\\s*\\/?>(?:<\\/\\1>)?\\s*$/;function _e(e){if(function(){if(!Fe){var e=T.createElement("table"),t=T.createElement("tr");Fe={"*":T.createElement("div"),tr:T.createElement("tbody"),td:t,th:t,thead:e,tbody:e,tfoot:e}}}(),!te(e))return[];if(je.test(e))return[T.createElement(RegExp.$1)];var t=$e.test(e)&&RegExp.$1,n=Fe[t]||Fe["*"];return n.innerHTML=e,Y(n.childNodes).detach().get()}function ke(e,t,n){if(void 0!==t){var r=te(t);!r&&t.length?J(t,function(t){return ke(e,t,n)}):J(e,r?function(e){e.insertAdjacentHTML(n?"afterbegin":"beforeend",t)}:function(e,r){return function(e,t,n){n?e.insertBefore(t,e.childNodes[0]):e.appendChild(t)}(e,r?t.cloneNode(!0):t,n)})}}Y.parseHTML=_e,q.empty=function(){var e=this[0];if(e)for(;e.firstChild;)e.removeChild(e.firstChild);return this},q.append=function(){var e=this;return J(arguments,function(t){ke(e,t)}),this},q.appendTo=function(e){return ke(Y(e),this),this},q.html=function(e){if(void 0===e)return this[0]&&this[0].innerHTML;var t=e.nodeType?e[0].outerHTML:e;return this.each(function(e,n){n.innerHTML=t})},q.insertAfter=function(e){var t=this;return Y(e).each(function(e,n){var r=n.parentNode;t.each(function(t,o){r.insertBefore(e?o.cloneNode(!0):o,n.nextSibling)})}),this},q.after=function(){var e=this;return J(j.apply(arguments),function(t){j.apply(Y(t).slice()).insertAfter(e)}),this},q.insertBefore=function(e){var t=this;return Y(e).each(function(e,n){var r=n.parentNode;t.each(function(t,o){r.insertBefore(e?o.cloneNode(!0):o,n)})}),this},q.before=function(){var e=this;return J(arguments,function(t){Y(t).insertBefore(e)}),this},q.prepend=function(){var e=this;return J(arguments,function(t){ke(e,t,!0)}),this},q.prependTo=function(e){return ke(Y(e),j.apply(this.slice()),!0),this},q.remove=function(){return this.detach().off()},q.replaceWith=function(e){var t=this;return this.each(function(n,r){var o=r.parentNode;if(o){var i=n?Y(e).clone():Y(e);if(!i[0])return t.remove(),!1;o.replaceChild(i[0],r),Y(i[0]).after(i.slice(1))}})},q.replaceAll=function(e){return Y(e).replaceWith(this),this},q.text=function(e){return void 0===e?this[0]?this[0].textContent:"":this.each(function(t,n){n.textContent=e})};var We=T.documentElement;q.offset=function(){var e=this[0];if(e){var t=e.getBoundingClientRect();return{top:t.top+P.pageYOffset-We.clientTop,left:t.left+P.pageXOffset-We.clientLeft}}},q.offsetParent=function(){return Y(this[0]&&this[0].offsetParent)},q.position=function(){var e=this[0];if(e)return{left:e.offsetLeft,top:e.offsetTop}},q.children=function(e){var t=[];return this.each(function(e,n){$.apply(t,n.children)}),t=Y(ae(t)),e?t.filter(function(t,n){return Q(n,e)}):t},q.contents=function(){var e=[];return this.each(function(t,n){$.apply(e,"IFRAME"===n.tagName?[n.contentDocument]:n.childNodes)}),Y(e.length&&ae(e))},q.find=function(e){for(var t=[],n=0,r=this.length;n<r;n++){var o=V(e,this[n]);o.length&&$.apply(t,o)}return Y(t.length&&ae(t))},q.has=function(e){var t=te(e)?function(t,n){return!!V(e,n).length}:function(t,n){return n.contains(e)};return this.filter(t)},q.is=function(e){if(!e||!this[0])return!1;var t=oe(e),n=!1;return this.each(function(r,o){return!(n=t(r,o,e))}),n},q.next=function(){return Y(this[0]&&this[0].nextElementSibling)},q.not=function(e){if(!e||!this[0])return this;var t=oe(e);return this.filter(function(n,r){return!t(n,r,e)})},q.parent=function(){var e=[];return this.each(function(t,n){n&&n.parentNode&&e.push(n.parentNode)}),Y(ae(e))},q.index=function(e){var t=e?Y(e)[0]:this[0],n=e?this:Y(t).parent().children();return D.call(n,t)},q.closest=function(e){return e&&this[0]?this.is(e)?this.filter(e):this.parent().closest(e):Y()},q.parents=function(e){var t,n=[];return this.each(function(r,o){for(t=o;t&&t.parentNode&&t!==T.body.parentNode;)t=t.parentNode,(!e||e&&Q(t,e))&&n.push(t)}),Y(ae(n))},q.prev=function(){return Y(this[0]&&this[0].previousElementSibling)},q.siblings=function(){var e=this[0];return this.parent().children().filter(function(t,n){return n!==e})};const ze=Y,He=new class{getFiberNode(e){try{const t=Object.keys(e).find(e=>e.startsWith("__reactFiber$")||e.startsWith("__reactInternalInstance$"));return t?e[t]:null}catch(e){return console.warn("[ReactFiberService] Error getting fiber node:",e),null}}getDebugOwner(e){const t=this.getFiberNode(e);return t?._debugOwner??null}getDebugSource(e){const t=this.getFiberNode(e);return t?._debugSource??null}getOwnerDebugSource(e){const t=this.getDebugOwner(e);return t?._debugSource??null}hasDirectSourceInfo(e){return!!e.getAttribute("data-nocode-id")||!!this.getDebugSource(e)}hasOwnerNocodeId(e){const t=this.getDebugOwner(e);if(!t?.memoizedProps)return!1;const n=t.memoizedProps["data-nocode-id"];return"string"==typeof n&&n.length>0}getOwnerNocodeId(e){const t=this.getDebugOwner(e);if(!t?.memoizedProps)return null;const n=t.memoizedProps["data-nocode-id"];return"string"==typeof n?n:null}isSelectableElement(e){if(this.hasDirectSourceInfo(e))return!0;const t=this.getFiberNode(e),n=this.getOwnerDebugSource(e);return!!(t?.return&&5!==t.return.tag&&this.hasOwnerNocodeId(e)&&n)}isComponent(e){if(!this.isSelectableElement(e))return!1;if(e.getAttribute("data-nocode-components-name"))return!0;if(this.getDebugSource(e))return!1;const t=this.getFiberNode(e);return!(!t?.return||5===t.return.tag)}getComponentName(e){const t=e.getAttribute("data-nocode-tag-name");if(t)return t;const n=this.getDebugOwner(e);if(n?.type){const e=n.type;if("function"==typeof e){const t=e.displayName||e.name||"Unknown";return this.normalizeComponentName(t)}if("string"==typeof e)return e}return e.tagName.toLowerCase()}normalizeComponentName(e){return e.replace(/\\d+$/,"")}getComponentProps(e){if(!this.isComponent(e))return;const t=this.getDebugOwner(e);return t?.memoizedProps?this.sanitizeProps(t.memoizedProps):void 0}sanitizeProps(e){const t={};for(const[n,r]of Object.entries(e)){if("children"===n||n.startsWith("_"))continue;const e=this.sanitizeValue(r);void 0!==e&&(t[n]=e)}return t}sanitizeValue(e){if(null===e)return null;if(void 0===e)return;if("function"==typeof e)return;if("symbol"==typeof e)return;if("object"!=typeof e)return e;if("$$typeof"in e)return;if(e instanceof Node)return;if(Array.isArray(e)){const t=[];for(const n of e){const e=this.sanitizeValue(n);void 0!==e&&t.push(e)}return t}const t={};for(const[n,r]of Object.entries(e)){if(n.startsWith("_"))continue;const e=this.sanitizeValue(r);void 0!==e&&(t[n]=e)}return t}buildComponentInfo(e){const t=this.isComponent(e),n={isComponent:t,componentType:t?"component":"host",name:t?this.getComponentName(e):e.tagName.toLowerCase()},r=e.getAttribute("data-nocode-components-name"),o=e.getAttribute("data-nocode-components-version");if(r&&(n.componentsName=r),o&&(n.componentsVersion=o),t){const t=this.getComponentProps(e)??{},r=this.removeSpecialProps(t);n.props=r}return n}removeSpecialProps(e){const t={};for(const[n,r]of Object.entries(e))"componentsName"!==n&&"componentsVersion"!==n&&(n.startsWith("data-nocode-")||(t[n]=r));return t}},Ue="data-dnd";function Ve(e){if(!e)return{};const t=e.split(":");if(t.length>=3){const n=t.pop(),r=t.pop(),o=t.join(":");return{id:e,filename:decodeURIComponent(o),component:r,codeId:n}}return 2===t.length?{id:e,component:t[0],codeId:t[1]}:{id:e}}const Be=`[${Ue}]`;function Ye(e,t){const n=t??0;return 0===n?document.querySelector(`[${Ue}="${e}"]`):document.querySelectorAll(`[${Ue}="${e}"]`)[n]??null}const qe=(e,t)=>{const n=((e,t)=>{const n=e.getBoundingClientRect(),{x:r,y:o}=((e,t)=>{let n=e.x,r=e.y;if(t){const e=t.getBoundingClientRect();n-=e.left,r-=e.top}return{x:n,y:r}})({x:n.left,y:n.top},t);return{width:e.offsetWidth||Math.round(n.width),height:e.offsetHeight||Math.round(n.height),top:o,left:r}})(e,t),r=function(e){return e.dataset}(e),o=Ke(e),i=Ge(e),s=(e=>{const t=window.getComputedStyle(e);return{display:t.display,flexDirection:t.flexDirection,flexWrap:t.flexWrap,position:t.position}})(e),a=r.dnd||"",c=Ve(a),l=function(e){return He.buildComponentInfo(e)}(e),u=function(e){return"true"===e.getAttribute("data-nocode-container-placeholder")}(e);let d;if(a){const t=document.querySelectorAll(`[${Ue}="${a}"]`);if(t.length>1)for(let n=0;n<t.length;n++)if(t[n]===e){d=n;break}}return{id:a,codeId:c.codeId,name:c.component||e.tagName.toLowerCase(),filename:c.filename,bounding:n,display:o,computedStyle:s,text:i,containerPlaceholder:u||void 0,componentInfo:l,dndIndex:d}},Ke=e=>ze(e).css("display"),Ge=e=>{const t=[];return e.childNodes.forEach(e=>{if(e.nodeType===Node.TEXT_NODE){const n=e.textContent?.trim()||"";n&&t.push(n)}}),t.join(" ")},Xe=e=>{const t=ze(e).closest(Be).get(0),n=ze(e).parents(Be).get();return n[0]!==t&&n.unshift(t),n};function Je(e){const t=["div","p","section","article","main","header","footer","nav","h1","h2","h3","h4","h5","h6","span","a","button","i","input","textarea","select","label","form","ul","ol","li","table","thead","tbody","tr","td","th","img","video","audio","canvas","svg"];try{const n=e.tagName.toLowerCase();if(!t.includes(n))return!1;const r=window.getComputedStyle(e);if("none"===r.display||"hidden"===r.visibility||"0"===r.opacity)return!1;const o=e.getBoundingClientRect();if(0===o.width||0===o.height)return;return!("inline"!==r.display&&"inline-block"!==r.display&&(0===o.width||0===o.height))}catch(e){return console.warn("Element validation failed:",e),!1}}function Ze(e,t=20){let n=e,r=0;for(;n&&r<t;){if(n.getAttribute(Ue))return n;n=n.parentElement,r++}return null}function Qe(e){const t=window.getComputedStyle(e),n={};for(let e=0;e<t.length;e++){const r=t[e];n[r]=t.getPropertyValue(r)}return n}let et=null,tt=new Set;const nt=e=>{const t=[],n=Array.from(e.children);for(;n.length;){const e=n.shift();e.getAttribute("data-dnd")?t.push(e):n.push(...Array.from(e.children))}return t},rt=e=>{let t=e.parentElement;for(;t;){if(t.getAttribute("data-dnd"))return t;t=t.parentElement}return null},ot=e=>{let t=(e=>{const t=new Set(e);return e.filter(e=>{let n=e.parentElement;for(;n;){if(t.has(n))return!1;n=n.parentElement}return!0})})(e),n=!0;for(;n;){n=!1;const e=new Map;for(const n of t){const t=rt(n);t&&(e.has(t)||e.set(t,[]),e.get(t).push(n))}for(const[r,o]of e){const e=nt(r);if(0===e.length)continue;const i=new Set(o);if(e.every(e=>i.has(e))){t=t.filter(e=>!o.includes(e)),t.includes(r)||t.push(r),n=!0;break}}}return t};function it(e){return(...t)=>{try{const n=e(...t);return n&&"function"==typeof n.then?n.catch(n=>(console.error(`Async error in ${e.name}:`,n),console.error("Error stack:",n.stack),console.error("Function arguments:",t),null)):n}catch(n){return console.error(`Sync error in ${e.name}:`,n),n instanceof Error&&console.error("Error stack:",n.stack),console.error("Function arguments:",t),null}}}const st={getDraggableParentsData:(e,t)=>{const n=function(e,t){const n=((e,t)=>{const n=document.elementFromPoint(e,t);if(!n)return null;const r=n=>{if(n?.shadowRoot){const o=n.shadowRoot.elementFromPoint(e,t);return o===n?n:o?.shadowRoot?r(o):o||n}return n};return r(n)})(e,t);if(!n)return null;let r=n;if(!Je(r)){let e=r.parentElement,t=0;const n=20;for(;e&&t<n;){if(Je(e)){r=e;break}e=e.parentElement,t++}if(!Je(r))return null}const o=Ze(r);return o&&Je(o)?o:null}(e.x,e.y);if(!n)return;let r=Xe(n);if(r.length&&(r=(e=>{for(let t=e.length-1;t>=0;t--){const n=(e[t].getAttribute("data-dnd")||"").split(":"),r=n.length>=2?n[n.length-2]:"";if(r&&/^[A-Z]/.test(r)&&!tt.has(r))return e.slice(t)}return e})(r),r.length)){if(t){const e=r.map(e=>qe(e));return{...e[0],computedStyle:Qe(r[0]),parents:e.slice(1)}}return{...qe(r[0]),computedStyle:Qe(r[0])}}},getElementDataById:(e,t)=>{const n=Ye(e,t);if(n)return{...qe(n),computedStyle:Qe(n)};console.warn("[getElementDataById] Element not found for domId:",e,"dndIndex:",t)},getEditableTextElementAtPosition:e=>{const t=function(e,t){if(document.caretPositionFromPoint){const n=document.caretPositionFromPoint(e,t);return n?.offsetNode??null}if(document.caretRangeFromPoint){const n=document.caretRangeFromPoint(e,t);return n?.startContainer??null}return document.elementFromPoint(e,t)}(e.x,e.y);if(!t)return void console.log("[getEditableTextElementAtPosition] No node at point:",e);if(t.nodeType!==Node.TEXT_NODE)return void console.log("[getEditableTextElementAtPosition] Not a text node:",t.nodeType);const n=t.textContent?.trim();if(!n)return void console.log("[getEditableTextElementAtPosition] Empty text node");const r=t.parentElement;if(!r)return void console.log("[getEditableTextElementAtPosition] No parent element");const o=Ze(r);if(o){if(function(e){const t=e.childNodes;let n=!1;for(let e=0;e<t.length;e++){const r=t[e];if(r.nodeType===Node.ELEMENT_NODE)return!1;if(r.nodeType===Node.TEXT_NODE){const e=r.textContent?.trim();e&&(n=!0)}}return n}(o))return console.log("[getEditableTextElementAtPosition] Found editable text element:",o.tagName,o.textContent),{...qe(o),computedStyle:Qe(o)};console.log("[getEditableTextElementAtPosition] Element has child elements, cannot edit directly:",o.tagName)}else console.log("[getEditableTextElementAtPosition] No marked element found")},updateElementTextContent:(e,t)=>{const n=Ye(e);return n?(n.textContent=t,!0):(console.warn("[updateElementTextContent] Element not found:",e),!1)},scrollToElement:(e,t)=>{const n=Ye(e,t);return n?(n.scrollIntoView({behavior:"instant",block:"center",inline:"center"}),!0):(console.warn("[scrollToElement] Element not found for domId:",e,"dndIndex:",t),!1)},scrollPageBy:(e,t)=>(window.scrollBy(e,t),!0),highlightElement:(e,t)=>{if(et&&(et.style.outline="",et.style.outlineOffset="",et=null),!e)return!0;const n=Ye(e,t);return n?(n.style.outline="2px solid rgba(54, 210, 190, 0.8)",n.style.outlineOffset="-1px",et=n,!0):(console.warn("[highlightElement] Element not found:",e,"dndIndex:",t),!1)},getProjectLibVersions:function(){try{const e=document.body;if(!e)return console.warn("[sandbox] document.body is not available"),null;const t=e.getAttribute("data-nocode-lib-versions");if(!t)return console.warn("[sandbox] data-nocode-lib-versions attribute not found on body"),null;const n=JSON.parse(t);return"object"!=typeof n||null===n?(console.warn("[sandbox] data-nocode-lib-versions is not a valid object"),null):n}catch(e){return console.error("[sandbox] Failed to parse data-nocode-lib-versions:",e),null}},getCompilerVersion:function(){try{const e=document.body;return e?e.getAttribute("data-nocode-compiler-version"):null}catch(e){return console.error("[sandbox] Failed to get compiler version:",e),null}},getRuntimeNodeTree:()=>{try{const e=document.querySelectorAll(Be);if(!e.length)return[];const t=new Map;e.forEach(e=>{const n=e.getAttribute(Ue)||"";if(!n)return;const r=Ve(n);t.set(e,{id:n,component:r.component||e.tagName.toLowerCase(),children:[]})});const n=[];e.forEach(e=>{const r=t.get(e);if(!r)return;let o,i=e.parentElement;for(;i;){if(t.has(i)){o=t.get(i);break}i=i.parentElement}o?o.children.push(r):n.push(r)});const r=e=>{e.children&&0===e.children.length?delete e.children:e.children&&e.children.forEach(r)};return n.forEach(r),n}catch(e){return console.error("[sandbox] Failed to build runtime node tree:",e),[]}},setElementStyle:function(e,t){const n=function(e){return document.querySelector(`[${Ue}="${e}"]`)}(e);return n?(Object.entries(t).forEach(([e,t])=>{n.style[e]=t}),!0):(console.warn("[setElementStyle] Element not found for domId:",e),!1)},getElementsInRect:e=>{const t=function(e){const t=document.querySelectorAll(Be),n=[];return t.forEach(t=>{const r=t,o=r.getBoundingClientRect();if(0===o.width||0===o.height)return;const i={x:o.left,y:o.top,width:o.width,height:o.height},s=e.width*e.height;var a,c;i.width*i.height<=2*s&&(c=i,(a=e).x<c.x+c.width&&a.x+a.width>c.x&&a.y<c.y+c.height&&a.y+a.height>c.y)&&n.push(r)}),n}(e);if(t.length)return{selectedItems:ot(t).map(e=>({...qe(e),computedStyle:Qe(e),parents:Xe(e).slice(1).map(e=>qe(e))}))}},setSelectConfig:e=>(tt=new Set(e),console.log("[sandbox] setSelectConfig:",e),!0)},at=Object.fromEntries(Object.entries(st).map(([e,t])=>[e,it(t)])),ct="nocode-design-mode";let lt=null,ut=!1,dt=null;const ft=t()(()=>{lt?.onWindowMutated&&(console.log(`${ct} - Notifying parent of DOM mutation`),lt.onWindowMutated({added:{},removed:{}}))},100),ht=async()=>{if(ut||lt)return lt;ut=!0,console.log(`${ct} - Creating penpal connection`);const e=(({messenger:e,methods:t={},timeout:n,channel:o,log:i})=>{if(!e)throw new r("INVALID_ARGUMENT","messenger must be defined");if(A.has(e))throw new r("INVALID_ARGUMENT","A messenger can only be used for a single connection");A.add(e);const s=[e.destroy],l=(e=>{let t,n=!1;return(...r)=>(n||(n=!0,t=e(...r)),t)})(t=>{if(t){const t={namespace:a,channel:o,type:"DESTROY"};try{e.sendMessage(t)}catch(e){}}for(const e of s)e();i?.("Connection destroyed")}),u=e=>(e=>c(e)&&e.namespace===a)(e)&&e.channel===o;return{promise:(async()=>{try{e.initialize({log:i,validateReceivedMessage:u}),e.addMessageHandler(e=>{(e=>"DESTROY"===e.type)(e)&&l(!1)});const{remoteProxy:r,destroy:a}=await I({messenger:e,methods:t,timeout:n,channel:o,log:i});return s.push(a),r}catch(e){throw l(!0),e}})(),destroy:()=>{l(!0)}}})({messenger:new M({remoteWindow:window===window.top?(console.warn(`${ct} - Not in an iframe, using window.parent as fallback`),window.parent):window.parent===window.top?window.parent:window.top?(console.log(`${ct} - Using window.top for nested iframe scenario`),window.top):window.parent,allowedOrigins:["*"]}),methods:at});return e.promise.then(e=>{if(!e)return console.error(`${ct} - Failed to setup penpal connection: child is null`),void pt();lt=e,console.log(`${ct} - Penpal connection set`),(()=>{if(dt)return;dt=new MutationObserver(e=>{e.some(e=>{const t=e.target;return"SCRIPT"!==t.tagName&&"STYLE"!==t.tagName&&("attributes"!==e.type||"style"===e.attributeName||"class"===e.attributeName)})&&ft()});const e=()=>{document.body&&dt&&(dt.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style","class"],characterData:!0}),console.log(`${ct} - MutationObserver started`))};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",e):e()})()}).finally(()=>{ut=!1}),e.promise.catch(e=>{console.error(`${ct} - Failed to setup penpal connection:`,e),pt()}),lt},pt=t()(()=>{ut||(console.log(`${ct} - Reconnecting to penpal parent`),lt=null,ht())},1e3);ht()})()})();';
380
380
  }
381
381
  function createSandboxScriptMiddleware(options) {
382
382
  var _a;
package/dist/index.js CHANGED
@@ -144,7 +144,7 @@ function readJsonBody(req) {
144
144
  }
145
145
 
146
146
  // package.json
147
- var version = "0.5.0";
147
+ var version = "0.5.1-beta.0";
148
148
 
149
149
  // src/design-mode/types.ts
150
150
  var SANDBOX_SCRIPT_PATH = "/sandbox-script.js";
@@ -341,7 +341,7 @@ function createVirtualCodeMiddleware(server, options, projectRoot) {
341
341
 
342
342
  // src/design-mode/sandbox-script.ts
343
343
  function getSandboxScriptContent() {
344
- return '(()=>{var e={6:(e,t,n)=>{var r=n(714).Symbol;e.exports=r},12:(e,t,n)=>{var r=n(400),o=n(835),i=n(639),s=Math.max,a=Math.min;e.exports=function(e,t,n){var c,u,l,d,f,h,p=0,g=!1,m=!1,v=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function y(t){var n=c,r=u;return c=u=void 0,p=t,d=e.apply(r,n)}function b(e){var n=e-h;return void 0===h||n>=t||n<0||m&&e-p>=l}function w(){var e=o();if(b(e))return E(e);f=setTimeout(w,function(e){var n=t-(e-h);return m?a(n,l-(e-p)):n}(e))}function E(e){return f=void 0,v&&c?y(e):(c=u=void 0,d)}function N(){var e=o(),n=b(e);if(c=arguments,u=this,h=e,n){if(void 0===f)return function(e){return p=e,f=setTimeout(w,t),g?y(e):d}(h);if(m)return clearTimeout(f),f=setTimeout(w,t),y(h)}return void 0===f&&(f=setTimeout(w,t)),d}return t=i(t)||0,r(n)&&(g=!!n.leading,l=(m="maxWait"in n)?s(i(n.maxWait)||0,t):l,v="trailing"in n?!!n.trailing:v),N.cancel=function(){void 0!==f&&clearTimeout(f),p=0,c=h=u=f=void 0},N.flush=function(){return void 0===f?d:E(o())},N}},103:(e,t,n)=>{var r=n(997),o=/^\\s+/;e.exports=function(e){return e?e.slice(0,r(e)+1).replace(o,""):e}},271:(e,t,n)=>{var r=n(6),o=n(650),i=n(881),s=r?r.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":s&&s in Object(e)?o(e):i(e)}},400:e=>{e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},583:e=>{e.exports=function(e){return null!=e&&"object"==typeof e}},603:(e,t,n)=>{var r="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g;e.exports=r},639:(e,t,n)=>{var r=n(103),o=n(400),i=n(975),s=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,c=/^0o[0-7]+$/i,u=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(i(e))return NaN;if(o(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=o(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=r(e);var n=a.test(e);return n||c.test(e)?u(e.slice(2),n?2:8):s.test(e)?NaN:+e}},650:(e,t,n)=>{var r=n(6),o=Object.prototype,i=o.hasOwnProperty,s=o.toString,a=r?r.toStringTag:void 0;e.exports=function(e){var t=i.call(e,a),n=e[a];try{e[a]=void 0;var r=!0}catch(e){}var o=s.call(e);return r&&(t?e[a]=n:delete e[a]),o}},714:(e,t,n)=>{var r=n(603),o="object"==typeof self&&self&&self.Object===Object&&self,i=r||o||Function("return this")();e.exports=i},835:(e,t,n)=>{var r=n(714);e.exports=function(){return r.Date.now()}},881:e=>{var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},975:(e,t,n)=>{var r=n(271),o=n(583);e.exports=function(e){return"symbol"==typeof e||o(e)&&"[object Symbol]"==r(e)}},997:e=>{var t=/\\s/;e.exports=function(e){for(var n=e.length;n--&&t.test(e.charAt(n)););return n}}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";var e=n(12),t=n.n(e),r=class extends Error{code;constructor(e,t){super(t),this.name="PenpalError",this.code=e}},o=e=>({name:e.name,message:e.message,stack:e.stack,penpalCode:e instanceof r?e.code:void 0}),i=Symbol("Reply"),s=class{value;transferables;#e=i;constructor(e,t){this.value=e,this.transferables=t?.transferables}},a="penpal",c=e=>"object"==typeof e&&null!==e,u=e=>"function"==typeof e,l=e=>"SYN"===e.type,d=e=>"ACK1"===e.type,f=e=>"ACK2"===e.type,h=e=>"CALL"===e.type,p=e=>"REPLY"===e.type,g=(e,t=[])=>{const n=[];for(const r of Object.keys(e)){const o=e[r];u(o)?n.push([...t,r]):c(o)&&n.push(...g(o,[...t,r]))}return n},m=e=>e.join("."),v=(e,t,n)=>({namespace:a,channel:e,type:"REPLY",callId:t,isError:!0,...n instanceof Error?{value:o(n),isSerializedErrorInstance:!0}:{value:n}}),y=crypto.randomUUID?.bind(crypto)??(()=>new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")),b=Symbol("CallOptions"),w=class{transferables;timeout;#e=b;constructor(e){this.transferables=e?.transferables,this.timeout=e?.timeout}},E=new Set(["apply","call","bind"]),N=(e,t,n=[])=>new Proxy(n.length?()=>{}:Object.create(null),{get(r,o){if("then"!==o)return n.length&&E.has(o)?Reflect.get(r,o):N(e,t,[...n,o])},apply:(t,r,o)=>e(n,o)}),S=e=>new r("CONNECTION_DESTROYED",`Method call ${m(e)}() failed due to destroyed connection`),C="deprecated-penpal",x=e=>e.join("."),O=e=>new r("TRANSMISSION_FAILED",`Unexpected message to translate: ${(e=>{try{return JSON.stringify(e)}catch(t){return String(e)}})(e)}`),I=({messenger:e,methods:t,timeout:n,channel:o,log:i})=>{const b=y();let E;const x=[];let O=!1;const I=g(t),{promise:M,resolve:T,reject:P}=(()=>{let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}})(),A=void 0!==n?setTimeout(()=>{P(new r("CONNECTION_TIMEOUT",`Connection timed out after ${n}ms`))},n):void 0,R=()=>{for(const e of x)e()},L=()=>{if(O)return;x.push(((e,t,n,o)=>{let i=!1;const l=async l=>{if(i)return;if(!h(l))return;o?.(`Received ${m(l.methodPath)}() call`,l);const{methodPath:d,args:f,id:p}=l;let g,y;try{const e=((e,t)=>{const n=e.reduce((e,t)=>c(e)?e[t]:void 0,t);return u(n)?n:void 0})(d,t);if(!e)throw new r("METHOD_NOT_FOUND",`Method \\`${m(d)}\\` is not found.`);let o=await e(...f);o instanceof s&&(y=o.transferables,o=await o.value),g={namespace:a,channel:n,type:"REPLY",callId:p,value:o}}catch(e){g=v(n,p,e)}if(!i)try{o?.(`Sending ${m(d)}() reply`,g),e.sendMessage(g,y)}catch(t){throw"DataCloneError"===t.name&&(g=v(n,p,t),o?.(`Sending ${m(d)}() reply`,g),e.sendMessage(g)),t}};return e.addMessageHandler(l),()=>{i=!0,e.removeMessageHandler(l)}})(e,t,o,i));const{remoteProxy:n,destroy:l}=((e,t,n)=>{let o=!1;const i=new Map,s=e=>{if(!p(e))return;const{callId:t,value:o,isError:s,isSerializedErrorInstance:a}=e,c=i.get(t);c&&(i.delete(t),n?.(`Received ${m(c.methodPath)}() call`,e),s?c.reject(a?(({name:e,message:t,stack:n,penpalCode:o})=>{const i=o?new r(o,t):new Error(t);return i.name=e,i.stack=n,i})(o):o):c.resolve(o))};return e.addMessageHandler(s),{remoteProxy:N((s,c)=>{if(o)throw S(s);const u=y(),l=c[c.length-1],d=l instanceof w,{timeout:f,transferables:h}=d?l:{},p=d?c.slice(0,-1):c;return new Promise((o,c)=>{const l=void 0!==f?window.setTimeout(()=>{i.delete(u),c(new r("METHOD_CALL_TIMEOUT",`Method call ${m(s)}() timed out after ${f}ms`))},f):void 0;i.set(u,{methodPath:s,resolve:o,reject:c,timeoutId:l});try{const r={namespace:a,channel:t,type:"CALL",id:u,methodPath:s,args:p};n?.(`Sending ${m(s)}() call`,r),e.sendMessage(r,h)}catch(e){c(new r("TRANSMISSION_FAILED",e.message))}})},n),destroy:()=>{o=!0,e.removeMessageHandler(s);for(const{methodPath:e,reject:t,timeoutId:n}of i.values())clearTimeout(n),t(S(e));i.clear()}}})(e,o,i);x.push(l),clearTimeout(A),O=!0,T({remoteProxy:n,destroy:R})},D=()=>{const t={namespace:a,type:"SYN",channel:o,participantId:b};i?.("Sending handshake SYN",t);try{e.sendMessage(t)}catch(e){P(new r("TRANSMISSION_FAILED",e.message))}},F=t=>{l(t)&&(t=>{if(i?.("Received handshake SYN",t),t.participantId===E&&E!==C)return;if(E=t.participantId,D(),!(b>E||E===C))return;const n={namespace:a,channel:o,type:"ACK1",methodPaths:I};i?.("Sending handshake ACK1",n);try{e.sendMessage(n)}catch(e){return void P(new r("TRANSMISSION_FAILED",e.message))}})(t),d(t)&&(t=>{i?.("Received handshake ACK1",t);const n={namespace:a,channel:o,type:"ACK2"};i?.("Sending handshake ACK2",n);try{e.sendMessage(n)}catch(e){return void P(new r("TRANSMISSION_FAILED",e.message))}L()})(t),f(t)&&(e=>{i?.("Received handshake ACK2",e),L()})(t)};return e.addMessageHandler(F),x.push(()=>e.removeMessageHandler(F)),D(),M},M=new WeakSet,T=class{#t;#n;#r;#o;#i;#s=new Set;#a;#c=!1;constructor({remoteWindow:e,allowedOrigins:t}){if(!e)throw new r("INVALID_ARGUMENT","remoteWindow must be defined");this.#t=e,this.#n=t?.length?t:[window.origin]}initialize=({log:e,validateReceivedMessage:t})=>{this.#r=e,this.#o=t,window.addEventListener("message",this.#u)};sendMessage=(e,t)=>{if(l(e)){const n=this.#l(e);return void this.#t.postMessage(e,{targetOrigin:n,transfer:t})}if(d(e)||this.#c){const n=this.#c?(e=>{if(d(e))return{penpal:"synAck",methodNames:e.methodPaths.map(x)};if(h(e))return{penpal:"call",id:e.id,methodName:x(e.methodPath),args:e.args};if(p(e))return e.isError?{penpal:"reply",id:e.callId,resolution:"rejected",...e.isSerializedErrorInstance?{returnValue:e.value,returnValueIsError:!0}:{returnValue:e.value}}:{penpal:"reply",id:e.callId,resolution:"fulfilled",returnValue:e.value};throw O(e)})(e):e,r=this.#l(e);return void this.#t.postMessage(n,{targetOrigin:r,transfer:t})}if(f(e)){const{port1:n,port2:r}=new MessageChannel;this.#a=n,n.addEventListener("message",this.#d),n.start();const o=[r,...t||[]],i=this.#l(e);return void this.#t.postMessage(e,{targetOrigin:i,transfer:o})}if(!this.#a)throw new r("TRANSMISSION_FAILED","Cannot send message because the MessagePort is not connected");this.#a.postMessage(e,{transfer:t})};addMessageHandler=e=>{this.#s.add(e)};removeMessageHandler=e=>{this.#s.delete(e)};destroy=()=>{window.removeEventListener("message",this.#u),this.#f(),this.#s.clear()};#h=e=>this.#n.some(t=>t instanceof RegExp?t.test(e):t===e||"*"===t);#l=e=>{if(l(e))return"*";if(!this.#i)throw new r("TRANSMISSION_FAILED","Cannot send message because the remote origin is not established");return"null"===this.#i&&this.#n.includes("*")?"*":this.#i};#f=()=>{this.#a?.removeEventListener("message",this.#d),this.#a?.close(),this.#a=void 0};#u=({source:e,origin:t,ports:n,data:r})=>{if(e===this.#t){if((e=>c(e)&&"penpal"in e)(r)){this.#r?.("Please upgrade the child window to the latest version of Penpal."),this.#c=!0;try{r=(e=>{if("syn"===e.penpal)return{namespace:a,channel:void 0,type:"SYN",participantId:C};if("ack"===e.penpal)return{namespace:a,channel:void 0,type:"ACK2"};if("call"===e.penpal)return{namespace:a,channel:void 0,type:"CALL",id:e.id,methodPath:(t=e.methodName,t.split(".")),args:e.args};var t;if("reply"===e.penpal)return"fulfilled"===e.resolution?{namespace:a,channel:void 0,type:"REPLY",callId:e.id,value:e.returnValue}:{namespace:a,channel:void 0,type:"REPLY",callId:e.id,isError:!0,...e.returnValueIsError?{value:e.returnValue,isSerializedErrorInstance:!0}:{value:e.returnValue}};throw O(e)})(r)}catch(e){return void this.#r?.(`Failed to translate deprecated message: ${e.message}`)}}if(this.#o?.(r))if(this.#h(t)){if(l(r)&&(this.#f(),this.#i=t),f(r)&&!this.#c){if(this.#a=n[0],!this.#a)return void this.#r?.("Ignoring ACK2 because it did not include a MessagePort");this.#a.addEventListener("message",this.#d),this.#a.start()}for(const e of this.#s)e(r)}else this.#r?.(`Received a message from origin \\`${t}\\` which did not match allowed origins \\`[${this.#n.join(", ")}]\\``)}};#d=({data:e})=>{if(this.#o?.(e))for(const t of this.#s)t(e)}},P=document,A=window,R=Array.prototype,L=R.filter,D=R.indexOf,F=R.map,$=R.push,j=R.reverse,_=R.slice,k=R.splice,W=/^#[\\w-]*$/,z=/^\\.[\\w-]*$/,H=/<.+>/,U=/^\\w+$/;function V(e,t){return void 0===t&&(t=P),z.test(e)?t.getElementsByClassName(e.slice(1)):U.test(e)?t.getElementsByTagName(e):t.querySelectorAll(e)}function B(e,t){if(void 0===t&&(t=P),e){if(e.__cash)return e;var n=e;if(te(e)){if(t.__cash&&(t=t[0]),!(n=W.test(e)?t.getElementById(e.slice(1)):H.test(e)?_e(e):V(e,t)))return}else if(ee(e))return this.ready(e);(n.nodeType||n===A)&&(n=[n]),this.length=n.length;for(var r=0,o=this.length;r<o;r++)this[r]=n[r]}}function Y(e,t){return new B(e,t)}var q=Y.fn=Y.prototype=B.prototype={constructor:Y,__cash:!0,length:0,splice:k};q.get=function(e){return void 0===e?_.call(this):this[e<0?e+this.length:e]},q.eq=function(e){return Y(this.get(e))},q.first=function(){return this.eq(0)},q.last=function(){return this.eq(-1)},q.map=function(e){return Y(F.call(this,function(t,n){return e.call(t,n,t)}))},q.slice=function(){return Y(_.apply(this,arguments))};var K=/(?:^\\w|[A-Z]|\\b\\w)/g,G=/[\\s-_]+/g;function X(e){return e.replace(K,function(e,t){return e[t?"toUpperCase":"toLowerCase"]()}).replace(G,"")}function J(e,t){for(var n=0,r=e.length;n<r&&!1!==t.call(e[n],e[n],n,e);n++);}Y.camelCase=X,Y.each=J,q.each=function(e){return J(this,function(t,n){return e.call(t,n,t)}),this},q.removeProp=function(e){return this.each(function(t,n){delete n[e]})},Y.extend=q.extend=function(e){void 0===e&&(e=this);for(var t=arguments,n=t.length,r=n<2?0:1;r<n;r++)for(var o in t[r])e[o]=t[r][o];return e};var Z=1;function Q(e,t){var n=e&&(e.matches||e.webkitMatchesSelector||e.mozMatchesSelector||e.msMatchesSelector||e.oMatchesSelector);return!!n&&n.call(e,t)}function ee(e){return"function"==typeof e}function te(e){return"string"==typeof e}function ne(e){return!isNaN(parseFloat(e))&&isFinite(e)}Y.guid=Z,Y.matches=Q,Y.isFunction=ee,Y.isString=te,Y.isNumeric=ne;var re=Array.isArray;function oe(e){return te(e)?function(t,n){return Q(n,e)}:e.__cash?function(t,n){return e.is(n)}:function(e,t,n){return t===n}}Y.isArray=re,q.prop=function(e,t){if(e){if(te(e))return arguments.length<2?this[0]&&this[0][e]:this.each(function(n,r){r[e]=t});for(var n in e)this.prop(n,e[n]);return this}},q.filter=function(e){if(!e)return Y();var t=ee(e)?e:oe(e);return Y(L.call(this,function(n,r){return t.call(n,r,n,e)}))};var ie=/\\S+/g;function se(e){return te(e)&&e.match(ie)||[]}function ae(e){return e.filter(function(e,t,n){return n.indexOf(e)===t})}function ce(e,t,n){if(1===e.nodeType){var r=A.getComputedStyle(e,null);return t?n?r.getPropertyValue(t):r[t]:r}}function ue(e,t){return parseInt(ce(e,t),10)||0}q.hasClass=function(e){var t=se(e),n=!1;return t.length&&this.each(function(e,r){return!(n=r.classList.contains(t[0]))}),n},q.removeAttr=function(e){var t=se(e);return t.length?this.each(function(e,n){J(t,function(e){n.removeAttribute(e)})}):this},q.attr=function(e,t){if(e){if(te(e)){if(arguments.length<2){if(!this[0])return;var n=this[0].getAttribute(e);return null===n?void 0:n}return null===t?this.removeAttr(e):this.each(function(n,r){r.setAttribute(e,t)})}for(var r in e)this.attr(r,e[r]);return this}},q.toggleClass=function(e,t){var n=se(e),r=void 0!==t;return n.length?this.each(function(e,o){J(n,function(e){r?t?o.classList.add(e):o.classList.remove(e):o.classList.toggle(e)})}):this},q.addClass=function(e){return this.toggleClass(e,!0)},q.removeClass=function(e){return arguments.length?this.toggleClass(e,!1):this.attr("class","")},Y.unique=ae,q.add=function(e,t){return Y(ae(this.get().concat(Y(e,t).get())))};var le=/^--/;function de(e){return le.test(e)}var fe={},he=P.createElement("div").style,pe=["webkit","moz","ms","o"];function ge(e,t){if(void 0===t&&(t=de(e)),t)return e;if(!fe[e]){var n=X(e),r=""+n.charAt(0).toUpperCase()+n.slice(1);J((n+" "+pe.join(r+" ")+r).split(" "),function(t){if(t in he)return fe[e]=t,!1})}return fe[e]}Y.prefixedProp=ge;var me={animationIterationCount:!0,columnCount:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0};function ve(e,t,n){return void 0===n&&(n=de(e)),n||me[e]||!ne(t)?t:t+"px"}q.css=function(e,t){if(te(e)){var n=de(e);return e=ge(e,n),arguments.length<2?this[0]&&ce(this[0],e,n):e?(t=ve(e,t,n),this.each(function(r,o){1===o.nodeType&&(n?o.style.setProperty(e,t):o.style[e]=t)})):this}for(var r in e)this.css(r,e[r]);return this};var ye="__cashData",be=/^data-(.*)/;function we(e){return e[ye]=e[ye]||{}}function Ee(e,t){var n=we(e);if(t){if(!(t in n)){var r=e.dataset?e.dataset[t]||e.dataset[X(t)]:Y(e).attr("data-"+t);if(void 0!==r){try{r=JSON.parse(r)}catch(e){}n[t]=r}}return n[t]}return n}function Ne(e,t){return ue(e,"border"+(t?"Left":"Top")+"Width")+ue(e,"padding"+(t?"Left":"Top"))+ue(e,"padding"+(t?"Right":"Bottom"))+ue(e,"border"+(t?"Right":"Bottom")+"Width")}function Se(e,t){for(var n=0,r=t.length;n<r;n++)if(e.indexOf(t[n])<0)return!1;return!0}function Ce(e,t,n){J(e[n],function(e){e[0];var r=e[1];t.removeEventListener(n,r)}),delete e[n]}Y.hasData=function(e){return ye in e},q.data=function(e,t){var n=this;if(!e){if(!this[0])return;return J(this[0].attributes,function(e){var t=e.name.match(be);t&&n.data(t[1])}),Ee(this[0])}if(te(e))return void 0===t?this[0]&&Ee(this[0],e):this.each(function(n,r){return function(e,t,n){we(e)[t]=n}(r,e,t)});for(var r in e)this.data(r,e[r]);return this},q.removeData=function(e){return this.each(function(t,n){return function(e,t){void 0===t?delete e[ye]:delete we(e)[t]}(n,e)})},J(["Width","Height"],function(e){q["inner"+e]=function(){if(this[0])return this[0]===A?A["inner"+e]:this[0]["client"+e]}}),J(["width","height"],function(e,t){q[e]=function(n){return this[0]?arguments.length?(n=parseInt(n,10),this.each(function(r,o){if(1===o.nodeType){var i=ce(o,"boxSizing");o.style[e]=ve(e,n+("border-box"===i?Ne(o,!t):0))}})):this[0]===A?this[0][X("outer-"+e)]:this[0].getBoundingClientRect()[e]-Ne(this[0],!t):void 0===n?void 0:this}}),J(["Width","Height"],function(e,t){q["outer"+e]=function(n){if(this[0])return this[0]===A?A["outer"+e]:this[0]["offset"+e]+(n?ue(this[0],"margin"+(t?"Top":"Left"))+ue(this[0],"margin"+(t?"Bottom":"Right")):0)}});var xe="__cashEvents";function Oe(e){return e[xe]=e[xe]||{}}function Ie(e){var t=e.split(".");return[t[0],t.slice(1).sort()]}function Me(e,t,n,r){var o=Oe(e);if(t){var i=o[t];if(!i)return;r&&(r.guid=r.guid||Z++),o[t]=i.filter(function(o){var i=o[0],s=o[1];if(r&&s.guid!==r.guid||!Se(i,n))return!0;e.removeEventListener(t,s)})}else if(n&&n.length)for(t in o)Me(e,t,n,r);else for(t in o)Ce(o,e,t)}q.off=function(e,t){var n=this;return void 0===e?this.each(function(e,t){return Me(t)}):J(se(e),function(e){var r=Ie(e),o=r[0],i=r[1];n.each(function(e,n){return Me(n,o,i,t)})}),this},q.on=function(e,t,n,r){var o=this;if(!te(e)){for(var i in e)this.on(i,t,e[i]);return this}return ee(t)&&(n=t,t=!1),J(se(e),function(e){var i=Ie(e),s=i[0],a=i[1];o.each(function(e,o){var i=function e(i){if(!i.namespace||Se(a,i.namespace.split("."))){var c=o;if(t){for(var u=i.target;!Q(u,t);){if(u===o)return;if(!(u=u.parentNode))return}c=u}i.namespace=i.namespace||"";var l=n.call(c,i,i.data);r&&Me(o,s,a,e),!1===l&&(i.preventDefault(),i.stopPropagation())}};i.guid=n.guid=n.guid||Z++,function(e,t,n,r){r.guid=r.guid||Z++;var o=Oe(e);o[t]=o[t]||[],o[t].push([n,r]),e.addEventListener(t,r)}(o,s,a,i)})}),this},q.one=function(e,t,n){return this.on(e,t,n,!0)},q.ready=function(e){var t=function(){return e(Y)};return"loading"!==P.readyState?setTimeout(t):P.addEventListener("DOMContentLoaded",t),this},q.trigger=function(e,t){var n=e;if(te(e)){var r=Ie(e),o=r[0],i=r[1];(n=P.createEvent("HTMLEvents")).initEvent(o,!0,!0),n.namespace=i.join(".")}return n.data=t,this.each(function(e,t){t.dispatchEvent(n)})};var Te=/select-one/i,Pe=/select-multiple/i;function Ae(e){var t=e.type;return Te.test(t)?function(e){return e.selectedIndex<0?null:e.options[e.selectedIndex].value}(e):Pe.test(t)?function(e){var t=[];return J(e.options,function(e){!e.selected||e.disabled||e.parentNode.disabled||t.push(e.value)}),t}(e):e.value}var Re=/%20/g,Le=/file|reset|submit|button|image/i,De=/radio|checkbox/i;q.serialize=function(){var e="";return this.each(function(t,n){J(n.elements||[n],function(t){if(!t.disabled&&t.name&&"FIELDSET"!==t.tagName&&!Le.test(t.type)&&(!De.test(t.type)||t.checked)){var n=Ae(t);void 0!==n&&J(re(n)?n:[n],function(n){e+=function(e,t){return"&"+encodeURIComponent(e)+"="+encodeURIComponent(t).replace(Re,"+")}(t.name,n)})}})}),e.substr(1)},q.val=function(e){return void 0===e?this[0]&&Ae(this[0]):this.each(function(t,n){var r=Pe.test(n.type),o=null===e?r?[]:"":e;r&&re(o)?J(n.options,function(e){e.selected=o.indexOf(e.value)>=0}):n.value=o})},q.clone=function(){return this.map(function(e,t){return t.cloneNode(!0)})},q.detach=function(){return this.each(function(e,t){t.parentNode&&t.parentNode.removeChild(t)})};var Fe,$e=/^\\s*<(\\w+)[^>]*>/,je=/^\\s*<(\\w+)\\s*\\/?>(?:<\\/\\1>)?\\s*$/;function _e(e){if(function(){if(!Fe){var e=P.createElement("table"),t=P.createElement("tr");Fe={"*":P.createElement("div"),tr:P.createElement("tbody"),td:t,th:t,thead:e,tbody:e,tfoot:e}}}(),!te(e))return[];if(je.test(e))return[P.createElement(RegExp.$1)];var t=$e.test(e)&&RegExp.$1,n=Fe[t]||Fe["*"];return n.innerHTML=e,Y(n.childNodes).detach().get()}function ke(e,t,n){if(void 0!==t){var r=te(t);!r&&t.length?J(t,function(t){return ke(e,t,n)}):J(e,r?function(e){e.insertAdjacentHTML(n?"afterbegin":"beforeend",t)}:function(e,r){return function(e,t,n){n?e.insertBefore(t,e.childNodes[0]):e.appendChild(t)}(e,r?t.cloneNode(!0):t,n)})}}Y.parseHTML=_e,q.empty=function(){var e=this[0];if(e)for(;e.firstChild;)e.removeChild(e.firstChild);return this},q.append=function(){var e=this;return J(arguments,function(t){ke(e,t)}),this},q.appendTo=function(e){return ke(Y(e),this),this},q.html=function(e){if(void 0===e)return this[0]&&this[0].innerHTML;var t=e.nodeType?e[0].outerHTML:e;return this.each(function(e,n){n.innerHTML=t})},q.insertAfter=function(e){var t=this;return Y(e).each(function(e,n){var r=n.parentNode;t.each(function(t,o){r.insertBefore(e?o.cloneNode(!0):o,n.nextSibling)})}),this},q.after=function(){var e=this;return J(j.apply(arguments),function(t){j.apply(Y(t).slice()).insertAfter(e)}),this},q.insertBefore=function(e){var t=this;return Y(e).each(function(e,n){var r=n.parentNode;t.each(function(t,o){r.insertBefore(e?o.cloneNode(!0):o,n)})}),this},q.before=function(){var e=this;return J(arguments,function(t){Y(t).insertBefore(e)}),this},q.prepend=function(){var e=this;return J(arguments,function(t){ke(e,t,!0)}),this},q.prependTo=function(e){return ke(Y(e),j.apply(this.slice()),!0),this},q.remove=function(){return this.detach().off()},q.replaceWith=function(e){var t=this;return this.each(function(n,r){var o=r.parentNode;if(o){var i=n?Y(e).clone():Y(e);if(!i[0])return t.remove(),!1;o.replaceChild(i[0],r),Y(i[0]).after(i.slice(1))}})},q.replaceAll=function(e){return Y(e).replaceWith(this),this},q.text=function(e){return void 0===e?this[0]?this[0].textContent:"":this.each(function(t,n){n.textContent=e})};var We=P.documentElement;q.offset=function(){var e=this[0];if(e){var t=e.getBoundingClientRect();return{top:t.top+A.pageYOffset-We.clientTop,left:t.left+A.pageXOffset-We.clientLeft}}},q.offsetParent=function(){return Y(this[0]&&this[0].offsetParent)},q.position=function(){var e=this[0];if(e)return{left:e.offsetLeft,top:e.offsetTop}},q.children=function(e){var t=[];return this.each(function(e,n){$.apply(t,n.children)}),t=Y(ae(t)),e?t.filter(function(t,n){return Q(n,e)}):t},q.contents=function(){var e=[];return this.each(function(t,n){$.apply(e,"IFRAME"===n.tagName?[n.contentDocument]:n.childNodes)}),Y(e.length&&ae(e))},q.find=function(e){for(var t=[],n=0,r=this.length;n<r;n++){var o=V(e,this[n]);o.length&&$.apply(t,o)}return Y(t.length&&ae(t))},q.has=function(e){var t=te(e)?function(t,n){return!!V(e,n).length}:function(t,n){return n.contains(e)};return this.filter(t)},q.is=function(e){if(!e||!this[0])return!1;var t=oe(e),n=!1;return this.each(function(r,o){return!(n=t(r,o,e))}),n},q.next=function(){return Y(this[0]&&this[0].nextElementSibling)},q.not=function(e){if(!e||!this[0])return this;var t=oe(e);return this.filter(function(n,r){return!t(n,r,e)})},q.parent=function(){var e=[];return this.each(function(t,n){n&&n.parentNode&&e.push(n.parentNode)}),Y(ae(e))},q.index=function(e){var t=e?Y(e)[0]:this[0],n=e?this:Y(t).parent().children();return D.call(n,t)},q.closest=function(e){return e&&this[0]?this.is(e)?this.filter(e):this.parent().closest(e):Y()},q.parents=function(e){var t,n=[];return this.each(function(r,o){for(t=o;t&&t.parentNode&&t!==P.body.parentNode;)t=t.parentNode,(!e||e&&Q(t,e))&&n.push(t)}),Y(ae(n))},q.prev=function(){return Y(this[0]&&this[0].previousElementSibling)},q.siblings=function(){var e=this[0];return this.parent().children().filter(function(t,n){return n!==e})};const ze=Y,He=new class{getFiberNode(e){try{const t=Object.keys(e).find(e=>e.startsWith("__reactFiber$")||e.startsWith("__reactInternalInstance$"));return t?e[t]:null}catch(e){return console.warn("[ReactFiberService] Error getting fiber node:",e),null}}getDebugOwner(e){const t=this.getFiberNode(e);return t?._debugOwner??null}getDebugSource(e){const t=this.getFiberNode(e);return t?._debugSource??null}getOwnerDebugSource(e){const t=this.getDebugOwner(e);return t?._debugSource??null}hasDirectSourceInfo(e){return!!e.getAttribute("data-nocode-id")||!!this.getDebugSource(e)}hasOwnerNocodeId(e){const t=this.getDebugOwner(e);if(!t?.memoizedProps)return!1;const n=t.memoizedProps["data-nocode-id"];return"string"==typeof n&&n.length>0}getOwnerNocodeId(e){const t=this.getDebugOwner(e);if(!t?.memoizedProps)return null;const n=t.memoizedProps["data-nocode-id"];return"string"==typeof n?n:null}isSelectableElement(e){if(this.hasDirectSourceInfo(e))return!0;const t=this.getFiberNode(e),n=this.getOwnerDebugSource(e);return!!(t?.return&&5!==t.return.tag&&this.hasOwnerNocodeId(e)&&n)}isComponent(e){if(!this.isSelectableElement(e))return!1;if(e.getAttribute("data-nocode-components-name"))return!0;if(this.getDebugSource(e))return!1;const t=this.getFiberNode(e);return!(!t?.return||5===t.return.tag)}getComponentName(e){const t=e.getAttribute("data-nocode-tag-name");if(t)return t;const n=this.getDebugOwner(e);if(n?.type){const e=n.type;if("function"==typeof e){const t=e.displayName||e.name||"Unknown";return this.normalizeComponentName(t)}if("string"==typeof e)return e}return e.tagName.toLowerCase()}normalizeComponentName(e){return e.replace(/\\d+$/,"")}getComponentProps(e){if(!this.isComponent(e))return;const t=this.getDebugOwner(e);return t?.memoizedProps?this.sanitizeProps(t.memoizedProps):void 0}sanitizeProps(e){const t={};for(const[n,r]of Object.entries(e)){if("children"===n||n.startsWith("_"))continue;const e=this.sanitizeValue(r);void 0!==e&&(t[n]=e)}return t}sanitizeValue(e){if(null===e)return null;if(void 0===e)return;if("function"==typeof e)return;if("symbol"==typeof e)return;if("object"!=typeof e)return e;if("$$typeof"in e)return;if(e instanceof Node)return;if(Array.isArray(e)){const t=[];for(const n of e){const e=this.sanitizeValue(n);void 0!==e&&t.push(e)}return t}const t={};for(const[n,r]of Object.entries(e)){if(n.startsWith("_"))continue;const e=this.sanitizeValue(r);void 0!==e&&(t[n]=e)}return t}buildComponentInfo(e){const t=this.isComponent(e),n={isComponent:t,componentType:t?"component":"host",name:t?this.getComponentName(e):e.tagName.toLowerCase()},r=e.getAttribute("data-nocode-components-name"),o=e.getAttribute("data-nocode-components-version");if(r&&(n.componentsName=r),o&&(n.componentsVersion=o),t){const t=this.getComponentProps(e)??{},r=this.removeSpecialProps(t);n.props=r}return n}removeSpecialProps(e){const t={};for(const[n,r]of Object.entries(e))"componentsName"!==n&&"componentsVersion"!==n&&(n.startsWith("data-nocode-")||(t[n]=r));return t}},Ue="data-dnd";function Ve(e){if(!e)return{};const t=e.split(":");if(t.length>=3){const n=t.pop(),r=t.pop(),o=t.join(":");return{id:e,filename:decodeURIComponent(o),component:r,codeId:n}}return 2===t.length?{id:e,component:t[0],codeId:t[1]}:{id:e}}const Be=`[${Ue}]`;function Ye(e,t){const n=t??0;return 0===n?document.querySelector(`[${Ue}="${e}"]`):document.querySelectorAll(`[${Ue}="${e}"]`)[n]??null}const qe=(e,t)=>{const n=e.getBoundingClientRect(),{x:r,y:o}=((e,t)=>{let n=e.x,r=e.y;if(t){const e=t.getBoundingClientRect();n-=e.left,r-=e.top}return{x:n,y:r}})({x:n.left,y:n.top},t);return{width:e.offsetWidth||Math.round(n.width),height:e.offsetHeight||Math.round(n.height),top:o,left:r}},Ke=(e,t)=>{const n=qe(e,t),r=function(e){return e.dataset}(e),o=Ge(e),i=Xe(e),s=(e=>{const t=window.getComputedStyle(e);return{display:t.display,flexDirection:t.flexDirection,flexWrap:t.flexWrap,position:t.position}})(e),a=r.dnd||"",c=Ve(a),u=function(e){return He.buildComponentInfo(e)}(e),l=function(e){return"true"===e.getAttribute("data-nocode-container-placeholder")}(e),d=(e=>{const t=e.querySelectorAll(`:scope > ${Be}`);if(!t.length)return[];const n=[];return t.forEach(e=>{const t=e;n.push(qe(t))}),n})(e);let f;if(a){const t=document.querySelectorAll(`[${Ue}="${a}"]`);if(t.length>1)for(let n=0;n<t.length;n++)if(t[n]===e){f=n;break}}return{id:a,codeId:c.codeId,name:c.component||e.tagName.toLowerCase(),filename:c.filename,bounding:n,display:o,computedStyle:s,text:i,containerPlaceholder:l||void 0,componentInfo:u,childrenBoundings:d.length>0?d:void 0,dndIndex:f}},Ge=e=>ze(e).css("display"),Xe=e=>{const t=[];return e.childNodes.forEach(e=>{if(e.nodeType===Node.TEXT_NODE){const n=e.textContent?.trim()||"";n&&t.push(n)}}),t.join(" ")};function Je(e){const t=["div","p","section","article","main","header","footer","nav","h1","h2","h3","h4","h5","h6","span","a","button","i","input","textarea","select","label","form","ul","ol","li","table","thead","tbody","tr","td","th","img","video","audio","canvas","svg"];try{const n=e.tagName.toLowerCase();if(!t.includes(n))return!1;const r=window.getComputedStyle(e);if("none"===r.display||"hidden"===r.visibility||"0"===r.opacity)return!1;const o=e.getBoundingClientRect();return!("inline"!==r.display&&"inline-block"!==r.display&&(0===o.width||0===o.height))}catch(e){return console.warn("Element validation failed:",e),!1}}function Ze(e,t=20){let n=e,r=0;for(;n&&r<t;){if(n.getAttribute(Ue))return n;n=n.parentElement,r++}return null}function Qe(e){const t=window.getComputedStyle(e),n={};for(let e=0;e<t.length;e++){const r=t[e];n[r]=t.getPropertyValue(r)}return n}let et=null;function tt(e){return(...t)=>{try{const n=e(...t);return n&&"function"==typeof n.then?n.catch(n=>(console.error(`Async error in ${e.name}:`,n),console.error("Error stack:",n.stack),console.error("Function arguments:",t),null)):n}catch(n){return console.error(`Sync error in ${e.name}:`,n),n instanceof Error&&console.error("Error stack:",n.stack),console.error("Function arguments:",t),null}}}const nt={getDraggableParentsData:(e,t)=>{const n=function(e,t){const n=((e,t)=>{const n=document.elementFromPoint(e,t);if(!n)return null;const r=n=>{if(n?.shadowRoot){const o=n.shadowRoot.elementFromPoint(e,t);return o===n?n:o?.shadowRoot?r(o):o||n}return n};return r(n)})(e,t);if(!n)return null;let r=n;if(!Je(r)){let e=r.parentElement,t=0;const n=20;for(;e&&t<n;){if(Je(e)){r=e;break}e=e.parentElement,t++}if(!Je(r))return null}const o=Ze(r);return o&&Je(o)?o:null}(e.x,e.y);if(!n)return;const r=(e=>{const t=ze(e).closest(Be).get(0),n=ze(e).parents(Be).get();return n[0]!==t&&n.unshift(t),n})(n);if(r.length){if(t){const e=r.map(e=>Ke(e));return{...e[0],computedStyle:Qe(n),parents:e.slice(1)}}return{...Ke(r[0]),computedStyle:Qe(r[0])}}},getElementDataById:(e,t)=>{const n=Ye(e,t);if(n)return{...Ke(n),computedStyle:Qe(n)};console.warn("[getElementDataById] Element not found for domId:",e,"dndIndex:",t)},getEditableTextElementAtPosition:e=>{const t=function(e,t){if(document.caretPositionFromPoint){const n=document.caretPositionFromPoint(e,t);return n?.offsetNode??null}if(document.caretRangeFromPoint){const n=document.caretRangeFromPoint(e,t);return n?.startContainer??null}return document.elementFromPoint(e,t)}(e.x,e.y);if(!t)return void console.log("[getEditableTextElementAtPosition] No node at point:",e);if(t.nodeType!==Node.TEXT_NODE)return void console.log("[getEditableTextElementAtPosition] Not a text node:",t.nodeType);const n=t.textContent?.trim();if(!n)return void console.log("[getEditableTextElementAtPosition] Empty text node");const r=t.parentElement;if(!r)return void console.log("[getEditableTextElementAtPosition] No parent element");const o=Ze(r);if(o){if(function(e){const t=e.childNodes;let n=!1;for(let e=0;e<t.length;e++){const r=t[e];if(r.nodeType===Node.ELEMENT_NODE)return!1;if(r.nodeType===Node.TEXT_NODE){const e=r.textContent?.trim();e&&(n=!0)}}return n}(o))return console.log("[getEditableTextElementAtPosition] Found editable text element:",o.tagName,o.textContent),{...Ke(o),computedStyle:Qe(o)};console.log("[getEditableTextElementAtPosition] Element has child elements, cannot edit directly:",o.tagName)}else console.log("[getEditableTextElementAtPosition] No marked element found")},updateElementTextContent:(e,t)=>{const n=Ye(e);return n?(n.textContent=t,!0):(console.warn("[updateElementTextContent] Element not found:",e),!1)},scrollToElement:(e,t)=>{const n=Ye(e,t);return n?(n.scrollIntoView({behavior:"instant",block:"center",inline:"center"}),!0):(console.warn("[scrollToElement] Element not found for domId:",e,"dndIndex:",t),!1)},scrollPageBy:(e,t)=>(window.scrollBy(e,t),!0),highlightElement:(e,t)=>{if(et&&(et.style.outline="",et.style.outlineOffset="",et=null),!e)return!0;const n=Ye(e,t);return n?(n.style.outline="2px solid rgba(54, 210, 190, 0.8)",n.style.outlineOffset="-1px",et=n,!0):(console.warn("[highlightElement] Element not found:",e,"dndIndex:",t),!1)},getProjectLibVersions:function(){try{const e=document.body;if(!e)return console.warn("[sandbox] document.body is not available"),null;const t=e.getAttribute("data-nocode-lib-versions");if(!t)return console.warn("[sandbox] data-nocode-lib-versions attribute not found on body"),null;const n=JSON.parse(t);return"object"!=typeof n||null===n?(console.warn("[sandbox] data-nocode-lib-versions is not a valid object"),null):n}catch(e){return console.error("[sandbox] Failed to parse data-nocode-lib-versions:",e),null}},getCompilerVersion:function(){try{const e=document.body;return e?e.getAttribute("data-nocode-compiler-version"):null}catch(e){return console.error("[sandbox] Failed to get compiler version:",e),null}},getRuntimeNodeTree:()=>{try{const e=document.querySelectorAll(Be);if(!e.length)return[];const t=new Map;e.forEach(e=>{const n=e.getAttribute(Ue)||"";if(!n)return;const r=Ve(n);t.set(e,{id:n,component:r.component||e.tagName.toLowerCase(),children:[]})});const n=[];e.forEach(e=>{const r=t.get(e);if(!r)return;let o,i=e.parentElement;for(;i;){if(t.has(i)){o=t.get(i);break}i=i.parentElement}o?o.children.push(r):n.push(r)});const r=e=>{e.children&&0===e.children.length?delete e.children:e.children&&e.children.forEach(r)};return n.forEach(r),n}catch(e){return console.error("[sandbox] Failed to build runtime node tree:",e),[]}},setElementStyle:function(e,t){const n=function(e){return document.querySelector(`[${Ue}="${e}"]`)}(e);return n?(Object.entries(t).forEach(([e,t])=>{n.style[e]=t}),!0):(console.warn("[setElementStyle] Element not found for domId:",e),!1)}},rt=Object.fromEntries(Object.entries(nt).map(([e,t])=>[e,tt(t)])),ot="nocode-design-mode";let it=null,st=!1,at=null;const ct=t()(()=>{it?.onWindowMutated&&(console.log(`${ot} - Notifying parent of DOM mutation`),it.onWindowMutated({added:{},removed:{}}))},100),ut=async()=>{if(st||it)return it;st=!0,console.log(`${ot} - Creating penpal connection`);const e=(({messenger:e,methods:t={},timeout:n,channel:o,log:i})=>{if(!e)throw new r("INVALID_ARGUMENT","messenger must be defined");if(M.has(e))throw new r("INVALID_ARGUMENT","A messenger can only be used for a single connection");M.add(e);const s=[e.destroy],u=(e=>{let t,n=!1;return(...r)=>(n||(n=!0,t=e(...r)),t)})(t=>{if(t){const t={namespace:a,channel:o,type:"DESTROY"};try{e.sendMessage(t)}catch(e){}}for(const e of s)e();i?.("Connection destroyed")}),l=e=>(e=>c(e)&&e.namespace===a)(e)&&e.channel===o;return{promise:(async()=>{try{e.initialize({log:i,validateReceivedMessage:l}),e.addMessageHandler(e=>{(e=>"DESTROY"===e.type)(e)&&u(!1)});const{remoteProxy:r,destroy:a}=await I({messenger:e,methods:t,timeout:n,channel:o,log:i});return s.push(a),r}catch(e){throw u(!0),e}})(),destroy:()=>{u(!0)}}})({messenger:new T({remoteWindow:window===window.top?(console.warn(`${ot} - Not in an iframe, using window.parent as fallback`),window.parent):window.parent===window.top?window.parent:window.top?(console.log(`${ot} - Using window.top for nested iframe scenario`),window.top):window.parent,allowedOrigins:["*"]}),methods:rt});return e.promise.then(e=>{if(!e)return console.error(`${ot} - Failed to setup penpal connection: child is null`),void lt();it=e,console.log(`${ot} - Penpal connection set`),(()=>{if(at)return;at=new MutationObserver(e=>{e.some(e=>{const t=e.target;return"SCRIPT"!==t.tagName&&"STYLE"!==t.tagName&&("attributes"!==e.type||"style"===e.attributeName||"class"===e.attributeName)})&&ct()});const e=()=>{document.body&&at&&(at.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style","class"],characterData:!0}),console.log(`${ot} - MutationObserver started`))};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",e):e()})()}).finally(()=>{st=!1}),e.promise.catch(e=>{console.error(`${ot} - Failed to setup penpal connection:`,e),lt()}),it},lt=t()(()=>{st||(console.log(`${ot} - Reconnecting to penpal parent`),it=null,ut())},1e3);ut()})()})();';
344
+ return '(()=>{var e={6:(e,t,n)=>{var r=n(714).Symbol;e.exports=r},12:(e,t,n)=>{var r=n(400),o=n(835),i=n(639),s=Math.max,a=Math.min;e.exports=function(e,t,n){var c,l,u,d,f,h,p=0,g=!1,m=!1,v=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function y(t){var n=c,r=l;return c=l=void 0,p=t,d=e.apply(r,n)}function b(e){var n=e-h;return void 0===h||n>=t||n<0||m&&e-p>=u}function w(){var e=o();if(b(e))return E(e);f=setTimeout(w,function(e){var n=t-(e-h);return m?a(n,u-(e-p)):n}(e))}function E(e){return f=void 0,v&&c?y(e):(c=l=void 0,d)}function N(){var e=o(),n=b(e);if(c=arguments,l=this,h=e,n){if(void 0===f)return function(e){return p=e,f=setTimeout(w,t),g?y(e):d}(h);if(m)return clearTimeout(f),f=setTimeout(w,t),y(h)}return void 0===f&&(f=setTimeout(w,t)),d}return t=i(t)||0,r(n)&&(g=!!n.leading,u=(m="maxWait"in n)?s(i(n.maxWait)||0,t):u,v="trailing"in n?!!n.trailing:v),N.cancel=function(){void 0!==f&&clearTimeout(f),p=0,c=h=l=f=void 0},N.flush=function(){return void 0===f?d:E(o())},N}},103:(e,t,n)=>{var r=n(997),o=/^\\s+/;e.exports=function(e){return e?e.slice(0,r(e)+1).replace(o,""):e}},271:(e,t,n)=>{var r=n(6),o=n(650),i=n(881),s=r?r.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":s&&s in Object(e)?o(e):i(e)}},400:e=>{e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},583:e=>{e.exports=function(e){return null!=e&&"object"==typeof e}},603:(e,t,n)=>{var r="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g;e.exports=r},639:(e,t,n)=>{var r=n(103),o=n(400),i=n(975),s=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,c=/^0o[0-7]+$/i,l=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(i(e))return NaN;if(o(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=o(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=r(e);var n=a.test(e);return n||c.test(e)?l(e.slice(2),n?2:8):s.test(e)?NaN:+e}},650:(e,t,n)=>{var r=n(6),o=Object.prototype,i=o.hasOwnProperty,s=o.toString,a=r?r.toStringTag:void 0;e.exports=function(e){var t=i.call(e,a),n=e[a];try{e[a]=void 0;var r=!0}catch(e){}var o=s.call(e);return r&&(t?e[a]=n:delete e[a]),o}},714:(e,t,n)=>{var r=n(603),o="object"==typeof self&&self&&self.Object===Object&&self,i=r||o||Function("return this")();e.exports=i},835:(e,t,n)=>{var r=n(714);e.exports=function(){return r.Date.now()}},881:e=>{var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},975:(e,t,n)=>{var r=n(271),o=n(583);e.exports=function(e){return"symbol"==typeof e||o(e)&&"[object Symbol]"==r(e)}},997:e=>{var t=/\\s/;e.exports=function(e){for(var n=e.length;n--&&t.test(e.charAt(n)););return n}}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";var e=n(12),t=n.n(e),r=class extends Error{code;constructor(e,t){super(t),this.name="PenpalError",this.code=e}},o=e=>({name:e.name,message:e.message,stack:e.stack,penpalCode:e instanceof r?e.code:void 0}),i=Symbol("Reply"),s=class{value;transferables;#e=i;constructor(e,t){this.value=e,this.transferables=t?.transferables}},a="penpal",c=e=>"object"==typeof e&&null!==e,l=e=>"function"==typeof e,u=e=>"SYN"===e.type,d=e=>"ACK1"===e.type,f=e=>"ACK2"===e.type,h=e=>"CALL"===e.type,p=e=>"REPLY"===e.type,g=(e,t=[])=>{const n=[];for(const r of Object.keys(e)){const o=e[r];l(o)?n.push([...t,r]):c(o)&&n.push(...g(o,[...t,r]))}return n},m=e=>e.join("."),v=(e,t,n)=>({namespace:a,channel:e,type:"REPLY",callId:t,isError:!0,...n instanceof Error?{value:o(n),isSerializedErrorInstance:!0}:{value:n}}),y=crypto.randomUUID?.bind(crypto)??(()=>new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")),b=Symbol("CallOptions"),w=class{transferables;timeout;#e=b;constructor(e){this.transferables=e?.transferables,this.timeout=e?.timeout}},E=new Set(["apply","call","bind"]),N=(e,t,n=[])=>new Proxy(n.length?()=>{}:Object.create(null),{get(r,o){if("then"!==o)return n.length&&E.has(o)?Reflect.get(r,o):N(e,t,[...n,o])},apply:(t,r,o)=>e(n,o)}),S=e=>new r("CONNECTION_DESTROYED",`Method call ${m(e)}() failed due to destroyed connection`),x="deprecated-penpal",C=e=>e.join("."),O=e=>new r("TRANSMISSION_FAILED",`Unexpected message to translate: ${(e=>{try{return JSON.stringify(e)}catch(t){return String(e)}})(e)}`),I=({messenger:e,methods:t,timeout:n,channel:o,log:i})=>{const b=y();let E;const C=[];let O=!1;const I=g(t),{promise:A,resolve:M,reject:T}=(()=>{let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}})(),P=void 0!==n?setTimeout(()=>{T(new r("CONNECTION_TIMEOUT",`Connection timed out after ${n}ms`))},n):void 0,R=()=>{for(const e of C)e()},L=()=>{if(O)return;C.push(((e,t,n,o)=>{let i=!1;const u=async u=>{if(i)return;if(!h(u))return;o?.(`Received ${m(u.methodPath)}() call`,u);const{methodPath:d,args:f,id:p}=u;let g,y;try{const e=((e,t)=>{const n=e.reduce((e,t)=>c(e)?e[t]:void 0,t);return l(n)?n:void 0})(d,t);if(!e)throw new r("METHOD_NOT_FOUND",`Method \\`${m(d)}\\` is not found.`);let o=await e(...f);o instanceof s&&(y=o.transferables,o=await o.value),g={namespace:a,channel:n,type:"REPLY",callId:p,value:o}}catch(e){g=v(n,p,e)}if(!i)try{o?.(`Sending ${m(d)}() reply`,g),e.sendMessage(g,y)}catch(t){throw"DataCloneError"===t.name&&(g=v(n,p,t),o?.(`Sending ${m(d)}() reply`,g),e.sendMessage(g)),t}};return e.addMessageHandler(u),()=>{i=!0,e.removeMessageHandler(u)}})(e,t,o,i));const{remoteProxy:n,destroy:u}=((e,t,n)=>{let o=!1;const i=new Map,s=e=>{if(!p(e))return;const{callId:t,value:o,isError:s,isSerializedErrorInstance:a}=e,c=i.get(t);c&&(i.delete(t),n?.(`Received ${m(c.methodPath)}() call`,e),s?c.reject(a?(({name:e,message:t,stack:n,penpalCode:o})=>{const i=o?new r(o,t):new Error(t);return i.name=e,i.stack=n,i})(o):o):c.resolve(o))};return e.addMessageHandler(s),{remoteProxy:N((s,c)=>{if(o)throw S(s);const l=y(),u=c[c.length-1],d=u instanceof w,{timeout:f,transferables:h}=d?u:{},p=d?c.slice(0,-1):c;return new Promise((o,c)=>{const u=void 0!==f?window.setTimeout(()=>{i.delete(l),c(new r("METHOD_CALL_TIMEOUT",`Method call ${m(s)}() timed out after ${f}ms`))},f):void 0;i.set(l,{methodPath:s,resolve:o,reject:c,timeoutId:u});try{const r={namespace:a,channel:t,type:"CALL",id:l,methodPath:s,args:p};n?.(`Sending ${m(s)}() call`,r),e.sendMessage(r,h)}catch(e){c(new r("TRANSMISSION_FAILED",e.message))}})},n),destroy:()=>{o=!0,e.removeMessageHandler(s);for(const{methodPath:e,reject:t,timeoutId:n}of i.values())clearTimeout(n),t(S(e));i.clear()}}})(e,o,i);C.push(u),clearTimeout(P),O=!0,M({remoteProxy:n,destroy:R})},D=()=>{const t={namespace:a,type:"SYN",channel:o,participantId:b};i?.("Sending handshake SYN",t);try{e.sendMessage(t)}catch(e){T(new r("TRANSMISSION_FAILED",e.message))}},F=t=>{u(t)&&(t=>{if(i?.("Received handshake SYN",t),t.participantId===E&&E!==x)return;if(E=t.participantId,D(),!(b>E||E===x))return;const n={namespace:a,channel:o,type:"ACK1",methodPaths:I};i?.("Sending handshake ACK1",n);try{e.sendMessage(n)}catch(e){return void T(new r("TRANSMISSION_FAILED",e.message))}})(t),d(t)&&(t=>{i?.("Received handshake ACK1",t);const n={namespace:a,channel:o,type:"ACK2"};i?.("Sending handshake ACK2",n);try{e.sendMessage(n)}catch(e){return void T(new r("TRANSMISSION_FAILED",e.message))}L()})(t),f(t)&&(e=>{i?.("Received handshake ACK2",e),L()})(t)};return e.addMessageHandler(F),C.push(()=>e.removeMessageHandler(F)),D(),A},A=new WeakSet,M=class{#t;#n;#r;#o;#i;#s=new Set;#a;#c=!1;constructor({remoteWindow:e,allowedOrigins:t}){if(!e)throw new r("INVALID_ARGUMENT","remoteWindow must be defined");this.#t=e,this.#n=t?.length?t:[window.origin]}initialize=({log:e,validateReceivedMessage:t})=>{this.#r=e,this.#o=t,window.addEventListener("message",this.#l)};sendMessage=(e,t)=>{if(u(e)){const n=this.#u(e);return void this.#t.postMessage(e,{targetOrigin:n,transfer:t})}if(d(e)||this.#c){const n=this.#c?(e=>{if(d(e))return{penpal:"synAck",methodNames:e.methodPaths.map(C)};if(h(e))return{penpal:"call",id:e.id,methodName:C(e.methodPath),args:e.args};if(p(e))return e.isError?{penpal:"reply",id:e.callId,resolution:"rejected",...e.isSerializedErrorInstance?{returnValue:e.value,returnValueIsError:!0}:{returnValue:e.value}}:{penpal:"reply",id:e.callId,resolution:"fulfilled",returnValue:e.value};throw O(e)})(e):e,r=this.#u(e);return void this.#t.postMessage(n,{targetOrigin:r,transfer:t})}if(f(e)){const{port1:n,port2:r}=new MessageChannel;this.#a=n,n.addEventListener("message",this.#d),n.start();const o=[r,...t||[]],i=this.#u(e);return void this.#t.postMessage(e,{targetOrigin:i,transfer:o})}if(!this.#a)throw new r("TRANSMISSION_FAILED","Cannot send message because the MessagePort is not connected");this.#a.postMessage(e,{transfer:t})};addMessageHandler=e=>{this.#s.add(e)};removeMessageHandler=e=>{this.#s.delete(e)};destroy=()=>{window.removeEventListener("message",this.#l),this.#f(),this.#s.clear()};#h=e=>this.#n.some(t=>t instanceof RegExp?t.test(e):t===e||"*"===t);#u=e=>{if(u(e))return"*";if(!this.#i)throw new r("TRANSMISSION_FAILED","Cannot send message because the remote origin is not established");return"null"===this.#i&&this.#n.includes("*")?"*":this.#i};#f=()=>{this.#a?.removeEventListener("message",this.#d),this.#a?.close(),this.#a=void 0};#l=({source:e,origin:t,ports:n,data:r})=>{if(e===this.#t){if((e=>c(e)&&"penpal"in e)(r)){this.#r?.("Please upgrade the child window to the latest version of Penpal."),this.#c=!0;try{r=(e=>{if("syn"===e.penpal)return{namespace:a,channel:void 0,type:"SYN",participantId:x};if("ack"===e.penpal)return{namespace:a,channel:void 0,type:"ACK2"};if("call"===e.penpal)return{namespace:a,channel:void 0,type:"CALL",id:e.id,methodPath:(t=e.methodName,t.split(".")),args:e.args};var t;if("reply"===e.penpal)return"fulfilled"===e.resolution?{namespace:a,channel:void 0,type:"REPLY",callId:e.id,value:e.returnValue}:{namespace:a,channel:void 0,type:"REPLY",callId:e.id,isError:!0,...e.returnValueIsError?{value:e.returnValue,isSerializedErrorInstance:!0}:{value:e.returnValue}};throw O(e)})(r)}catch(e){return void this.#r?.(`Failed to translate deprecated message: ${e.message}`)}}if(this.#o?.(r))if(this.#h(t)){if(u(r)&&(this.#f(),this.#i=t),f(r)&&!this.#c){if(this.#a=n[0],!this.#a)return void this.#r?.("Ignoring ACK2 because it did not include a MessagePort");this.#a.addEventListener("message",this.#d),this.#a.start()}for(const e of this.#s)e(r)}else this.#r?.(`Received a message from origin \\`${t}\\` which did not match allowed origins \\`[${this.#n.join(", ")}]\\``)}};#d=({data:e})=>{if(this.#o?.(e))for(const t of this.#s)t(e)}},T=document,P=window,R=Array.prototype,L=R.filter,D=R.indexOf,F=R.map,$=R.push,j=R.reverse,_=R.slice,k=R.splice,W=/^#[\\w-]*$/,z=/^\\.[\\w-]*$/,H=/<.+>/,U=/^\\w+$/;function V(e,t){return void 0===t&&(t=T),z.test(e)?t.getElementsByClassName(e.slice(1)):U.test(e)?t.getElementsByTagName(e):t.querySelectorAll(e)}function B(e,t){if(void 0===t&&(t=T),e){if(e.__cash)return e;var n=e;if(te(e)){if(t.__cash&&(t=t[0]),!(n=W.test(e)?t.getElementById(e.slice(1)):H.test(e)?_e(e):V(e,t)))return}else if(ee(e))return this.ready(e);(n.nodeType||n===P)&&(n=[n]),this.length=n.length;for(var r=0,o=this.length;r<o;r++)this[r]=n[r]}}function Y(e,t){return new B(e,t)}var q=Y.fn=Y.prototype=B.prototype={constructor:Y,__cash:!0,length:0,splice:k};q.get=function(e){return void 0===e?_.call(this):this[e<0?e+this.length:e]},q.eq=function(e){return Y(this.get(e))},q.first=function(){return this.eq(0)},q.last=function(){return this.eq(-1)},q.map=function(e){return Y(F.call(this,function(t,n){return e.call(t,n,t)}))},q.slice=function(){return Y(_.apply(this,arguments))};var K=/(?:^\\w|[A-Z]|\\b\\w)/g,G=/[\\s-_]+/g;function X(e){return e.replace(K,function(e,t){return e[t?"toUpperCase":"toLowerCase"]()}).replace(G,"")}function J(e,t){for(var n=0,r=e.length;n<r&&!1!==t.call(e[n],e[n],n,e);n++);}Y.camelCase=X,Y.each=J,q.each=function(e){return J(this,function(t,n){return e.call(t,n,t)}),this},q.removeProp=function(e){return this.each(function(t,n){delete n[e]})},Y.extend=q.extend=function(e){void 0===e&&(e=this);for(var t=arguments,n=t.length,r=n<2?0:1;r<n;r++)for(var o in t[r])e[o]=t[r][o];return e};var Z=1;function Q(e,t){var n=e&&(e.matches||e.webkitMatchesSelector||e.mozMatchesSelector||e.msMatchesSelector||e.oMatchesSelector);return!!n&&n.call(e,t)}function ee(e){return"function"==typeof e}function te(e){return"string"==typeof e}function ne(e){return!isNaN(parseFloat(e))&&isFinite(e)}Y.guid=Z,Y.matches=Q,Y.isFunction=ee,Y.isString=te,Y.isNumeric=ne;var re=Array.isArray;function oe(e){return te(e)?function(t,n){return Q(n,e)}:e.__cash?function(t,n){return e.is(n)}:function(e,t,n){return t===n}}Y.isArray=re,q.prop=function(e,t){if(e){if(te(e))return arguments.length<2?this[0]&&this[0][e]:this.each(function(n,r){r[e]=t});for(var n in e)this.prop(n,e[n]);return this}},q.filter=function(e){if(!e)return Y();var t=ee(e)?e:oe(e);return Y(L.call(this,function(n,r){return t.call(n,r,n,e)}))};var ie=/\\S+/g;function se(e){return te(e)&&e.match(ie)||[]}function ae(e){return e.filter(function(e,t,n){return n.indexOf(e)===t})}function ce(e,t,n){if(1===e.nodeType){var r=P.getComputedStyle(e,null);return t?n?r.getPropertyValue(t):r[t]:r}}function le(e,t){return parseInt(ce(e,t),10)||0}q.hasClass=function(e){var t=se(e),n=!1;return t.length&&this.each(function(e,r){return!(n=r.classList.contains(t[0]))}),n},q.removeAttr=function(e){var t=se(e);return t.length?this.each(function(e,n){J(t,function(e){n.removeAttribute(e)})}):this},q.attr=function(e,t){if(e){if(te(e)){if(arguments.length<2){if(!this[0])return;var n=this[0].getAttribute(e);return null===n?void 0:n}return null===t?this.removeAttr(e):this.each(function(n,r){r.setAttribute(e,t)})}for(var r in e)this.attr(r,e[r]);return this}},q.toggleClass=function(e,t){var n=se(e),r=void 0!==t;return n.length?this.each(function(e,o){J(n,function(e){r?t?o.classList.add(e):o.classList.remove(e):o.classList.toggle(e)})}):this},q.addClass=function(e){return this.toggleClass(e,!0)},q.removeClass=function(e){return arguments.length?this.toggleClass(e,!1):this.attr("class","")},Y.unique=ae,q.add=function(e,t){return Y(ae(this.get().concat(Y(e,t).get())))};var ue=/^--/;function de(e){return ue.test(e)}var fe={},he=T.createElement("div").style,pe=["webkit","moz","ms","o"];function ge(e,t){if(void 0===t&&(t=de(e)),t)return e;if(!fe[e]){var n=X(e),r=""+n.charAt(0).toUpperCase()+n.slice(1);J((n+" "+pe.join(r+" ")+r).split(" "),function(t){if(t in he)return fe[e]=t,!1})}return fe[e]}Y.prefixedProp=ge;var me={animationIterationCount:!0,columnCount:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0};function ve(e,t,n){return void 0===n&&(n=de(e)),n||me[e]||!ne(t)?t:t+"px"}q.css=function(e,t){if(te(e)){var n=de(e);return e=ge(e,n),arguments.length<2?this[0]&&ce(this[0],e,n):e?(t=ve(e,t,n),this.each(function(r,o){1===o.nodeType&&(n?o.style.setProperty(e,t):o.style[e]=t)})):this}for(var r in e)this.css(r,e[r]);return this};var ye="__cashData",be=/^data-(.*)/;function we(e){return e[ye]=e[ye]||{}}function Ee(e,t){var n=we(e);if(t){if(!(t in n)){var r=e.dataset?e.dataset[t]||e.dataset[X(t)]:Y(e).attr("data-"+t);if(void 0!==r){try{r=JSON.parse(r)}catch(e){}n[t]=r}}return n[t]}return n}function Ne(e,t){return le(e,"border"+(t?"Left":"Top")+"Width")+le(e,"padding"+(t?"Left":"Top"))+le(e,"padding"+(t?"Right":"Bottom"))+le(e,"border"+(t?"Right":"Bottom")+"Width")}function Se(e,t){for(var n=0,r=t.length;n<r;n++)if(e.indexOf(t[n])<0)return!1;return!0}function xe(e,t,n){J(e[n],function(e){e[0];var r=e[1];t.removeEventListener(n,r)}),delete e[n]}Y.hasData=function(e){return ye in e},q.data=function(e,t){var n=this;if(!e){if(!this[0])return;return J(this[0].attributes,function(e){var t=e.name.match(be);t&&n.data(t[1])}),Ee(this[0])}if(te(e))return void 0===t?this[0]&&Ee(this[0],e):this.each(function(n,r){return function(e,t,n){we(e)[t]=n}(r,e,t)});for(var r in e)this.data(r,e[r]);return this},q.removeData=function(e){return this.each(function(t,n){return function(e,t){void 0===t?delete e[ye]:delete we(e)[t]}(n,e)})},J(["Width","Height"],function(e){q["inner"+e]=function(){if(this[0])return this[0]===P?P["inner"+e]:this[0]["client"+e]}}),J(["width","height"],function(e,t){q[e]=function(n){return this[0]?arguments.length?(n=parseInt(n,10),this.each(function(r,o){if(1===o.nodeType){var i=ce(o,"boxSizing");o.style[e]=ve(e,n+("border-box"===i?Ne(o,!t):0))}})):this[0]===P?this[0][X("outer-"+e)]:this[0].getBoundingClientRect()[e]-Ne(this[0],!t):void 0===n?void 0:this}}),J(["Width","Height"],function(e,t){q["outer"+e]=function(n){if(this[0])return this[0]===P?P["outer"+e]:this[0]["offset"+e]+(n?le(this[0],"margin"+(t?"Top":"Left"))+le(this[0],"margin"+(t?"Bottom":"Right")):0)}});var Ce="__cashEvents";function Oe(e){return e[Ce]=e[Ce]||{}}function Ie(e){var t=e.split(".");return[t[0],t.slice(1).sort()]}function Ae(e,t,n,r){var o=Oe(e);if(t){var i=o[t];if(!i)return;r&&(r.guid=r.guid||Z++),o[t]=i.filter(function(o){var i=o[0],s=o[1];if(r&&s.guid!==r.guid||!Se(i,n))return!0;e.removeEventListener(t,s)})}else if(n&&n.length)for(t in o)Ae(e,t,n,r);else for(t in o)xe(o,e,t)}q.off=function(e,t){var n=this;return void 0===e?this.each(function(e,t){return Ae(t)}):J(se(e),function(e){var r=Ie(e),o=r[0],i=r[1];n.each(function(e,n){return Ae(n,o,i,t)})}),this},q.on=function(e,t,n,r){var o=this;if(!te(e)){for(var i in e)this.on(i,t,e[i]);return this}return ee(t)&&(n=t,t=!1),J(se(e),function(e){var i=Ie(e),s=i[0],a=i[1];o.each(function(e,o){var i=function e(i){if(!i.namespace||Se(a,i.namespace.split("."))){var c=o;if(t){for(var l=i.target;!Q(l,t);){if(l===o)return;if(!(l=l.parentNode))return}c=l}i.namespace=i.namespace||"";var u=n.call(c,i,i.data);r&&Ae(o,s,a,e),!1===u&&(i.preventDefault(),i.stopPropagation())}};i.guid=n.guid=n.guid||Z++,function(e,t,n,r){r.guid=r.guid||Z++;var o=Oe(e);o[t]=o[t]||[],o[t].push([n,r]),e.addEventListener(t,r)}(o,s,a,i)})}),this},q.one=function(e,t,n){return this.on(e,t,n,!0)},q.ready=function(e){var t=function(){return e(Y)};return"loading"!==T.readyState?setTimeout(t):T.addEventListener("DOMContentLoaded",t),this},q.trigger=function(e,t){var n=e;if(te(e)){var r=Ie(e),o=r[0],i=r[1];(n=T.createEvent("HTMLEvents")).initEvent(o,!0,!0),n.namespace=i.join(".")}return n.data=t,this.each(function(e,t){t.dispatchEvent(n)})};var Me=/select-one/i,Te=/select-multiple/i;function Pe(e){var t=e.type;return Me.test(t)?function(e){return e.selectedIndex<0?null:e.options[e.selectedIndex].value}(e):Te.test(t)?function(e){var t=[];return J(e.options,function(e){!e.selected||e.disabled||e.parentNode.disabled||t.push(e.value)}),t}(e):e.value}var Re=/%20/g,Le=/file|reset|submit|button|image/i,De=/radio|checkbox/i;q.serialize=function(){var e="";return this.each(function(t,n){J(n.elements||[n],function(t){if(!t.disabled&&t.name&&"FIELDSET"!==t.tagName&&!Le.test(t.type)&&(!De.test(t.type)||t.checked)){var n=Pe(t);void 0!==n&&J(re(n)?n:[n],function(n){e+=function(e,t){return"&"+encodeURIComponent(e)+"="+encodeURIComponent(t).replace(Re,"+")}(t.name,n)})}})}),e.substr(1)},q.val=function(e){return void 0===e?this[0]&&Pe(this[0]):this.each(function(t,n){var r=Te.test(n.type),o=null===e?r?[]:"":e;r&&re(o)?J(n.options,function(e){e.selected=o.indexOf(e.value)>=0}):n.value=o})},q.clone=function(){return this.map(function(e,t){return t.cloneNode(!0)})},q.detach=function(){return this.each(function(e,t){t.parentNode&&t.parentNode.removeChild(t)})};var Fe,$e=/^\\s*<(\\w+)[^>]*>/,je=/^\\s*<(\\w+)\\s*\\/?>(?:<\\/\\1>)?\\s*$/;function _e(e){if(function(){if(!Fe){var e=T.createElement("table"),t=T.createElement("tr");Fe={"*":T.createElement("div"),tr:T.createElement("tbody"),td:t,th:t,thead:e,tbody:e,tfoot:e}}}(),!te(e))return[];if(je.test(e))return[T.createElement(RegExp.$1)];var t=$e.test(e)&&RegExp.$1,n=Fe[t]||Fe["*"];return n.innerHTML=e,Y(n.childNodes).detach().get()}function ke(e,t,n){if(void 0!==t){var r=te(t);!r&&t.length?J(t,function(t){return ke(e,t,n)}):J(e,r?function(e){e.insertAdjacentHTML(n?"afterbegin":"beforeend",t)}:function(e,r){return function(e,t,n){n?e.insertBefore(t,e.childNodes[0]):e.appendChild(t)}(e,r?t.cloneNode(!0):t,n)})}}Y.parseHTML=_e,q.empty=function(){var e=this[0];if(e)for(;e.firstChild;)e.removeChild(e.firstChild);return this},q.append=function(){var e=this;return J(arguments,function(t){ke(e,t)}),this},q.appendTo=function(e){return ke(Y(e),this),this},q.html=function(e){if(void 0===e)return this[0]&&this[0].innerHTML;var t=e.nodeType?e[0].outerHTML:e;return this.each(function(e,n){n.innerHTML=t})},q.insertAfter=function(e){var t=this;return Y(e).each(function(e,n){var r=n.parentNode;t.each(function(t,o){r.insertBefore(e?o.cloneNode(!0):o,n.nextSibling)})}),this},q.after=function(){var e=this;return J(j.apply(arguments),function(t){j.apply(Y(t).slice()).insertAfter(e)}),this},q.insertBefore=function(e){var t=this;return Y(e).each(function(e,n){var r=n.parentNode;t.each(function(t,o){r.insertBefore(e?o.cloneNode(!0):o,n)})}),this},q.before=function(){var e=this;return J(arguments,function(t){Y(t).insertBefore(e)}),this},q.prepend=function(){var e=this;return J(arguments,function(t){ke(e,t,!0)}),this},q.prependTo=function(e){return ke(Y(e),j.apply(this.slice()),!0),this},q.remove=function(){return this.detach().off()},q.replaceWith=function(e){var t=this;return this.each(function(n,r){var o=r.parentNode;if(o){var i=n?Y(e).clone():Y(e);if(!i[0])return t.remove(),!1;o.replaceChild(i[0],r),Y(i[0]).after(i.slice(1))}})},q.replaceAll=function(e){return Y(e).replaceWith(this),this},q.text=function(e){return void 0===e?this[0]?this[0].textContent:"":this.each(function(t,n){n.textContent=e})};var We=T.documentElement;q.offset=function(){var e=this[0];if(e){var t=e.getBoundingClientRect();return{top:t.top+P.pageYOffset-We.clientTop,left:t.left+P.pageXOffset-We.clientLeft}}},q.offsetParent=function(){return Y(this[0]&&this[0].offsetParent)},q.position=function(){var e=this[0];if(e)return{left:e.offsetLeft,top:e.offsetTop}},q.children=function(e){var t=[];return this.each(function(e,n){$.apply(t,n.children)}),t=Y(ae(t)),e?t.filter(function(t,n){return Q(n,e)}):t},q.contents=function(){var e=[];return this.each(function(t,n){$.apply(e,"IFRAME"===n.tagName?[n.contentDocument]:n.childNodes)}),Y(e.length&&ae(e))},q.find=function(e){for(var t=[],n=0,r=this.length;n<r;n++){var o=V(e,this[n]);o.length&&$.apply(t,o)}return Y(t.length&&ae(t))},q.has=function(e){var t=te(e)?function(t,n){return!!V(e,n).length}:function(t,n){return n.contains(e)};return this.filter(t)},q.is=function(e){if(!e||!this[0])return!1;var t=oe(e),n=!1;return this.each(function(r,o){return!(n=t(r,o,e))}),n},q.next=function(){return Y(this[0]&&this[0].nextElementSibling)},q.not=function(e){if(!e||!this[0])return this;var t=oe(e);return this.filter(function(n,r){return!t(n,r,e)})},q.parent=function(){var e=[];return this.each(function(t,n){n&&n.parentNode&&e.push(n.parentNode)}),Y(ae(e))},q.index=function(e){var t=e?Y(e)[0]:this[0],n=e?this:Y(t).parent().children();return D.call(n,t)},q.closest=function(e){return e&&this[0]?this.is(e)?this.filter(e):this.parent().closest(e):Y()},q.parents=function(e){var t,n=[];return this.each(function(r,o){for(t=o;t&&t.parentNode&&t!==T.body.parentNode;)t=t.parentNode,(!e||e&&Q(t,e))&&n.push(t)}),Y(ae(n))},q.prev=function(){return Y(this[0]&&this[0].previousElementSibling)},q.siblings=function(){var e=this[0];return this.parent().children().filter(function(t,n){return n!==e})};const ze=Y,He=new class{getFiberNode(e){try{const t=Object.keys(e).find(e=>e.startsWith("__reactFiber$")||e.startsWith("__reactInternalInstance$"));return t?e[t]:null}catch(e){return console.warn("[ReactFiberService] Error getting fiber node:",e),null}}getDebugOwner(e){const t=this.getFiberNode(e);return t?._debugOwner??null}getDebugSource(e){const t=this.getFiberNode(e);return t?._debugSource??null}getOwnerDebugSource(e){const t=this.getDebugOwner(e);return t?._debugSource??null}hasDirectSourceInfo(e){return!!e.getAttribute("data-nocode-id")||!!this.getDebugSource(e)}hasOwnerNocodeId(e){const t=this.getDebugOwner(e);if(!t?.memoizedProps)return!1;const n=t.memoizedProps["data-nocode-id"];return"string"==typeof n&&n.length>0}getOwnerNocodeId(e){const t=this.getDebugOwner(e);if(!t?.memoizedProps)return null;const n=t.memoizedProps["data-nocode-id"];return"string"==typeof n?n:null}isSelectableElement(e){if(this.hasDirectSourceInfo(e))return!0;const t=this.getFiberNode(e),n=this.getOwnerDebugSource(e);return!!(t?.return&&5!==t.return.tag&&this.hasOwnerNocodeId(e)&&n)}isComponent(e){if(!this.isSelectableElement(e))return!1;if(e.getAttribute("data-nocode-components-name"))return!0;if(this.getDebugSource(e))return!1;const t=this.getFiberNode(e);return!(!t?.return||5===t.return.tag)}getComponentName(e){const t=e.getAttribute("data-nocode-tag-name");if(t)return t;const n=this.getDebugOwner(e);if(n?.type){const e=n.type;if("function"==typeof e){const t=e.displayName||e.name||"Unknown";return this.normalizeComponentName(t)}if("string"==typeof e)return e}return e.tagName.toLowerCase()}normalizeComponentName(e){return e.replace(/\\d+$/,"")}getComponentProps(e){if(!this.isComponent(e))return;const t=this.getDebugOwner(e);return t?.memoizedProps?this.sanitizeProps(t.memoizedProps):void 0}sanitizeProps(e){const t={};for(const[n,r]of Object.entries(e)){if("children"===n||n.startsWith("_"))continue;const e=this.sanitizeValue(r);void 0!==e&&(t[n]=e)}return t}sanitizeValue(e){if(null===e)return null;if(void 0===e)return;if("function"==typeof e)return;if("symbol"==typeof e)return;if("object"!=typeof e)return e;if("$$typeof"in e)return;if(e instanceof Node)return;if(Array.isArray(e)){const t=[];for(const n of e){const e=this.sanitizeValue(n);void 0!==e&&t.push(e)}return t}const t={};for(const[n,r]of Object.entries(e)){if(n.startsWith("_"))continue;const e=this.sanitizeValue(r);void 0!==e&&(t[n]=e)}return t}buildComponentInfo(e){const t=this.isComponent(e),n={isComponent:t,componentType:t?"component":"host",name:t?this.getComponentName(e):e.tagName.toLowerCase()},r=e.getAttribute("data-nocode-components-name"),o=e.getAttribute("data-nocode-components-version");if(r&&(n.componentsName=r),o&&(n.componentsVersion=o),t){const t=this.getComponentProps(e)??{},r=this.removeSpecialProps(t);n.props=r}return n}removeSpecialProps(e){const t={};for(const[n,r]of Object.entries(e))"componentsName"!==n&&"componentsVersion"!==n&&(n.startsWith("data-nocode-")||(t[n]=r));return t}},Ue="data-dnd";function Ve(e){if(!e)return{};const t=e.split(":");if(t.length>=3){const n=t.pop(),r=t.pop(),o=t.join(":");return{id:e,filename:decodeURIComponent(o),component:r,codeId:n}}return 2===t.length?{id:e,component:t[0],codeId:t[1]}:{id:e}}const Be=`[${Ue}]`;function Ye(e,t){const n=t??0;return 0===n?document.querySelector(`[${Ue}="${e}"]`):document.querySelectorAll(`[${Ue}="${e}"]`)[n]??null}const qe=(e,t)=>{const n=((e,t)=>{const n=e.getBoundingClientRect(),{x:r,y:o}=((e,t)=>{let n=e.x,r=e.y;if(t){const e=t.getBoundingClientRect();n-=e.left,r-=e.top}return{x:n,y:r}})({x:n.left,y:n.top},t);return{width:e.offsetWidth||Math.round(n.width),height:e.offsetHeight||Math.round(n.height),top:o,left:r}})(e,t),r=function(e){return e.dataset}(e),o=Ke(e),i=Ge(e),s=(e=>{const t=window.getComputedStyle(e);return{display:t.display,flexDirection:t.flexDirection,flexWrap:t.flexWrap,position:t.position}})(e),a=r.dnd||"",c=Ve(a),l=function(e){return He.buildComponentInfo(e)}(e),u=function(e){return"true"===e.getAttribute("data-nocode-container-placeholder")}(e);let d;if(a){const t=document.querySelectorAll(`[${Ue}="${a}"]`);if(t.length>1)for(let n=0;n<t.length;n++)if(t[n]===e){d=n;break}}return{id:a,codeId:c.codeId,name:c.component||e.tagName.toLowerCase(),filename:c.filename,bounding:n,display:o,computedStyle:s,text:i,containerPlaceholder:u||void 0,componentInfo:l,dndIndex:d}},Ke=e=>ze(e).css("display"),Ge=e=>{const t=[];return e.childNodes.forEach(e=>{if(e.nodeType===Node.TEXT_NODE){const n=e.textContent?.trim()||"";n&&t.push(n)}}),t.join(" ")},Xe=e=>{const t=ze(e).closest(Be).get(0),n=ze(e).parents(Be).get();return n[0]!==t&&n.unshift(t),n};function Je(e){const t=["div","p","section","article","main","header","footer","nav","h1","h2","h3","h4","h5","h6","span","a","button","i","input","textarea","select","label","form","ul","ol","li","table","thead","tbody","tr","td","th","img","video","audio","canvas","svg"];try{const n=e.tagName.toLowerCase();if(!t.includes(n))return!1;const r=window.getComputedStyle(e);if("none"===r.display||"hidden"===r.visibility||"0"===r.opacity)return!1;const o=e.getBoundingClientRect();if(0===o.width||0===o.height)return;return!("inline"!==r.display&&"inline-block"!==r.display&&(0===o.width||0===o.height))}catch(e){return console.warn("Element validation failed:",e),!1}}function Ze(e,t=20){let n=e,r=0;for(;n&&r<t;){if(n.getAttribute(Ue))return n;n=n.parentElement,r++}return null}function Qe(e){const t=window.getComputedStyle(e),n={};for(let e=0;e<t.length;e++){const r=t[e];n[r]=t.getPropertyValue(r)}return n}let et=null,tt=new Set;const nt=e=>{const t=[],n=Array.from(e.children);for(;n.length;){const e=n.shift();e.getAttribute("data-dnd")?t.push(e):n.push(...Array.from(e.children))}return t},rt=e=>{let t=e.parentElement;for(;t;){if(t.getAttribute("data-dnd"))return t;t=t.parentElement}return null},ot=e=>{let t=(e=>{const t=new Set(e);return e.filter(e=>{let n=e.parentElement;for(;n;){if(t.has(n))return!1;n=n.parentElement}return!0})})(e),n=!0;for(;n;){n=!1;const e=new Map;for(const n of t){const t=rt(n);t&&(e.has(t)||e.set(t,[]),e.get(t).push(n))}for(const[r,o]of e){const e=nt(r);if(0===e.length)continue;const i=new Set(o);if(e.every(e=>i.has(e))){t=t.filter(e=>!o.includes(e)),t.includes(r)||t.push(r),n=!0;break}}}return t};function it(e){return(...t)=>{try{const n=e(...t);return n&&"function"==typeof n.then?n.catch(n=>(console.error(`Async error in ${e.name}:`,n),console.error("Error stack:",n.stack),console.error("Function arguments:",t),null)):n}catch(n){return console.error(`Sync error in ${e.name}:`,n),n instanceof Error&&console.error("Error stack:",n.stack),console.error("Function arguments:",t),null}}}const st={getDraggableParentsData:(e,t)=>{const n=function(e,t){const n=((e,t)=>{const n=document.elementFromPoint(e,t);if(!n)return null;const r=n=>{if(n?.shadowRoot){const o=n.shadowRoot.elementFromPoint(e,t);return o===n?n:o?.shadowRoot?r(o):o||n}return n};return r(n)})(e,t);if(!n)return null;let r=n;if(!Je(r)){let e=r.parentElement,t=0;const n=20;for(;e&&t<n;){if(Je(e)){r=e;break}e=e.parentElement,t++}if(!Je(r))return null}const o=Ze(r);return o&&Je(o)?o:null}(e.x,e.y);if(!n)return;let r=Xe(n);if(r.length&&(r=(e=>{for(let t=e.length-1;t>=0;t--){const n=(e[t].getAttribute("data-dnd")||"").split(":"),r=n.length>=2?n[n.length-2]:"";if(r&&/^[A-Z]/.test(r)&&!tt.has(r))return e.slice(t)}return e})(r),r.length)){if(t){const e=r.map(e=>qe(e));return{...e[0],computedStyle:Qe(r[0]),parents:e.slice(1)}}return{...qe(r[0]),computedStyle:Qe(r[0])}}},getElementDataById:(e,t)=>{const n=Ye(e,t);if(n)return{...qe(n),computedStyle:Qe(n)};console.warn("[getElementDataById] Element not found for domId:",e,"dndIndex:",t)},getEditableTextElementAtPosition:e=>{const t=function(e,t){if(document.caretPositionFromPoint){const n=document.caretPositionFromPoint(e,t);return n?.offsetNode??null}if(document.caretRangeFromPoint){const n=document.caretRangeFromPoint(e,t);return n?.startContainer??null}return document.elementFromPoint(e,t)}(e.x,e.y);if(!t)return void console.log("[getEditableTextElementAtPosition] No node at point:",e);if(t.nodeType!==Node.TEXT_NODE)return void console.log("[getEditableTextElementAtPosition] Not a text node:",t.nodeType);const n=t.textContent?.trim();if(!n)return void console.log("[getEditableTextElementAtPosition] Empty text node");const r=t.parentElement;if(!r)return void console.log("[getEditableTextElementAtPosition] No parent element");const o=Ze(r);if(o){if(function(e){const t=e.childNodes;let n=!1;for(let e=0;e<t.length;e++){const r=t[e];if(r.nodeType===Node.ELEMENT_NODE)return!1;if(r.nodeType===Node.TEXT_NODE){const e=r.textContent?.trim();e&&(n=!0)}}return n}(o))return console.log("[getEditableTextElementAtPosition] Found editable text element:",o.tagName,o.textContent),{...qe(o),computedStyle:Qe(o)};console.log("[getEditableTextElementAtPosition] Element has child elements, cannot edit directly:",o.tagName)}else console.log("[getEditableTextElementAtPosition] No marked element found")},updateElementTextContent:(e,t)=>{const n=Ye(e);return n?(n.textContent=t,!0):(console.warn("[updateElementTextContent] Element not found:",e),!1)},scrollToElement:(e,t)=>{const n=Ye(e,t);return n?(n.scrollIntoView({behavior:"instant",block:"center",inline:"center"}),!0):(console.warn("[scrollToElement] Element not found for domId:",e,"dndIndex:",t),!1)},scrollPageBy:(e,t)=>(window.scrollBy(e,t),!0),highlightElement:(e,t)=>{if(et&&(et.style.outline="",et.style.outlineOffset="",et=null),!e)return!0;const n=Ye(e,t);return n?(n.style.outline="2px solid rgba(54, 210, 190, 0.8)",n.style.outlineOffset="-1px",et=n,!0):(console.warn("[highlightElement] Element not found:",e,"dndIndex:",t),!1)},getProjectLibVersions:function(){try{const e=document.body;if(!e)return console.warn("[sandbox] document.body is not available"),null;const t=e.getAttribute("data-nocode-lib-versions");if(!t)return console.warn("[sandbox] data-nocode-lib-versions attribute not found on body"),null;const n=JSON.parse(t);return"object"!=typeof n||null===n?(console.warn("[sandbox] data-nocode-lib-versions is not a valid object"),null):n}catch(e){return console.error("[sandbox] Failed to parse data-nocode-lib-versions:",e),null}},getCompilerVersion:function(){try{const e=document.body;return e?e.getAttribute("data-nocode-compiler-version"):null}catch(e){return console.error("[sandbox] Failed to get compiler version:",e),null}},getRuntimeNodeTree:()=>{try{const e=document.querySelectorAll(Be);if(!e.length)return[];const t=new Map;e.forEach(e=>{const n=e.getAttribute(Ue)||"";if(!n)return;const r=Ve(n);t.set(e,{id:n,component:r.component||e.tagName.toLowerCase(),children:[]})});const n=[];e.forEach(e=>{const r=t.get(e);if(!r)return;let o,i=e.parentElement;for(;i;){if(t.has(i)){o=t.get(i);break}i=i.parentElement}o?o.children.push(r):n.push(r)});const r=e=>{e.children&&0===e.children.length?delete e.children:e.children&&e.children.forEach(r)};return n.forEach(r),n}catch(e){return console.error("[sandbox] Failed to build runtime node tree:",e),[]}},setElementStyle:function(e,t){const n=function(e){return document.querySelector(`[${Ue}="${e}"]`)}(e);return n?(Object.entries(t).forEach(([e,t])=>{n.style[e]=t}),!0):(console.warn("[setElementStyle] Element not found for domId:",e),!1)},getElementsInRect:e=>{const t=function(e){const t=document.querySelectorAll(Be),n=[];return t.forEach(t=>{const r=t,o=r.getBoundingClientRect();if(0===o.width||0===o.height)return;const i={x:o.left,y:o.top,width:o.width,height:o.height},s=e.width*e.height;var a,c;i.width*i.height<=2*s&&(c=i,(a=e).x<c.x+c.width&&a.x+a.width>c.x&&a.y<c.y+c.height&&a.y+a.height>c.y)&&n.push(r)}),n}(e);if(t.length)return{selectedItems:ot(t).map(e=>({...qe(e),computedStyle:Qe(e),parents:Xe(e).slice(1).map(e=>qe(e))}))}},setSelectConfig:e=>(tt=new Set(e),console.log("[sandbox] setSelectConfig:",e),!0)},at=Object.fromEntries(Object.entries(st).map(([e,t])=>[e,it(t)])),ct="nocode-design-mode";let lt=null,ut=!1,dt=null;const ft=t()(()=>{lt?.onWindowMutated&&(console.log(`${ct} - Notifying parent of DOM mutation`),lt.onWindowMutated({added:{},removed:{}}))},100),ht=async()=>{if(ut||lt)return lt;ut=!0,console.log(`${ct} - Creating penpal connection`);const e=(({messenger:e,methods:t={},timeout:n,channel:o,log:i})=>{if(!e)throw new r("INVALID_ARGUMENT","messenger must be defined");if(A.has(e))throw new r("INVALID_ARGUMENT","A messenger can only be used for a single connection");A.add(e);const s=[e.destroy],l=(e=>{let t,n=!1;return(...r)=>(n||(n=!0,t=e(...r)),t)})(t=>{if(t){const t={namespace:a,channel:o,type:"DESTROY"};try{e.sendMessage(t)}catch(e){}}for(const e of s)e();i?.("Connection destroyed")}),u=e=>(e=>c(e)&&e.namespace===a)(e)&&e.channel===o;return{promise:(async()=>{try{e.initialize({log:i,validateReceivedMessage:u}),e.addMessageHandler(e=>{(e=>"DESTROY"===e.type)(e)&&l(!1)});const{remoteProxy:r,destroy:a}=await I({messenger:e,methods:t,timeout:n,channel:o,log:i});return s.push(a),r}catch(e){throw l(!0),e}})(),destroy:()=>{l(!0)}}})({messenger:new M({remoteWindow:window===window.top?(console.warn(`${ct} - Not in an iframe, using window.parent as fallback`),window.parent):window.parent===window.top?window.parent:window.top?(console.log(`${ct} - Using window.top for nested iframe scenario`),window.top):window.parent,allowedOrigins:["*"]}),methods:at});return e.promise.then(e=>{if(!e)return console.error(`${ct} - Failed to setup penpal connection: child is null`),void pt();lt=e,console.log(`${ct} - Penpal connection set`),(()=>{if(dt)return;dt=new MutationObserver(e=>{e.some(e=>{const t=e.target;return"SCRIPT"!==t.tagName&&"STYLE"!==t.tagName&&("attributes"!==e.type||"style"===e.attributeName||"class"===e.attributeName)})&&ft()});const e=()=>{document.body&&dt&&(dt.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style","class"],characterData:!0}),console.log(`${ct} - MutationObserver started`))};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",e):e()})()}).finally(()=>{ut=!1}),e.promise.catch(e=>{console.error(`${ct} - Failed to setup penpal connection:`,e),pt()}),lt},pt=t()(()=>{ut||(console.log(`${ct} - Reconnecting to penpal parent`),lt=null,ht())},1e3);ht()})()})();';
345
345
  }
346
346
  function createSandboxScriptMiddleware(options) {
347
347
  var _a;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meituan-nocode/vite-plugin-nocode-compiler",
3
- "version": "0.5.0",
3
+ "version": "0.5.1-beta.0",
4
4
  "description": "Vite plugin for nocode compiler",
5
5
  "type": "module",
6
6
  "exports": {
@@ -18,7 +18,7 @@
18
18
  ],
19
19
  "dependencies": {
20
20
  "@meituan-nocode/nocode-compiler-core": "0.3.0",
21
- "@meituan-nocode/nocode-design-mode-sandbox-script": "0.1.0-beta.4"
21
+ "@meituan-nocode/nocode-design-mode-sandbox-script": "0.1.0-beta.7"
22
22
  },
23
23
  "devDependencies": {
24
24
  "@types/node": "^20.19.31",