@meituan-nocode/vite-plugin-nocode-compiler 0.3.1-beta.6 → 0.3.1-beta.7

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
@@ -178,7 +178,7 @@ function readJsonBody(req) {
178
178
  }
179
179
 
180
180
  // package.json
181
- var version = "0.3.1-beta.6";
181
+ var version = "0.3.1-beta.7";
182
182
 
183
183
  // src/design-mode/types.ts
184
184
  var SANDBOX_SCRIPT_PATH = "/sandbox-script.js";
@@ -298,7 +298,7 @@ function createVirtualCodeMiddleware(server, options, projectRoot) {
298
298
 
299
299
  // src/design-mode/sandbox-script.ts
300
300
  function getSandboxScriptContent() {
301
- 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",O=e=>e.join("."),x=e=>new r("TRANSMISSION_FAILED",`Unexpected message to translate: ${(e=>{try{return JSON.stringify(e)}catch(t){return String(e)}})(e)}`),T=({messenger:e,methods:t,timeout:n,channel:o,log:i})=>{const b=y();let E;const O=[];let x=!1;const T=g(t),{promise:I,resolve:M,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 O)e()},L=()=>{if(x)return;O.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);O.push(l),clearTimeout(A),x=!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){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:T};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),O.push(()=>e.removeMessageHandler(F)),D(),I},I=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.#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(O)};if(h(e))return{penpal:"call",id:e.id,methodName:O(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 x(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 x(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,j=R.push,_=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 K=Y.fn=Y.prototype=B.prototype={constructor:Y,__cash:!0,length:0,splice:k};K.get=function(e){return void 0===e?$.call(this):this[e<0?e+this.length:e]},K.eq=function(e){return Y(this.get(e))},K.first=function(){return this.eq(0)},K.last=function(){return this.eq(-1)},K.map=function(e){return Y(F.call(this,function(t,n){return e.call(t,n,t)}))},K.slice=function(){return Y($.apply(this,arguments))};var q=/(?:^\\w|[A-Z]|\\b\\w)/g,G=/[\\s-_]+/g;function X(e){return e.replace(q,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,K.each=function(e){return J(this,function(t,n){return e.call(t,n,t)}),this},K.removeProp=function(e){return this.each(function(t,n){delete n[e]})},Y.extend=K.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,K.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}},K.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}K.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},K.removeAttr=function(e){var t=se(e);return t.length?this.each(function(e,n){J(t,function(e){n.removeAttribute(e)})}):this},K.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}},K.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},K.addClass=function(e){return this.toggleClass(e,!0)},K.removeClass=function(e){return arguments.length?this.toggleClass(e,!1):this.attr("class","")},Y.unique=ae,K.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"}K.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},K.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},K.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){K["inner"+e]=function(){if(this[0])return this[0]===A?A["inner"+e]:this[0]["client"+e]}}),J(["width","height"],function(e,t){K[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){K["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 Oe="__cashEvents";function xe(e){return e[Oe]=e[Oe]||{}}function Te(e){var t=e.split(".");return[t[0],t.slice(1).sort()]}function Ie(e,t,n,r){var o=xe(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)Ie(e,t,n,r);else for(t in o)Ce(o,e,t)}K.off=function(e,t){var n=this;return void 0===e?this.each(function(e,t){return Ie(t)}):J(se(e),function(e){var r=Te(e),o=r[0],i=r[1];n.each(function(e,n){return Ie(n,o,i,t)})}),this},K.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=Te(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&&Ie(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=xe(e);o[t]=o[t]||[],o[t].push([n,r]),e.addEventListener(t,r)}(o,s,a,i)})}),this},K.one=function(e,t,n){return this.on(e,t,n,!0)},K.ready=function(e){var t=function(){return e(Y)};return"loading"!==P.readyState?setTimeout(t):P.addEventListener("DOMContentLoaded",t),this},K.trigger=function(e,t){var n=e;if(te(e)){var r=Te(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 Me=/select-one/i,Pe=/select-multiple/i;function Ae(e){var t=e.type;return Me.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;K.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)},K.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})},K.clone=function(){return this.map(function(e,t){return t.cloneNode(!0)})},K.detach=function(){return this.each(function(e,t){t.parentNode&&t.parentNode.removeChild(t)})};var Fe,je=/^\\s*<(\\w+)[^>]*>/,_e=/^\\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(_e.test(e))return[P.createElement(RegExp.$1)];var t=je.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,K.empty=function(){var e=this[0];if(e)for(;e.firstChild;)e.removeChild(e.firstChild);return this},K.append=function(){var e=this;return J(arguments,function(t){ke(e,t)}),this},K.appendTo=function(e){return ke(Y(e),this),this},K.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})},K.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},K.after=function(){var e=this;return J(_.apply(arguments),function(t){_.apply(Y(t).slice()).insertAfter(e)}),this},K.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},K.before=function(){var e=this;return J(arguments,function(t){Y(t).insertBefore(e)}),this},K.prepend=function(){var e=this;return J(arguments,function(t){ke(e,t,!0)}),this},K.prependTo=function(e){return ke(Y(e),_.apply(this.slice()),!0),this},K.remove=function(){return this.detach().off()},K.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))}})},K.replaceAll=function(e){return Y(e).replaceWith(this),this},K.text=function(e){return void 0===e?this[0]?this[0].textContent:"":this.each(function(t,n){n.textContent=e})};var We=P.documentElement;K.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}}},K.offsetParent=function(){return Y(this[0]&&this[0].offsetParent)},K.position=function(){var e=this[0];if(e)return{left:e.offsetLeft,top:e.offsetTop}},K.children=function(e){var t=[];return this.each(function(e,n){j.apply(t,n.children)}),t=Y(ae(t)),e?t.filter(function(t,n){return Q(n,e)}):t},K.contents=function(){var e=[];return this.each(function(t,n){j.apply(e,"IFRAME"===n.tagName?[n.contentDocument]:n.childNodes)}),Y(e.length&&ae(e))},K.find=function(e){for(var t=[],n=0,r=this.length;n<r;n++){var o=V(e,this[n]);o.length&&j.apply(t,o)}return Y(t.length&&ae(t))},K.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)},K.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},K.next=function(){return Y(this[0]&&this[0].nextElementSibling)},K.not=function(e){if(!e||!this[0])return this;var t=oe(e);return this.filter(function(n,r){return!t(n,r,e)})},K.parent=function(){var e=[];return this.each(function(t,n){n&&n.parentNode&&e.push(n.parentNode)}),Y(ae(e))},K.index=function(e){var t=e?Y(e)[0]:this[0],n=e?this:Y(t).parent().children();return D.call(n,t)},K.closest=function(e){return e&&this[0]?this.is(e)?this.filter(e):this.parent().closest(e):Y()},K.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))},K.prev=function(){return Y(this[0]&&this[0].previousElementSibling)},K.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",Ve=`[${Ue}]`;function Be(e){return document.querySelector(`[${Ue}="${e}"]`)}const Ye=(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,height:e.offsetHeight,top:o,left:r}},Ke=(e,t)=>{const n=Ye(e,t),r=function(e){return e.dataset}(e),o=qe(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=function(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}}(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 > ${Ve}`);if(!t.length)return[];const n=[];return t.forEach(e=>{const t=e;n.push(Ye(t))}),n})(e);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}},qe=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(" ")};function Xe(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 Je(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 Ze(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 Qe=null;function et(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 tt={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(!Xe(r)){let e=r.parentElement,t=0;const n=20;for(;e&&t<n;){if(Xe(e)){r=e;break}e=e.parentElement,t++}if(!Xe(r))return null}const o=Je(r);return o&&Xe(o)?o:null}(e.x,e.y);if(!n)return;const r=(e=>{const t=ze(e).closest(Ve).get(0),n=ze(e).parents(Ve).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:Ze(n),parents:e.slice(1)}}return{...Ke(r[0]),computedStyle:Ze(r[0])}}},getElementDataById:e=>{const t=Be(e);if(t)return{...Ke(t),computedStyle:Ze(t)};console.warn("[getElementDataById] Element not found for domId:",e)},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=Je(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:Ze(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=Be(e);return n?(n.textContent=t,!0):(console.warn("[updateElementTextContent] Element not found:",e),!1)},scrollToElement:e=>{const t=Be(e);return t?(t.scrollIntoView({behavior:"instant",block:"center",inline:"center"}),!0):(console.warn("[scrollToElement] Element not found for domId:",e),!1)},scrollPageBy:(e,t)=>(window.scrollBy(e,t),!0),highlightElement:e=>{if(Qe&&(Qe.style.outline="",Qe.style.outlineOffset="",Qe=null),!e)return!0;const t=Be(e);return t?(t.style.outline="2px solid rgba(54, 210, 190, 0.8)",t.style.outlineOffset="-1px",Qe=t,!0):(console.warn("[highlightElement] Element not found:",e),!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}}},nt=Object.fromEntries(Object.entries(tt).map(([e,t])=>[e,et(t)])),rt="nocode-design-mode";let ot=null,it=!1,st=null;const at=t()(()=>{ot?.onWindowMutated&&(console.log(`${rt} - Notifying parent of DOM mutation`),ot.onWindowMutated({added:{},removed:{}}))},100),ct=async()=>{if(it||ot)return ot;it=!0,console.log(`${rt} - 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(I.has(e))throw new r("INVALID_ARGUMENT","A messenger can only be used for a single connection");I.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 T({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 M({remoteWindow:window===window.top?(console.warn(`${rt} - Not in an iframe, using window.parent as fallback`),window.parent):window.parent===window.top?window.parent:window.top?(console.log(`${rt} - Using window.top for nested iframe scenario`),window.top):window.parent,allowedOrigins:["*"]}),methods:nt});return e.promise.then(e=>{if(!e)return console.error(`${rt} - Failed to setup penpal connection: child is null`),void ut();ot=e,console.log(`${rt} - Penpal connection set`),(()=>{if(st)return;st=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)})&&at()});const e=()=>{document.body&&st&&(st.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style","class"],characterData:!0}),console.log(`${rt} - MutationObserver started`))};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",e):e()})()}).finally(()=>{it=!1}),e.promise.catch(e=>{console.error(`${rt} - Failed to setup penpal connection:`,e),ut()}),ot},ut=t()(()=>{it||(console.log(`${rt} - Reconnecting to penpal parent`),ot=null,ct())},1e3);ct()})()})();';
301
+ 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",O=e=>e.join("."),x=e=>new r("TRANSMISSION_FAILED",`Unexpected message to translate: ${(e=>{try{return JSON.stringify(e)}catch(t){return String(e)}})(e)}`),T=({messenger:e,methods:t,timeout:n,channel:o,log:i})=>{const b=y();let E;const O=[];let x=!1;const T=g(t),{promise:I,resolve:M,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 O)e()},L=()=>{if(x)return;O.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);O.push(l),clearTimeout(A),x=!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){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:T};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),O.push(()=>e.removeMessageHandler(F)),D(),I},I=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.#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(O)};if(h(e))return{penpal:"call",id:e.id,methodName:O(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 x(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 x(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,j=R.push,_=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 K=Y.fn=Y.prototype=B.prototype={constructor:Y,__cash:!0,length:0,splice:k};K.get=function(e){return void 0===e?$.call(this):this[e<0?e+this.length:e]},K.eq=function(e){return Y(this.get(e))},K.first=function(){return this.eq(0)},K.last=function(){return this.eq(-1)},K.map=function(e){return Y(F.call(this,function(t,n){return e.call(t,n,t)}))},K.slice=function(){return Y($.apply(this,arguments))};var q=/(?:^\\w|[A-Z]|\\b\\w)/g,G=/[\\s-_]+/g;function X(e){return e.replace(q,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,K.each=function(e){return J(this,function(t,n){return e.call(t,n,t)}),this},K.removeProp=function(e){return this.each(function(t,n){delete n[e]})},Y.extend=K.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,K.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}},K.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}K.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},K.removeAttr=function(e){var t=se(e);return t.length?this.each(function(e,n){J(t,function(e){n.removeAttribute(e)})}):this},K.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}},K.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},K.addClass=function(e){return this.toggleClass(e,!0)},K.removeClass=function(e){return arguments.length?this.toggleClass(e,!1):this.attr("class","")},Y.unique=ae,K.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"}K.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},K.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},K.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){K["inner"+e]=function(){if(this[0])return this[0]===A?A["inner"+e]:this[0]["client"+e]}}),J(["width","height"],function(e,t){K[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){K["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 Oe="__cashEvents";function xe(e){return e[Oe]=e[Oe]||{}}function Te(e){var t=e.split(".");return[t[0],t.slice(1).sort()]}function Ie(e,t,n,r){var o=xe(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)Ie(e,t,n,r);else for(t in o)Ce(o,e,t)}K.off=function(e,t){var n=this;return void 0===e?this.each(function(e,t){return Ie(t)}):J(se(e),function(e){var r=Te(e),o=r[0],i=r[1];n.each(function(e,n){return Ie(n,o,i,t)})}),this},K.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=Te(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&&Ie(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=xe(e);o[t]=o[t]||[],o[t].push([n,r]),e.addEventListener(t,r)}(o,s,a,i)})}),this},K.one=function(e,t,n){return this.on(e,t,n,!0)},K.ready=function(e){var t=function(){return e(Y)};return"loading"!==P.readyState?setTimeout(t):P.addEventListener("DOMContentLoaded",t),this},K.trigger=function(e,t){var n=e;if(te(e)){var r=Te(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 Me=/select-one/i,Pe=/select-multiple/i;function Ae(e){var t=e.type;return Me.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;K.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)},K.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})},K.clone=function(){return this.map(function(e,t){return t.cloneNode(!0)})},K.detach=function(){return this.each(function(e,t){t.parentNode&&t.parentNode.removeChild(t)})};var Fe,je=/^\\s*<(\\w+)[^>]*>/,_e=/^\\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(_e.test(e))return[P.createElement(RegExp.$1)];var t=je.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,K.empty=function(){var e=this[0];if(e)for(;e.firstChild;)e.removeChild(e.firstChild);return this},K.append=function(){var e=this;return J(arguments,function(t){ke(e,t)}),this},K.appendTo=function(e){return ke(Y(e),this),this},K.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})},K.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},K.after=function(){var e=this;return J(_.apply(arguments),function(t){_.apply(Y(t).slice()).insertAfter(e)}),this},K.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},K.before=function(){var e=this;return J(arguments,function(t){Y(t).insertBefore(e)}),this},K.prepend=function(){var e=this;return J(arguments,function(t){ke(e,t,!0)}),this},K.prependTo=function(e){return ke(Y(e),_.apply(this.slice()),!0),this},K.remove=function(){return this.detach().off()},K.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))}})},K.replaceAll=function(e){return Y(e).replaceWith(this),this},K.text=function(e){return void 0===e?this[0]?this[0].textContent:"":this.each(function(t,n){n.textContent=e})};var We=P.documentElement;K.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}}},K.offsetParent=function(){return Y(this[0]&&this[0].offsetParent)},K.position=function(){var e=this[0];if(e)return{left:e.offsetLeft,top:e.offsetTop}},K.children=function(e){var t=[];return this.each(function(e,n){j.apply(t,n.children)}),t=Y(ae(t)),e?t.filter(function(t,n){return Q(n,e)}):t},K.contents=function(){var e=[];return this.each(function(t,n){j.apply(e,"IFRAME"===n.tagName?[n.contentDocument]:n.childNodes)}),Y(e.length&&ae(e))},K.find=function(e){for(var t=[],n=0,r=this.length;n<r;n++){var o=V(e,this[n]);o.length&&j.apply(t,o)}return Y(t.length&&ae(t))},K.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)},K.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},K.next=function(){return Y(this[0]&&this[0].nextElementSibling)},K.not=function(e){if(!e||!this[0])return this;var t=oe(e);return this.filter(function(n,r){return!t(n,r,e)})},K.parent=function(){var e=[];return this.each(function(t,n){n&&n.parentNode&&e.push(n.parentNode)}),Y(ae(e))},K.index=function(e){var t=e?Y(e)[0]:this[0],n=e?this:Y(t).parent().children();return D.call(n,t)},K.closest=function(e){return e&&this[0]?this.is(e)?this.filter(e):this.parent().closest(e):Y()},K.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))},K.prev=function(){return Y(this[0]&&this[0].previousElementSibling)},K.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){return document.querySelector(`[${Ue}="${e}"]`)}const Ke=(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,height:e.offsetHeight,top:o,left:r}},qe=(e,t)=>{const n=Ke(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(Ke(t))}),n})(e);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}},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=>qe(e));return{...e[0],computedStyle:Qe(n),parents:e.slice(1)}}return{...qe(r[0]),computedStyle:Qe(r[0])}}},getElementDataById:e=>{const t=Ye(e);if(t)return{...qe(t),computedStyle:Qe(t)};console.warn("[getElementDataById] Element not found for domId:",e)},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=>{const t=Ye(e);return t?(t.scrollIntoView({behavior:"instant",block:"center",inline:"center"}),!0):(console.warn("[scrollToElement] Element not found for domId:",e),!1)},scrollPageBy:(e,t)=>(window.scrollBy(e,t),!0),highlightElement:e=>{if(et&&(et.style.outline="",et.style.outlineOffset="",et=null),!e)return!0;const t=Ye(e);return t?(t.style.outline="2px solid rgba(54, 210, 190, 0.8)",t.style.outlineOffset="-1px",et=t,!0):(console.warn("[highlightElement] Element not found:",e),!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),[]}}},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(I.has(e))throw new r("INVALID_ARGUMENT","A messenger can only be used for a single connection");I.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 T({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 M({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()})()})();';
302
302
  }
303
303
  function createSandboxScriptMiddleware(options) {
304
304
  var _a;
@@ -450,7 +450,7 @@ function componentCompiler(options = {}) {
450
450
  * 配置解析完成后:
451
451
  * 1. 将本插件移到插件列表最前面,确保在所有 enforce: 'pre' 插件中第一个执行
452
452
  * 2. 初始化 PackageVersionRegistry
453
- * 并预扫描项目 dependencies,填充版本缓存
453
+ * 3. 预扫描项目 dependencies,填充版本缓存
454
454
  */
455
455
  configResolved(config) {
456
456
  ensurePluginFirst(config, (error) => monitorService.reportError(error, { scene: "ensurePluginFirst" }));
package/dist/index.js CHANGED
@@ -143,7 +143,7 @@ function readJsonBody(req) {
143
143
  }
144
144
 
145
145
  // package.json
146
- var version = "0.3.1-beta.6";
146
+ var version = "0.3.1-beta.7";
147
147
 
148
148
  // src/design-mode/types.ts
149
149
  var SANDBOX_SCRIPT_PATH = "/sandbox-script.js";
@@ -263,7 +263,7 @@ function createVirtualCodeMiddleware(server, options, projectRoot) {
263
263
 
264
264
  // src/design-mode/sandbox-script.ts
265
265
  function getSandboxScriptContent() {
266
- 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",O=e=>e.join("."),x=e=>new r("TRANSMISSION_FAILED",`Unexpected message to translate: ${(e=>{try{return JSON.stringify(e)}catch(t){return String(e)}})(e)}`),T=({messenger:e,methods:t,timeout:n,channel:o,log:i})=>{const b=y();let E;const O=[];let x=!1;const T=g(t),{promise:I,resolve:M,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 O)e()},L=()=>{if(x)return;O.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);O.push(l),clearTimeout(A),x=!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){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:T};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),O.push(()=>e.removeMessageHandler(F)),D(),I},I=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.#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(O)};if(h(e))return{penpal:"call",id:e.id,methodName:O(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 x(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 x(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,j=R.push,_=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 K=Y.fn=Y.prototype=B.prototype={constructor:Y,__cash:!0,length:0,splice:k};K.get=function(e){return void 0===e?$.call(this):this[e<0?e+this.length:e]},K.eq=function(e){return Y(this.get(e))},K.first=function(){return this.eq(0)},K.last=function(){return this.eq(-1)},K.map=function(e){return Y(F.call(this,function(t,n){return e.call(t,n,t)}))},K.slice=function(){return Y($.apply(this,arguments))};var q=/(?:^\\w|[A-Z]|\\b\\w)/g,G=/[\\s-_]+/g;function X(e){return e.replace(q,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,K.each=function(e){return J(this,function(t,n){return e.call(t,n,t)}),this},K.removeProp=function(e){return this.each(function(t,n){delete n[e]})},Y.extend=K.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,K.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}},K.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}K.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},K.removeAttr=function(e){var t=se(e);return t.length?this.each(function(e,n){J(t,function(e){n.removeAttribute(e)})}):this},K.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}},K.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},K.addClass=function(e){return this.toggleClass(e,!0)},K.removeClass=function(e){return arguments.length?this.toggleClass(e,!1):this.attr("class","")},Y.unique=ae,K.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"}K.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},K.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},K.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){K["inner"+e]=function(){if(this[0])return this[0]===A?A["inner"+e]:this[0]["client"+e]}}),J(["width","height"],function(e,t){K[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){K["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 Oe="__cashEvents";function xe(e){return e[Oe]=e[Oe]||{}}function Te(e){var t=e.split(".");return[t[0],t.slice(1).sort()]}function Ie(e,t,n,r){var o=xe(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)Ie(e,t,n,r);else for(t in o)Ce(o,e,t)}K.off=function(e,t){var n=this;return void 0===e?this.each(function(e,t){return Ie(t)}):J(se(e),function(e){var r=Te(e),o=r[0],i=r[1];n.each(function(e,n){return Ie(n,o,i,t)})}),this},K.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=Te(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&&Ie(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=xe(e);o[t]=o[t]||[],o[t].push([n,r]),e.addEventListener(t,r)}(o,s,a,i)})}),this},K.one=function(e,t,n){return this.on(e,t,n,!0)},K.ready=function(e){var t=function(){return e(Y)};return"loading"!==P.readyState?setTimeout(t):P.addEventListener("DOMContentLoaded",t),this},K.trigger=function(e,t){var n=e;if(te(e)){var r=Te(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 Me=/select-one/i,Pe=/select-multiple/i;function Ae(e){var t=e.type;return Me.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;K.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)},K.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})},K.clone=function(){return this.map(function(e,t){return t.cloneNode(!0)})},K.detach=function(){return this.each(function(e,t){t.parentNode&&t.parentNode.removeChild(t)})};var Fe,je=/^\\s*<(\\w+)[^>]*>/,_e=/^\\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(_e.test(e))return[P.createElement(RegExp.$1)];var t=je.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,K.empty=function(){var e=this[0];if(e)for(;e.firstChild;)e.removeChild(e.firstChild);return this},K.append=function(){var e=this;return J(arguments,function(t){ke(e,t)}),this},K.appendTo=function(e){return ke(Y(e),this),this},K.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})},K.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},K.after=function(){var e=this;return J(_.apply(arguments),function(t){_.apply(Y(t).slice()).insertAfter(e)}),this},K.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},K.before=function(){var e=this;return J(arguments,function(t){Y(t).insertBefore(e)}),this},K.prepend=function(){var e=this;return J(arguments,function(t){ke(e,t,!0)}),this},K.prependTo=function(e){return ke(Y(e),_.apply(this.slice()),!0),this},K.remove=function(){return this.detach().off()},K.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))}})},K.replaceAll=function(e){return Y(e).replaceWith(this),this},K.text=function(e){return void 0===e?this[0]?this[0].textContent:"":this.each(function(t,n){n.textContent=e})};var We=P.documentElement;K.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}}},K.offsetParent=function(){return Y(this[0]&&this[0].offsetParent)},K.position=function(){var e=this[0];if(e)return{left:e.offsetLeft,top:e.offsetTop}},K.children=function(e){var t=[];return this.each(function(e,n){j.apply(t,n.children)}),t=Y(ae(t)),e?t.filter(function(t,n){return Q(n,e)}):t},K.contents=function(){var e=[];return this.each(function(t,n){j.apply(e,"IFRAME"===n.tagName?[n.contentDocument]:n.childNodes)}),Y(e.length&&ae(e))},K.find=function(e){for(var t=[],n=0,r=this.length;n<r;n++){var o=V(e,this[n]);o.length&&j.apply(t,o)}return Y(t.length&&ae(t))},K.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)},K.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},K.next=function(){return Y(this[0]&&this[0].nextElementSibling)},K.not=function(e){if(!e||!this[0])return this;var t=oe(e);return this.filter(function(n,r){return!t(n,r,e)})},K.parent=function(){var e=[];return this.each(function(t,n){n&&n.parentNode&&e.push(n.parentNode)}),Y(ae(e))},K.index=function(e){var t=e?Y(e)[0]:this[0],n=e?this:Y(t).parent().children();return D.call(n,t)},K.closest=function(e){return e&&this[0]?this.is(e)?this.filter(e):this.parent().closest(e):Y()},K.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))},K.prev=function(){return Y(this[0]&&this[0].previousElementSibling)},K.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",Ve=`[${Ue}]`;function Be(e){return document.querySelector(`[${Ue}="${e}"]`)}const Ye=(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,height:e.offsetHeight,top:o,left:r}},Ke=(e,t)=>{const n=Ye(e,t),r=function(e){return e.dataset}(e),o=qe(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=function(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}}(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 > ${Ve}`);if(!t.length)return[];const n=[];return t.forEach(e=>{const t=e;n.push(Ye(t))}),n})(e);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}},qe=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(" ")};function Xe(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 Je(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 Ze(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 Qe=null;function et(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 tt={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(!Xe(r)){let e=r.parentElement,t=0;const n=20;for(;e&&t<n;){if(Xe(e)){r=e;break}e=e.parentElement,t++}if(!Xe(r))return null}const o=Je(r);return o&&Xe(o)?o:null}(e.x,e.y);if(!n)return;const r=(e=>{const t=ze(e).closest(Ve).get(0),n=ze(e).parents(Ve).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:Ze(n),parents:e.slice(1)}}return{...Ke(r[0]),computedStyle:Ze(r[0])}}},getElementDataById:e=>{const t=Be(e);if(t)return{...Ke(t),computedStyle:Ze(t)};console.warn("[getElementDataById] Element not found for domId:",e)},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=Je(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:Ze(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=Be(e);return n?(n.textContent=t,!0):(console.warn("[updateElementTextContent] Element not found:",e),!1)},scrollToElement:e=>{const t=Be(e);return t?(t.scrollIntoView({behavior:"instant",block:"center",inline:"center"}),!0):(console.warn("[scrollToElement] Element not found for domId:",e),!1)},scrollPageBy:(e,t)=>(window.scrollBy(e,t),!0),highlightElement:e=>{if(Qe&&(Qe.style.outline="",Qe.style.outlineOffset="",Qe=null),!e)return!0;const t=Be(e);return t?(t.style.outline="2px solid rgba(54, 210, 190, 0.8)",t.style.outlineOffset="-1px",Qe=t,!0):(console.warn("[highlightElement] Element not found:",e),!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}}},nt=Object.fromEntries(Object.entries(tt).map(([e,t])=>[e,et(t)])),rt="nocode-design-mode";let ot=null,it=!1,st=null;const at=t()(()=>{ot?.onWindowMutated&&(console.log(`${rt} - Notifying parent of DOM mutation`),ot.onWindowMutated({added:{},removed:{}}))},100),ct=async()=>{if(it||ot)return ot;it=!0,console.log(`${rt} - 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(I.has(e))throw new r("INVALID_ARGUMENT","A messenger can only be used for a single connection");I.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 T({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 M({remoteWindow:window===window.top?(console.warn(`${rt} - Not in an iframe, using window.parent as fallback`),window.parent):window.parent===window.top?window.parent:window.top?(console.log(`${rt} - Using window.top for nested iframe scenario`),window.top):window.parent,allowedOrigins:["*"]}),methods:nt});return e.promise.then(e=>{if(!e)return console.error(`${rt} - Failed to setup penpal connection: child is null`),void ut();ot=e,console.log(`${rt} - Penpal connection set`),(()=>{if(st)return;st=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)})&&at()});const e=()=>{document.body&&st&&(st.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style","class"],characterData:!0}),console.log(`${rt} - MutationObserver started`))};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",e):e()})()}).finally(()=>{it=!1}),e.promise.catch(e=>{console.error(`${rt} - Failed to setup penpal connection:`,e),ut()}),ot},ut=t()(()=>{it||(console.log(`${rt} - Reconnecting to penpal parent`),ot=null,ct())},1e3);ct()})()})();';
266
+ 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",O=e=>e.join("."),x=e=>new r("TRANSMISSION_FAILED",`Unexpected message to translate: ${(e=>{try{return JSON.stringify(e)}catch(t){return String(e)}})(e)}`),T=({messenger:e,methods:t,timeout:n,channel:o,log:i})=>{const b=y();let E;const O=[];let x=!1;const T=g(t),{promise:I,resolve:M,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 O)e()},L=()=>{if(x)return;O.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);O.push(l),clearTimeout(A),x=!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){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:T};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),O.push(()=>e.removeMessageHandler(F)),D(),I},I=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.#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(O)};if(h(e))return{penpal:"call",id:e.id,methodName:O(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 x(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 x(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,j=R.push,_=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 K=Y.fn=Y.prototype=B.prototype={constructor:Y,__cash:!0,length:0,splice:k};K.get=function(e){return void 0===e?$.call(this):this[e<0?e+this.length:e]},K.eq=function(e){return Y(this.get(e))},K.first=function(){return this.eq(0)},K.last=function(){return this.eq(-1)},K.map=function(e){return Y(F.call(this,function(t,n){return e.call(t,n,t)}))},K.slice=function(){return Y($.apply(this,arguments))};var q=/(?:^\\w|[A-Z]|\\b\\w)/g,G=/[\\s-_]+/g;function X(e){return e.replace(q,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,K.each=function(e){return J(this,function(t,n){return e.call(t,n,t)}),this},K.removeProp=function(e){return this.each(function(t,n){delete n[e]})},Y.extend=K.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,K.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}},K.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}K.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},K.removeAttr=function(e){var t=se(e);return t.length?this.each(function(e,n){J(t,function(e){n.removeAttribute(e)})}):this},K.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}},K.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},K.addClass=function(e){return this.toggleClass(e,!0)},K.removeClass=function(e){return arguments.length?this.toggleClass(e,!1):this.attr("class","")},Y.unique=ae,K.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"}K.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},K.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},K.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){K["inner"+e]=function(){if(this[0])return this[0]===A?A["inner"+e]:this[0]["client"+e]}}),J(["width","height"],function(e,t){K[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){K["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 Oe="__cashEvents";function xe(e){return e[Oe]=e[Oe]||{}}function Te(e){var t=e.split(".");return[t[0],t.slice(1).sort()]}function Ie(e,t,n,r){var o=xe(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)Ie(e,t,n,r);else for(t in o)Ce(o,e,t)}K.off=function(e,t){var n=this;return void 0===e?this.each(function(e,t){return Ie(t)}):J(se(e),function(e){var r=Te(e),o=r[0],i=r[1];n.each(function(e,n){return Ie(n,o,i,t)})}),this},K.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=Te(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&&Ie(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=xe(e);o[t]=o[t]||[],o[t].push([n,r]),e.addEventListener(t,r)}(o,s,a,i)})}),this},K.one=function(e,t,n){return this.on(e,t,n,!0)},K.ready=function(e){var t=function(){return e(Y)};return"loading"!==P.readyState?setTimeout(t):P.addEventListener("DOMContentLoaded",t),this},K.trigger=function(e,t){var n=e;if(te(e)){var r=Te(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 Me=/select-one/i,Pe=/select-multiple/i;function Ae(e){var t=e.type;return Me.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;K.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)},K.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})},K.clone=function(){return this.map(function(e,t){return t.cloneNode(!0)})},K.detach=function(){return this.each(function(e,t){t.parentNode&&t.parentNode.removeChild(t)})};var Fe,je=/^\\s*<(\\w+)[^>]*>/,_e=/^\\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(_e.test(e))return[P.createElement(RegExp.$1)];var t=je.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,K.empty=function(){var e=this[0];if(e)for(;e.firstChild;)e.removeChild(e.firstChild);return this},K.append=function(){var e=this;return J(arguments,function(t){ke(e,t)}),this},K.appendTo=function(e){return ke(Y(e),this),this},K.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})},K.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},K.after=function(){var e=this;return J(_.apply(arguments),function(t){_.apply(Y(t).slice()).insertAfter(e)}),this},K.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},K.before=function(){var e=this;return J(arguments,function(t){Y(t).insertBefore(e)}),this},K.prepend=function(){var e=this;return J(arguments,function(t){ke(e,t,!0)}),this},K.prependTo=function(e){return ke(Y(e),_.apply(this.slice()),!0),this},K.remove=function(){return this.detach().off()},K.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))}})},K.replaceAll=function(e){return Y(e).replaceWith(this),this},K.text=function(e){return void 0===e?this[0]?this[0].textContent:"":this.each(function(t,n){n.textContent=e})};var We=P.documentElement;K.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}}},K.offsetParent=function(){return Y(this[0]&&this[0].offsetParent)},K.position=function(){var e=this[0];if(e)return{left:e.offsetLeft,top:e.offsetTop}},K.children=function(e){var t=[];return this.each(function(e,n){j.apply(t,n.children)}),t=Y(ae(t)),e?t.filter(function(t,n){return Q(n,e)}):t},K.contents=function(){var e=[];return this.each(function(t,n){j.apply(e,"IFRAME"===n.tagName?[n.contentDocument]:n.childNodes)}),Y(e.length&&ae(e))},K.find=function(e){for(var t=[],n=0,r=this.length;n<r;n++){var o=V(e,this[n]);o.length&&j.apply(t,o)}return Y(t.length&&ae(t))},K.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)},K.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},K.next=function(){return Y(this[0]&&this[0].nextElementSibling)},K.not=function(e){if(!e||!this[0])return this;var t=oe(e);return this.filter(function(n,r){return!t(n,r,e)})},K.parent=function(){var e=[];return this.each(function(t,n){n&&n.parentNode&&e.push(n.parentNode)}),Y(ae(e))},K.index=function(e){var t=e?Y(e)[0]:this[0],n=e?this:Y(t).parent().children();return D.call(n,t)},K.closest=function(e){return e&&this[0]?this.is(e)?this.filter(e):this.parent().closest(e):Y()},K.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))},K.prev=function(){return Y(this[0]&&this[0].previousElementSibling)},K.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){return document.querySelector(`[${Ue}="${e}"]`)}const Ke=(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,height:e.offsetHeight,top:o,left:r}},qe=(e,t)=>{const n=Ke(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(Ke(t))}),n})(e);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}},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=>qe(e));return{...e[0],computedStyle:Qe(n),parents:e.slice(1)}}return{...qe(r[0]),computedStyle:Qe(r[0])}}},getElementDataById:e=>{const t=Ye(e);if(t)return{...qe(t),computedStyle:Qe(t)};console.warn("[getElementDataById] Element not found for domId:",e)},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=>{const t=Ye(e);return t?(t.scrollIntoView({behavior:"instant",block:"center",inline:"center"}),!0):(console.warn("[scrollToElement] Element not found for domId:",e),!1)},scrollPageBy:(e,t)=>(window.scrollBy(e,t),!0),highlightElement:e=>{if(et&&(et.style.outline="",et.style.outlineOffset="",et=null),!e)return!0;const t=Ye(e);return t?(t.style.outline="2px solid rgba(54, 210, 190, 0.8)",t.style.outlineOffset="-1px",et=t,!0):(console.warn("[highlightElement] Element not found:",e),!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),[]}}},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(I.has(e))throw new r("INVALID_ARGUMENT","A messenger can only be used for a single connection");I.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 T({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 M({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()})()})();';
267
267
  }
268
268
  function createSandboxScriptMiddleware(options) {
269
269
  var _a;
@@ -415,7 +415,7 @@ function componentCompiler(options = {}) {
415
415
  * 配置解析完成后:
416
416
  * 1. 将本插件移到插件列表最前面,确保在所有 enforce: 'pre' 插件中第一个执行
417
417
  * 2. 初始化 PackageVersionRegistry
418
- * 并预扫描项目 dependencies,填充版本缓存
418
+ * 3. 预扫描项目 dependencies,填充版本缓存
419
419
  */
420
420
  configResolved(config) {
421
421
  ensurePluginFirst(config, (error) => monitorService.reportError(error, { scene: "ensurePluginFirst" }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meituan-nocode/vite-plugin-nocode-compiler",
3
- "version": "0.3.1-beta.6",
3
+ "version": "0.3.1-beta.7",
4
4
  "description": "Vite plugin for nocode compiler",
5
5
  "type": "module",
6
6
  "exports": {
@@ -17,8 +17,8 @@
17
17
  "dist"
18
18
  ],
19
19
  "dependencies": {
20
- "@meituan-nocode/nocode-compiler-core": "0.2.9-beta.3",
21
- "@meituan-nocode/nocode-design-mode-sandbox-script": "0.1.0-beta.1"
20
+ "@meituan-nocode/nocode-compiler-core": "0.2.9-beta.4",
21
+ "@meituan-nocode/nocode-design-mode-sandbox-script": "0.1.0-beta.2"
22
22
  },
23
23
  "devDependencies": {
24
24
  "@types/node": "^20.19.31",