@dropins/tools 0.28.0-alpha2 → 0.28.0-alpha3

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.
@@ -9,4 +9,4 @@ var Zt=Object.defineProperty;var Gt=(t,e,r)=>e in t?Zt(t,e,{enumerable:!0,config
9
9
  `),yt=!1,rt=0;rt<D.length;rt++){var it=D[rt];if(it!=null&&it!==!1){var U=z(it,e,r,!0,d==="svg"||d!=="foreignObject"&&n,o);if(f&&!et&&Ot(U)&&(et=!0),U)if(f){var bt=U.length>0&&U[0]!="<";yt&&bt?M[M.length-1]+=U:M.push(U),yt=bt}else M.push(U)}}if(f&&et)for(var nt=M.length;nt--;)M[nt]=`
10
10
  `+u+$t(M[nt],u)}if(M.length||O)h+=M.join("");else if(r&&r.xml)return h.substring(0,h.length-1)+" />";return!Kt||D||O?(f&&~h.indexOf(`
11
11
  `)&&(h+=`
12
- `),h=h+"</"+d+">"):h=h.replace(/>$/," />"),h}var _e={shallow:!0};J.render=J;var ye=function(t,e){return J(t,e,_e)},At=[];function J(t,e,r){e=e||{};var i=b.__s;b.__s=!0;var n,o=Nt(G,null);return o.__k=[t],n=r&&(r.pretty||r.voidElements||r.sortAttributes||r.shallow||r.allAttributes||r.xml||r.attributeHook)?z(t,e,r):W(t,e,!1,void 0,o),b.__c&&b.__c(t,At),b.__s=i,At.length=0,n}function ut(t){return t==null||typeof t=="boolean"?null:typeof t=="string"||typeof t=="number"||typeof t=="bigint"?Nt(null,null,t):t}function be(t,e){return t==="className"?"class":t==="htmlFor"?"for":t==="defaultValue"?"value":t==="defaultChecked"?"checked":t==="defaultSelected"?"selected":e&&Tt.test(t)?t.toLowerCase().replace(/^xlink:?/,"xlink:"):t}function ge(t,e){return t==="style"&&e!=null&&typeof e=="object"?kt(e):t[0]==="a"&&t[1]==="r"&&typeof e=="boolean"?String(e):e}var Mt=Array.isArray,Et=Object.assign;function W(t,e,r,i,n){if(t==null||t===!0||t===!1||t==="")return"";if(typeof t!="object")return typeof t=="function"?"":K(t);if(Mt(t)){var o="";n.__k=t;for(var f=0;f<t.length;f++)o+=W(t[f],e,r,i,n),t[f]=ut(t[f]);return o}if(t.constructor!==void 0)return"";t.__=n,b.__b&&b.__b(t);var u=t.type,_=t.props;if(typeof u=="function"){var y;if(u===G)y=_.children;else{y=u.prototype&&typeof u.prototype.render=="function"?function(m,C){var a=m.type,v=R(a,C),l=new a(m.props,v);m.__c=l,l.__v=m,l.__d=!0,l.props=m.props,l.state==null&&(l.state={}),l.__s==null&&(l.__s=l.state),l.context=v,a.getDerivedStateFromProps?l.state=Et({},l.state,a.getDerivedStateFromProps(l.props,l.state)):l.componentWillMount&&(l.componentWillMount(),l.state=l.__s!==l.state?l.__s:l.state);var A=b.__r;return A&&A(m),l.render(l.props,l.state,l.context)}(t,e):function(m,C){var a,v=Dt(m,C),l=R(m.type,C);m.__c=v;for(var A=b.__r,D=0;v.__d&&D++<25;)v.__d=!1,A&&A(m),a=m.type.call(v,m.props,l);return a}(t,e);var x=t.__c;x.getChildContext&&(e=Et({},e,x.getChildContext()))}var d=W(y=y!=null&&y.type===G&&y.key==null?y.props.children:y,e,r,i,t);return b.diffed&&b.diffed(t),t.__=void 0,b.unmount&&b.unmount(t),d}var c,S,$="<";if($+=u,_)for(var g in c=_.children,_){var s=_[g];if(!(g==="key"||g==="ref"||g==="__self"||g==="__source"||g==="children"||g==="className"&&"class"in _||g==="htmlFor"&&"for"in _||Q.test(g))){if(s=ge(g=be(g,r),s),g==="dangerouslySetInnerHTML")S=s&&s.__html;else if(u==="textarea"&&g==="value")c=s;else if((s||s===0||s==="")&&typeof s!="function"){if(s===!0||s===""){s=g,$=$+" "+g;continue}if(g==="value"){if(u==="select"){i=s;continue}u!=="option"||i!=s||"selected"in _||($+=" selected")}$=$+" "+g+'="'+K(s)+'"'}}}var T=$;if($+=">",Q.test(u))throw new Error(u+" is not a valid HTML tag name in "+$);var N="",P=!1;if(S)N+=S,P=!0;else if(typeof c=="string")N+=K(c),P=!0;else if(Mt(c)){t.__k=c;for(var k=0;k<c.length;k++){var j=c[k];if(c[k]=ut(j),j!=null&&j!==!1){var O=W(j,e,u==="svg"||u!=="foreignObject"&&r,i,t);O&&(N+=O,P=!0)}}}else if(c!=null&&c!==!1&&c!==!0){t.__k=[ut(c)];var h=W(c,e,u==="svg"||u!=="foreignObject"&&r,i,t);h&&(N+=h,P=!0)}if(b.diffed&&b.diffed(t),t.__=void 0,b.unmount&&b.unmount(t),P)$+=N;else if(Ut.test(u))return T+" />";return $+"</"+u+">"}J.shallowRender=ye;var me=Symbol.for("preact-signals");function ht(){if(F>1)F--;else{for(var t,e=!1;Z!==void 0;){var r=Z;for(Z=void 0,vt++;r!==void 0;){var i=r.o;if(r.o=void 0,r.f&=-3,!(8&r.f)&&Lt(r))try{r.c()}catch(n){e||(t=n,e=!0)}r=i}}if(vt=0,F--,e)throw t}}var p=void 0,Z=void 0,F=0,vt=0,I=0;function Ft(t){if(p!==void 0){var e=t.n;if(e===void 0||e.t!==p)return e={i:0,S:t,p:p.s,n:void 0,t:p,e:void 0,x:void 0,r:e},p.s!==void 0&&(p.s.n=e),p.s=e,t.n=e,32&p.f&&t.S(e),e;if(e.i===-1)return e.i=0,e.n!==void 0&&(e.n.p=e.p,e.p!==void 0&&(e.p.n=e.n),e.p=p.s,e.n=void 0,p.s.n=e,p.s=e),e}}function w(t){this.v=t,this.i=0,this.n=void 0,this.t=void 0}w.prototype.brand=me;w.prototype.h=function(){return!0};w.prototype.S=function(t){this.t!==t&&t.e===void 0&&(t.x=this.t,this.t!==void 0&&(this.t.e=t),this.t=t)};w.prototype.U=function(t){if(this.t!==void 0){var e=t.e,r=t.x;e!==void 0&&(e.x=r,t.e=void 0),r!==void 0&&(r.e=e,t.x=void 0),t===this.t&&(this.t=r)}};w.prototype.subscribe=function(t){var e=this;return _t(function(){var r=e.value,i=p;p=void 0;try{t(r)}finally{p=i}})};w.prototype.valueOf=function(){return this.value};w.prototype.toString=function(){return this.value+""};w.prototype.toJSON=function(){return this.value};w.prototype.peek=function(){var t=p;p=void 0;try{return this.value}finally{p=t}};Object.defineProperty(w.prototype,"value",{get:function(){var t=Ft(this);return t!==void 0&&(t.i=this.i),this.v},set:function(t){if(t!==this.v){if(vt>100)throw new Error("Cycle detected");this.v=t,this.i++,I++,F++;try{for(var e=this.t;e!==void 0;e=e.x)e.t.N()}finally{ht()}}}});function H(t){return new w(t)}function Lt(t){for(var e=t.s;e!==void 0;e=e.n)if(e.S.i!==e.i||!e.S.h()||e.S.i!==e.i)return!0;return!1}function qt(t){for(var e=t.s;e!==void 0;e=e.n){var r=e.S.n;if(r!==void 0&&(e.r=r),e.S.n=e,e.i=-1,e.n===void 0){t.s=e;break}}}function Vt(t){for(var e=t.s,r=void 0;e!==void 0;){var i=e.p;e.i===-1?(e.S.U(e),i!==void 0&&(i.n=e.n),e.n!==void 0&&(e.n.p=i)):r=e,e.S.n=e.r,e.r!==void 0&&(e.r=void 0),e=i}t.s=r}function q(t){w.call(this,void 0),this.x=t,this.s=void 0,this.g=I-1,this.f=4}(q.prototype=new w).h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===I))return!0;if(this.g=I,this.f|=1,this.i>0&&!Lt(this))return this.f&=-2,!0;var t=p;try{qt(this),p=this;var e=this.x();(16&this.f||this.v!==e||this.i===0)&&(this.v=e,this.f&=-17,this.i++)}catch(r){this.v=r,this.f|=16,this.i++}return p=t,Vt(this),this.f&=-2,!0};q.prototype.S=function(t){if(this.t===void 0){this.f|=36;for(var e=this.s;e!==void 0;e=e.n)e.S.S(e)}w.prototype.S.call(this,t)};q.prototype.U=function(t){if(this.t!==void 0&&(w.prototype.U.call(this,t),this.t===void 0)){this.f&=-33;for(var e=this.s;e!==void 0;e=e.n)e.S.U(e)}};q.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var t=this.t;t!==void 0;t=t.x)t.t.N()}};Object.defineProperty(q.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var t=Ft(this);if(this.h(),t!==void 0&&(t.i=this.i),16&this.f)throw this.v;return this.v}});function we(t){return new q(t)}function zt(t){var e=t.u;if(t.u=void 0,typeof e=="function"){F++;var r=p;p=void 0;try{e()}catch(i){throw t.f&=-2,t.f|=8,pt(t),i}finally{p=r,ht()}}}function pt(t){for(var e=t.s;e!==void 0;e=e.n)e.S.U(e);t.x=void 0,t.s=void 0,zt(t)}function xe(t){if(p!==this)throw new Error("Out-of-order effect");Vt(this),p=t,this.f&=-2,8&this.f&&pt(this),ht()}function X(t){this.x=t,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32}X.prototype.c=function(){var t=this.S();try{if(8&this.f||this.x===void 0)return;var e=this.x();typeof e=="function"&&(this.u=e)}finally{t()}};X.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,zt(this),qt(this),F++;var t=p;return p=this,xe.bind(this,t)};X.prototype.N=function(){2&this.f||(this.f|=2,this.o=Z,Z=this)};X.prototype.d=function(){this.f|=8,1&this.f||pt(this)};function _t(t){var e=new X(t);try{e.c()}catch(r){throw e.d(),r}return e.d.bind(e)}var lt;function V(t,e){b[t]=e.bind(null,b[t]||function(){})}function tt(t){lt&&lt(),lt=t&&t.S()}function Wt(t){var e=this,r=t.data,i=Oe(r);i.value=r;var n=Ct(function(){for(var o=e.__v;o=o.__;)if(o.__c){o.__c.__$f|=4;break}return e.__$u.c=function(){var f;!Xt(n.peek())&&((f=e.base)==null?void 0:f.nodeType)===3?e.base.data=n.peek():(e.__$f|=1,e.setState({}))},we(function(){var f=i.value.value;return f===0?0:f===!0?"":f||""})},[]);return n.value}Wt.displayName="_st";Object.defineProperties(w.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:Wt},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}});V("__b",function(t,e){if(typeof e.type=="string"){var r,i=e.props;for(var n in i)if(n!=="children"){var o=i[n];o instanceof w&&(r||(e.__np=r={}),r[n]=o,i[n]=o.peek())}}t(e)});V("__r",function(t,e){tt();var r,i=e.__c;i&&(i.__$f&=-2,(r=i.__$u)===void 0&&(i.__$u=r=function(n){var o;return _t(function(){o=this}),o.c=function(){i.__$f|=1,i.setState({})},o}())),tt(r),t(e)});V("__e",function(t,e,r,i){tt(),t(e,r,i)});V("diffed",function(t,e){tt();var r;if(typeof e.type=="string"&&(r=e.__e)){var i=e.__np,n=e.props;if(i){var o=r.U;if(o)for(var f in o){var u=o[f];u!==void 0&&!(f in i)&&(u.d(),o[f]=void 0)}else r.U=o={};for(var _ in i){var y=o[_],x=i[_];y===void 0?(y=$e(r,_,x,n),o[_]=y):y.o(x,n)}}}t(e)});function $e(t,e,r,i){var n=e in t&&t.ownerSVGElement===void 0,o=H(r);return{o:function(f,u){o.value=f,i=u},d:_t(function(){var f=o.value.value;i[e]!==f&&(i[e]=f,n?t[e]=f:f?t.setAttribute(e,f):t.removeAttribute(e))})}}V("unmount",function(t,e){if(typeof e.type=="string"){var r=e.__e;if(r){var i=r.U;if(i){r.U=void 0;for(var n in i){var o=i[n];o&&o.d()}}}}else{var f=e.__c;if(f){var u=f.__$u;u&&(f.__$u=void 0,u.d())}}t(e)});V("__h",function(t,e,r,i){(i<3||i===9)&&(e.__$f|=2),t(e,r,i)});Jt.prototype.shouldComponentUpdate=function(t,e){var r=this.__$u;if(!(r&&r.s!==void 0||4&this.__$f)||3&this.__$f)return!0;for(var i in e)return!0;for(var n in t)if(n!=="__source"&&t[n]!==this.props[n])return!0;for(var o in this.props)if(!(o in t))return!0;return!1};function Oe(t){return Ct(function(){return H(t)},[])}const Se=Yt(null);class Ue{constructor(e){gt(this,"_provider");this._provider=e}render(e,r){return async i=>{var d;if(!e)throw new Error("Component is not defined");if(!i)throw new Error("Root element is not defined");i.classList.add("dropin-design");const n=await((d=e.getInitialData)==null?void 0:d.call(e,r))??{},o=H({...r}),f=H(new Set),u=this._provider,_=({next:c})=>E(Se.Provider,{value:f,children:E(dt,{node:u,...u.props,children:E(e,{...c.value,initialData:n})})}),y=i.cloneNode(!0);mt(E(_,{next:o}),y);const x={remove:()=>{mt(null,y)},setProps:c=>{const S=c(o.peek());o.value=S}};return new Promise(c=>{f.subscribe(S=>{if(S.size===0)return y.firstChild&&i.appendChild(y.firstChild),c(x)})})}}unmount(e){var r;if(!e)throw new Error("Root element is not defined");(r=e.firstChild)==null||r.remove()}async toString(e,r,i){var o;if(!e)throw new Error("Component is not defined");const n=await((o=e.getInitialData)==null?void 0:o.call(e,r))??{};return J(E(dt,{node:this._provider,...this._provider.props,children:E(e,{...r,initialData:n})}),{},{...i})}}function dt({node:t,...e}){return t?Array.isArray(t)?E(G,{children:t.map((r,i)=>E(dt,{node:r,className:e.className,...e},i))}):(e.className=Qt([t.props.className,e.className]),E(t.type,{ref:t.ref,...t.props,...e},t.key)):null}export{Ue as R,Se as S,dt as V,Ce as a,Qt as c,Ne as d,Pe as g};
12
+ `),h=h+"</"+d+">"):h=h.replace(/>$/," />"),h}var _e={shallow:!0};J.render=J;var ye=function(t,e){return J(t,e,_e)},At=[];function J(t,e,r){e=e||{};var i=b.__s;b.__s=!0;var n,o=Nt(G,null);return o.__k=[t],n=r&&(r.pretty||r.voidElements||r.sortAttributes||r.shallow||r.allAttributes||r.xml||r.attributeHook)?z(t,e,r):W(t,e,!1,void 0,o),b.__c&&b.__c(t,At),b.__s=i,At.length=0,n}function ut(t){return t==null||typeof t=="boolean"?null:typeof t=="string"||typeof t=="number"||typeof t=="bigint"?Nt(null,null,t):t}function be(t,e){return t==="className"?"class":t==="htmlFor"?"for":t==="defaultValue"?"value":t==="defaultChecked"?"checked":t==="defaultSelected"?"selected":e&&Tt.test(t)?t.toLowerCase().replace(/^xlink:?/,"xlink:"):t}function ge(t,e){return t==="style"&&e!=null&&typeof e=="object"?kt(e):t[0]==="a"&&t[1]==="r"&&typeof e=="boolean"?String(e):e}var Mt=Array.isArray,Et=Object.assign;function W(t,e,r,i,n){if(t==null||t===!0||t===!1||t==="")return"";if(typeof t!="object")return typeof t=="function"?"":K(t);if(Mt(t)){var o="";n.__k=t;for(var f=0;f<t.length;f++)o+=W(t[f],e,r,i,n),t[f]=ut(t[f]);return o}if(t.constructor!==void 0)return"";t.__=n,b.__b&&b.__b(t);var u=t.type,_=t.props;if(typeof u=="function"){var y;if(u===G)y=_.children;else{y=u.prototype&&typeof u.prototype.render=="function"?function(m,C){var a=m.type,v=R(a,C),l=new a(m.props,v);m.__c=l,l.__v=m,l.__d=!0,l.props=m.props,l.state==null&&(l.state={}),l.__s==null&&(l.__s=l.state),l.context=v,a.getDerivedStateFromProps?l.state=Et({},l.state,a.getDerivedStateFromProps(l.props,l.state)):l.componentWillMount&&(l.componentWillMount(),l.state=l.__s!==l.state?l.__s:l.state);var A=b.__r;return A&&A(m),l.render(l.props,l.state,l.context)}(t,e):function(m,C){var a,v=Dt(m,C),l=R(m.type,C);m.__c=v;for(var A=b.__r,D=0;v.__d&&D++<25;)v.__d=!1,A&&A(m),a=m.type.call(v,m.props,l);return a}(t,e);var x=t.__c;x.getChildContext&&(e=Et({},e,x.getChildContext()))}var d=W(y=y!=null&&y.type===G&&y.key==null?y.props.children:y,e,r,i,t);return b.diffed&&b.diffed(t),t.__=void 0,b.unmount&&b.unmount(t),d}var c,S,$="<";if($+=u,_)for(var g in c=_.children,_){var s=_[g];if(!(g==="key"||g==="ref"||g==="__self"||g==="__source"||g==="children"||g==="className"&&"class"in _||g==="htmlFor"&&"for"in _||Q.test(g))){if(s=ge(g=be(g,r),s),g==="dangerouslySetInnerHTML")S=s&&s.__html;else if(u==="textarea"&&g==="value")c=s;else if((s||s===0||s==="")&&typeof s!="function"){if(s===!0||s===""){s=g,$=$+" "+g;continue}if(g==="value"){if(u==="select"){i=s;continue}u!=="option"||i!=s||"selected"in _||($+=" selected")}$=$+" "+g+'="'+K(s)+'"'}}}var T=$;if($+=">",Q.test(u))throw new Error(u+" is not a valid HTML tag name in "+$);var N="",P=!1;if(S)N+=S,P=!0;else if(typeof c=="string")N+=K(c),P=!0;else if(Mt(c)){t.__k=c;for(var k=0;k<c.length;k++){var j=c[k];if(c[k]=ut(j),j!=null&&j!==!1){var O=W(j,e,u==="svg"||u!=="foreignObject"&&r,i,t);O&&(N+=O,P=!0)}}}else if(c!=null&&c!==!1&&c!==!0){t.__k=[ut(c)];var h=W(c,e,u==="svg"||u!=="foreignObject"&&r,i,t);h&&(N+=h,P=!0)}if(b.diffed&&b.diffed(t),t.__=void 0,b.unmount&&b.unmount(t),P)$+=N;else if(Ut.test(u))return T+" />";return $+"</"+u+">"}J.shallowRender=ye;var me=Symbol.for("preact-signals");function ht(){if(F>1)F--;else{for(var t,e=!1;Z!==void 0;){var r=Z;for(Z=void 0,vt++;r!==void 0;){var i=r.o;if(r.o=void 0,r.f&=-3,!(8&r.f)&&Lt(r))try{r.c()}catch(n){e||(t=n,e=!0)}r=i}}if(vt=0,F--,e)throw t}}var p=void 0,Z=void 0,F=0,vt=0,I=0;function Ft(t){if(p!==void 0){var e=t.n;if(e===void 0||e.t!==p)return e={i:0,S:t,p:p.s,n:void 0,t:p,e:void 0,x:void 0,r:e},p.s!==void 0&&(p.s.n=e),p.s=e,t.n=e,32&p.f&&t.S(e),e;if(e.i===-1)return e.i=0,e.n!==void 0&&(e.n.p=e.p,e.p!==void 0&&(e.p.n=e.n),e.p=p.s,e.n=void 0,p.s.n=e,p.s=e),e}}function w(t){this.v=t,this.i=0,this.n=void 0,this.t=void 0}w.prototype.brand=me;w.prototype.h=function(){return!0};w.prototype.S=function(t){this.t!==t&&t.e===void 0&&(t.x=this.t,this.t!==void 0&&(this.t.e=t),this.t=t)};w.prototype.U=function(t){if(this.t!==void 0){var e=t.e,r=t.x;e!==void 0&&(e.x=r,t.e=void 0),r!==void 0&&(r.e=e,t.x=void 0),t===this.t&&(this.t=r)}};w.prototype.subscribe=function(t){var e=this;return _t(function(){var r=e.value,i=p;p=void 0;try{t(r)}finally{p=i}})};w.prototype.valueOf=function(){return this.value};w.prototype.toString=function(){return this.value+""};w.prototype.toJSON=function(){return this.value};w.prototype.peek=function(){var t=p;p=void 0;try{return this.value}finally{p=t}};Object.defineProperty(w.prototype,"value",{get:function(){var t=Ft(this);return t!==void 0&&(t.i=this.i),this.v},set:function(t){if(t!==this.v){if(vt>100)throw new Error("Cycle detected");this.v=t,this.i++,I++,F++;try{for(var e=this.t;e!==void 0;e=e.x)e.t.N()}finally{ht()}}}});function H(t){return new w(t)}function Lt(t){for(var e=t.s;e!==void 0;e=e.n)if(e.S.i!==e.i||!e.S.h()||e.S.i!==e.i)return!0;return!1}function qt(t){for(var e=t.s;e!==void 0;e=e.n){var r=e.S.n;if(r!==void 0&&(e.r=r),e.S.n=e,e.i=-1,e.n===void 0){t.s=e;break}}}function Vt(t){for(var e=t.s,r=void 0;e!==void 0;){var i=e.p;e.i===-1?(e.S.U(e),i!==void 0&&(i.n=e.n),e.n!==void 0&&(e.n.p=i)):r=e,e.S.n=e.r,e.r!==void 0&&(e.r=void 0),e=i}t.s=r}function q(t){w.call(this,void 0),this.x=t,this.s=void 0,this.g=I-1,this.f=4}(q.prototype=new w).h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===I))return!0;if(this.g=I,this.f|=1,this.i>0&&!Lt(this))return this.f&=-2,!0;var t=p;try{qt(this),p=this;var e=this.x();(16&this.f||this.v!==e||this.i===0)&&(this.v=e,this.f&=-17,this.i++)}catch(r){this.v=r,this.f|=16,this.i++}return p=t,Vt(this),this.f&=-2,!0};q.prototype.S=function(t){if(this.t===void 0){this.f|=36;for(var e=this.s;e!==void 0;e=e.n)e.S.S(e)}w.prototype.S.call(this,t)};q.prototype.U=function(t){if(this.t!==void 0&&(w.prototype.U.call(this,t),this.t===void 0)){this.f&=-33;for(var e=this.s;e!==void 0;e=e.n)e.S.U(e)}};q.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var t=this.t;t!==void 0;t=t.x)t.t.N()}};Object.defineProperty(q.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var t=Ft(this);if(this.h(),t!==void 0&&(t.i=this.i),16&this.f)throw this.v;return this.v}});function we(t){return new q(t)}function zt(t){var e=t.u;if(t.u=void 0,typeof e=="function"){F++;var r=p;p=void 0;try{e()}catch(i){throw t.f&=-2,t.f|=8,pt(t),i}finally{p=r,ht()}}}function pt(t){for(var e=t.s;e!==void 0;e=e.n)e.S.U(e);t.x=void 0,t.s=void 0,zt(t)}function xe(t){if(p!==this)throw new Error("Out-of-order effect");Vt(this),p=t,this.f&=-2,8&this.f&&pt(this),ht()}function X(t){this.x=t,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32}X.prototype.c=function(){var t=this.S();try{if(8&this.f||this.x===void 0)return;var e=this.x();typeof e=="function"&&(this.u=e)}finally{t()}};X.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,zt(this),qt(this),F++;var t=p;return p=this,xe.bind(this,t)};X.prototype.N=function(){2&this.f||(this.f|=2,this.o=Z,Z=this)};X.prototype.d=function(){this.f|=8,1&this.f||pt(this)};function _t(t){var e=new X(t);try{e.c()}catch(r){throw e.d(),r}return e.d.bind(e)}var lt;function V(t,e){b[t]=e.bind(null,b[t]||function(){})}function tt(t){lt&&lt(),lt=t&&t.S()}function Wt(t){var e=this,r=t.data,i=Oe(r);i.value=r;var n=Ct(function(){for(var o=e.__v;o=o.__;)if(o.__c){o.__c.__$f|=4;break}return e.__$u.c=function(){var f;!Xt(n.peek())&&((f=e.base)==null?void 0:f.nodeType)===3?e.base.data=n.peek():(e.__$f|=1,e.setState({}))},we(function(){var f=i.value.value;return f===0?0:f===!0?"":f||""})},[]);return n.value}Wt.displayName="_st";Object.defineProperties(w.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:Wt},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}});V("__b",function(t,e){if(typeof e.type=="string"){var r,i=e.props;for(var n in i)if(n!=="children"){var o=i[n];o instanceof w&&(r||(e.__np=r={}),r[n]=o,i[n]=o.peek())}}t(e)});V("__r",function(t,e){tt();var r,i=e.__c;i&&(i.__$f&=-2,(r=i.__$u)===void 0&&(i.__$u=r=function(n){var o;return _t(function(){o=this}),o.c=function(){i.__$f|=1,i.setState({})},o}())),tt(r),t(e)});V("__e",function(t,e,r,i){tt(),t(e,r,i)});V("diffed",function(t,e){tt();var r;if(typeof e.type=="string"&&(r=e.__e)){var i=e.__np,n=e.props;if(i){var o=r.U;if(o)for(var f in o){var u=o[f];u!==void 0&&!(f in i)&&(u.d(),o[f]=void 0)}else r.U=o={};for(var _ in i){var y=o[_],x=i[_];y===void 0?(y=$e(r,_,x,n),o[_]=y):y.o(x,n)}}}t(e)});function $e(t,e,r,i){var n=e in t&&t.ownerSVGElement===void 0,o=H(r);return{o:function(f,u){o.value=f,i=u},d:_t(function(){var f=o.value.value;i[e]!==f&&(i[e]=f,n?t[e]=f:f?t.setAttribute(e,f):t.removeAttribute(e))})}}V("unmount",function(t,e){if(typeof e.type=="string"){var r=e.__e;if(r){var i=r.U;if(i){r.U=void 0;for(var n in i){var o=i[n];o&&o.d()}}}}else{var f=e.__c;if(f){var u=f.__$u;u&&(f.__$u=void 0,u.d())}}t(e)});V("__h",function(t,e,r,i){(i<3||i===9)&&(e.__$f|=2),t(e,r,i)});Jt.prototype.shouldComponentUpdate=function(t,e){var r=this.__$u;if(!(r&&r.s!==void 0||4&this.__$f)||3&this.__$f)return!0;for(var i in e)return!0;for(var n in t)if(n!=="__source"&&t[n]!==this.props[n])return!0;for(var o in this.props)if(!(o in t))return!0;return!1};function Oe(t){return Ct(function(){return H(t)},[])}const Se=Yt(null);class Ue{constructor(e){gt(this,"_provider");this._provider=e}render(e,r){return async i=>{var d;if(!e)throw new Error("Component is not defined");if(!i)throw new Error("Root element is not defined");const n=await((d=e.getInitialData)==null?void 0:d.call(e,r))??{},o=H({...r}),f=H(new Set),u=this._provider,_=({next:c})=>E(Se.Provider,{value:f,children:E(dt,{node:u,...u.props,children:E(e,{...c.value,initialData:n})})}),y=document.createElement("div");mt(E(_,{next:o}),y);const x={remove:()=>{mt(null,y)},setProps:c=>{const S=c(o.peek());o.value=S}};return new Promise(c=>{f.subscribe(S=>{if(S.size===0)return y.firstChild&&(i.classList.add("dropin-design"),i.innerHTML="",i.appendChild(y.firstChild)),c(x)})})}}unmount(e){var r;if(!e)throw new Error("Root element is not defined");(r=e.firstChild)==null||r.remove()}async toString(e,r,i){var o;if(!e)throw new Error("Component is not defined");const n=await((o=e.getInitialData)==null?void 0:o.call(e,r))??{};return J(E(dt,{node:this._provider,...this._provider.props,children:E(e,{...r,initialData:n})}),{},{...i})}}function dt({node:t,...e}){return t?Array.isArray(t)?E(G,{children:t.map((r,i)=>E(dt,{node:r,className:e.className,...e},i))}):(e.className=Qt([t.props.className,e.className]),E(t.type,{ref:t.ref,...t.props,...e},t.key)):null}export{Ue as R,Se as S,dt as V,Ce as a,Qt as c,Ne as d,Pe as g};
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name": "@dropins/tools", "version": "0.28.0-alpha2"}
1
+ {"name": "@dropins/tools", "version": "0.28.0-alpha3"}