@documenso/embed-webcomponent 0.2.3 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var T,p,ve,E,oe,ye,z,Y,J,G,S={},ge=[],Me=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Z=Array.isArray;function $(e,t){for(var _ in t)e[_]=t[_];return e}function be(e){var t=e.parentNode;t&&t.removeChild(e)}function D(e,t,_){var r,n,o,l={};for(o in t)o=="key"?r=t[o]:o=="ref"?n=t[o]:l[o]=t[o];if(arguments.length>2&&(l.children=arguments.length>3?T.call(arguments,2):_),typeof e=="function"&&e.defaultProps!=null)for(o in e.defaultProps)l[o]===void 0&&(l[o]=e.defaultProps[o]);return N(e,l,r,n,null)}function N(e,t,_,r,n){var o={type:e,props:t,key:_,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:n??++ve,__i:-1,__u:0};return n==null&&p.vnode!=null&&p.vnode(o),o}function W(e){return e.children}function A(e,t){this.props=e,this.context=t}function x(e,t){if(t==null)return e.__?x(e.__,e.__i+1):null;for(var _;t<e.__k.length;t++)if((_=e.__k[t])!=null&&_.__e!=null)return _.__e;return typeof e.type=="function"?x(e):null}function ke(e){var t,_;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((_=e.__k[t])!=null&&_.__e!=null){e.__e=e.__c.base=_.__e;break}return ke(e)}}function re(e){(!e.__d&&(e.__d=!0)&&E.push(e)&&!O.__r++||oe!==p.debounceRendering)&&((oe=p.debounceRendering)||ye)(O)}function O(){var e,t,_,r,n,o,l,c;for(E.sort(z);e=E.shift();)e.__d&&(t=E.length,r=void 0,o=(n=(_=e).__v).__e,l=[],c=[],_.__P&&((r=$({},n)).__v=n.__v+1,p.vnode&&p.vnode(r),ee(_.__P,r,n,_.__n,_.__P.namespaceURI,32&n.__u?[o]:null,l,o??x(n),!!(32&n.__u),c),r.__v=n.__v,r.__.__k[r.__i]=r,Ce(l,r,c),r.__e!=o&&ke(r)),E.length>t&&E.sort(z));O.__r=0}function we(e,t,_,r,n,o,l,c,a,s,f){var i,g,u,v,k,y=r&&r.__k||ge,d=t.length;for(_.__d=a,Ue(_,t,y),a=_.__d,i=0;i<d;i++)(u=_.__k[i])!=null&&typeof u!="boolean"&&typeof u!="function"&&(g=u.__i===-1?S:y[u.__i]||S,u.__i=i,ee(e,u,g,n,o,l,c,a,s,f),v=u.__e,u.ref&&g.ref!=u.ref&&(g.ref&&te(g.ref,null,u),f.push(u.ref,u.__c||v,u)),k==null&&v!=null&&(k=v),65536&u.__u||g.__k===u.__k?a=$e(u,a,e):typeof u.type=="function"&&u.__d!==void 0?a=u.__d:v&&(a=v.nextSibling),u.__d=void 0,u.__u&=-196609);_.__d=a,_.__e=k}function Ue(e,t,_){var r,n,o,l,c,a=t.length,s=_.length,f=s,i=0;for(e.__k=[],r=0;r<a;r++)l=r+i,(n=e.__k[r]=(n=t[r])==null||typeof n=="boolean"||typeof n=="function"?null:typeof n=="string"||typeof n=="number"||typeof n=="bigint"||n.constructor==String?N(null,n,null,null,null):Z(n)?N(W,{children:n},null,null,null):n.constructor===void 0&&n.__b>0?N(n.type,n.props,n.key,n.ref?n.ref:null,n.__v):n)!=null?(n.__=e,n.__b=e.__b+1,c=Re(n,_,l,f),n.__i=c,o=null,c!==-1&&(f--,(o=_[c])&&(o.__u|=131072)),o==null||o.__v===null?(c==-1&&i--,typeof n.type!="function"&&(n.__u|=65536)):c!==l&&(c==l-1?i--:c==l+1?i++:c>l?f>a-l?i+=c-l:i--:c<l&&(c==l-i?i-=c-l:i++),c!==r+i&&(n.__u|=65536))):(o=_[l])&&o.key==null&&o.__e&&!(131072&o.__u)&&(o.__e==e.__d&&(e.__d=x(o)),K(o,o,!1),_[l]=null,f--);if(f)for(r=0;r<s;r++)(o=_[r])!=null&&!(131072&o.__u)&&(o.__e==e.__d&&(e.__d=x(o)),K(o,o))}function $e(e,t,_){var r,n;if(typeof e.type=="function"){for(r=e.__k,n=0;r&&n<r.length;n++)r[n]&&(r[n].__=e,t=$e(r[n],t,_));return t}e.__e!=t&&(t&&e.type&&!_.contains(t)&&(t=x(e)),_.insertBefore(e.__e,t||null),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType===8);return t}function Re(e,t,_,r){var n=e.key,o=e.type,l=_-1,c=_+1,a=t[_];if(a===null||a&&n==a.key&&o===a.type&&!(131072&a.__u))return _;if(r>(a!=null&&!(131072&a.__u)?1:0))for(;l>=0||c<t.length;){if(l>=0){if((a=t[l])&&!(131072&a.__u)&&n==a.key&&o===a.type)return l;l--}if(c<t.length){if((a=t[c])&&!(131072&a.__u)&&n==a.key&&o===a.type)return c;c++}}return-1}function ie(e,t,_){t[0]==="-"?e.setProperty(t,_??""):e[t]=_==null?"":typeof _!="number"||Me.test(t)?_:_+"px"}function R(e,t,_,r,n){var o;e:if(t==="style")if(typeof _=="string")e.style.cssText=_;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(t in r)_&&t in _||ie(e.style,t,"");if(_)for(t in _)r&&_[t]===r[t]||ie(e.style,t,_[t])}else if(t[0]==="o"&&t[1]==="n")o=t!==(t=t.replace(/(PointerCapture)$|Capture$/i,"$1")),t=t.toLowerCase()in e||t==="onFocusOut"||t==="onFocusIn"?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=_,_?r?_.u=r.u:(_.u=Y,e.addEventListener(t,o?G:J,o)):e.removeEventListener(t,o?G:J,o);else{if(n=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=_??"";break e}catch{}typeof _=="function"||(_==null||_===!1&&t[4]!=="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&_==1?"":_))}}function le(e){return function(t){if(this.l){var _=this.l[t.type+e];if(t.t==null)t.t=Y++;else if(t.t<_.u)return;return _(p.event?p.event(t):t)}}}function ee(e,t,_,r,n,o,l,c,a,s){var f,i,g,u,v,k,y,d,h,P,C,L,H,ne,M,q,w=t.type;if(t.constructor!==void 0)return null;128&_.__u&&(a=!!(32&_.__u),o=[c=t.__e=_.__e]),(f=p.__b)&&f(t);e:if(typeof w=="function")try{if(d=t.props,h="prototype"in w&&w.prototype.render,P=(f=w.contextType)&&r[f.__c],C=f?P?P.props.value:f.__:r,_.__c?y=(i=t.__c=_.__c).__=i.__E:(h?t.__c=i=new w(d,C):(t.__c=i=new A(d,C),i.constructor=w,i.render=Fe),P&&P.sub(i),i.props=d,i.state||(i.state={}),i.context=C,i.__n=r,g=i.__d=!0,i.__h=[],i._sb=[]),h&&i.__s==null&&(i.__s=i.state),h&&w.getDerivedStateFromProps!=null&&(i.__s==i.state&&(i.__s=$({},i.__s)),$(i.__s,w.getDerivedStateFromProps(d,i.__s))),u=i.props,v=i.state,i.__v=t,g)h&&w.getDerivedStateFromProps==null&&i.componentWillMount!=null&&i.componentWillMount(),h&&i.componentDidMount!=null&&i.__h.push(i.componentDidMount);else{if(h&&w.getDerivedStateFromProps==null&&d!==u&&i.componentWillReceiveProps!=null&&i.componentWillReceiveProps(d,C),!i.__e&&(i.shouldComponentUpdate!=null&&i.shouldComponentUpdate(d,i.__s,C)===!1||t.__v===_.__v)){for(t.__v!==_.__v&&(i.props=d,i.state=i.__s,i.__d=!1),t.__e=_.__e,t.__k=_.__k,t.__k.forEach(function(U){U&&(U.__=t)}),L=0;L<i._sb.length;L++)i.__h.push(i._sb[L]);i._sb=[],i.__h.length&&l.push(i);break e}i.componentWillUpdate!=null&&i.componentWillUpdate(d,i.__s,C),h&&i.componentDidUpdate!=null&&i.__h.push(function(){i.componentDidUpdate(u,v,k)})}if(i.context=C,i.props=d,i.__P=e,i.__e=!1,H=p.__r,ne=0,h){for(i.state=i.__s,i.__d=!1,H&&H(t),f=i.render(i.props,i.state,i.context),M=0;M<i._sb.length;M++)i.__h.push(i._sb[M]);i._sb=[]}else do i.__d=!1,H&&H(t),f=i.render(i.props,i.state,i.context),i.state=i.__s;while(i.__d&&++ne<25);i.state=i.__s,i.getChildContext!=null&&(r=$($({},r),i.getChildContext())),h&&!g&&i.getSnapshotBeforeUpdate!=null&&(k=i.getSnapshotBeforeUpdate(u,v)),we(e,Z(q=f!=null&&f.type===W&&f.key==null?f.props.children:f)?q:[q],t,_,r,n,o,l,c,a,s),i.base=t.__e,t.__u&=-161,i.__h.length&&l.push(i),y&&(i.__E=i.__=null)}catch(U){if(t.__v=null,a||o!=null){for(t.__u|=a?160:32;c&&c.nodeType===8&&c.nextSibling;)c=c.nextSibling;o[o.indexOf(c)]=null,t.__e=c}else t.__e=_.__e,t.__k=_.__k;p.__e(U,t,_)}else o==null&&t.__v===_.__v?(t.__k=_.__k,t.__e=_.__e):t.__e=Ae(_.__e,t,_,r,n,o,l,a,s);(f=p.diffed)&&f(t)}function Ce(e,t,_){t.__d=void 0;for(var r=0;r<_.length;r++)te(_[r],_[++r],_[++r]);p.__c&&p.__c(t,e),e.some(function(n){try{e=n.__h,n.__h=[],e.some(function(o){o.call(n)})}catch(o){p.__e(o,n.__v)}})}function Ae(e,t,_,r,n,o,l,c,a){var s,f,i,g,u,v,k,y=_.props,d=t.props,h=t.type;if(h==="svg"?n="http://www.w3.org/2000/svg":h==="math"?n="http://www.w3.org/1998/Math/MathML":n||(n="http://www.w3.org/1999/xhtml"),o!=null){for(s=0;s<o.length;s++)if((u=o[s])&&"setAttribute"in u==!!h&&(h?u.localName===h:u.nodeType===3)){e=u,o[s]=null;break}}if(e==null){if(h===null)return document.createTextNode(d);e=document.createElementNS(n,h,d.is&&d),o=null,c=!1}if(h===null)y===d||c&&e.data===d||(e.data=d);else{if(o=o&&T.call(e.childNodes),y=_.props||S,!c&&o!=null)for(y={},s=0;s<e.attributes.length;s++)y[(u=e.attributes[s]).name]=u.value;for(s in y)if(u=y[s],s!="children"){if(s=="dangerouslySetInnerHTML")i=u;else if(s!=="key"&&!(s in d)){if(s=="value"&&"defaultValue"in d||s=="checked"&&"defaultChecked"in d)continue;R(e,s,null,u,n)}}for(s in d)u=d[s],s=="children"?g=u:s=="dangerouslySetInnerHTML"?f=u:s=="value"?v=u:s=="checked"?k=u:s==="key"||c&&typeof u!="function"||y[s]===u||R(e,s,u,y[s],n);if(f)c||i&&(f.__html===i.__html||f.__html===e.innerHTML)||(e.innerHTML=f.__html),t.__k=[];else if(i&&(e.innerHTML=""),we(e,Z(g)?g:[g],t,_,r,h==="foreignObject"?"http://www.w3.org/1999/xhtml":n,o,l,o?o[0]:_.__k&&x(_,0),c,a),o!=null)for(s=o.length;s--;)o[s]!=null&&be(o[s]);c||(s="value",v!==void 0&&(v!==e[s]||h==="progress"&&!v||h==="option"&&v!==y[s])&&R(e,s,v,y[s],n),s="checked",k!==void 0&&k!==e[s]&&R(e,s,k,y[s],n))}return e}function te(e,t,_){try{if(typeof e=="function"){var r=typeof e.__u=="function";r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(n){p.__e(n,_)}}function K(e,t,_){var r,n;if(p.unmount&&p.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||te(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(o){p.__e(o,t)}r.base=r.__P=null}if(r=e.__k)for(n=0;n<r.length;n++)r[n]&&K(r[n],t,_||typeof e.type!="function");_||e.__e==null||be(e.__e),e.__c=e.__=e.__e=e.__d=void 0}function Fe(e,t,_){return this.constructor(e,_)}function V(e,t,_){var r,n,o,l;p.__&&p.__(e,t),n=(r=typeof _=="function")?null:_&&_.__k||t.__k,o=[],l=[],ee(t,e=(!r&&_||t).__k=D(W,null,[e]),n||S,S,t.namespaceURI,!r&&_?[_]:n?null:t.firstChild?T.call(t.childNodes):null,o,!r&&_?_:n?n.__e:t.firstChild,r,l),Ce(o,e,l)}function Ee(e,t){V(e,t,Ee)}function xe(e,t,_){var r,n,o,l,c=$({},e.props);for(o in e.type&&e.type.defaultProps&&(l=e.type.defaultProps),t)o=="key"?r=t[o]:o=="ref"?n=t[o]:c[o]=t[o]===void 0&&l!==void 0?l[o]:t[o];return arguments.length>2&&(c.children=arguments.length>3?T.call(arguments,2):_),N(e.type,c,r||e.key,n||e.ref,null)}T=ge.slice,p={__e:function(e,t,_,r){for(var n,o,l;t=t.__;)if((n=t.__c)&&!n.__)try{if((o=n.constructor)&&o.getDerivedStateFromError!=null&&(n.setState(o.getDerivedStateFromError(e)),l=n.__d),n.componentDidCatch!=null&&(n.componentDidCatch(e,r||{}),l=n.__d),l)return n.__E=n}catch(c){e=c}throw e}},ve=0,A.prototype.setState=function(e,t){var _;_=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=$({},this.state),typeof e=="function"&&(e=e($({},_),this.props)),e&&$(_,e),e!=null&&this.__v&&(t&&this._sb.push(t),re(this))},A.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),re(this))},A.prototype.render=W,E=[],ye=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,z=function(e,t){return e.__v.__b-t.__v.__b},O.__r=0,Y=0,J=le(!1),G=le(!0);function _e(){return(_e=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var _=arguments[t];for(var r in _)Object.prototype.hasOwnProperty.call(_,r)&&(e[r]=_[r])}return e}).apply(this,arguments)}var Oe=["context","children"];function je(e){this.getChildContext=function(){return e.context};var t=e.children,_=function(r,n){if(r==null)return{};var o,l,c={},a=Object.keys(r);for(l=0;l<a.length;l++)n.indexOf(o=a[l])>=0||(c[o]=r[o]);return c}(e,Oe);return xe(t,_)}function Ie(){var e=new CustomEvent("_preact",{detail:{},bubbles:!0,cancelable:!0});this.dispatchEvent(e),this._vdom=D(je,_e({},this._props,{context:e.detail.context}),function t(_,r){if(_.nodeType===3)return _.data;if(_.nodeType!==1)return null;var n=[],o={},l=0,c=_.attributes,a=_.childNodes;for(l=c.length;l--;)c[l].name!=="slot"&&(o[c[l].name]=c[l].value,o[De(c[l].name)]=c[l].value);for(l=a.length;l--;){var s=t(a[l],null),f=a[l].slot;f?o[f]=D(ce,{name:f},s):n[l]=s}var i=r?D(ce,null,n):n;return D(r||_.nodeName.toLowerCase(),o,i)}(this,this._vdomComponent)),(this.hasAttribute("hydrate")?Ee:V)(this._vdom,this._root)}function De(e){return e.replace(/-(\w)/g,function(t,_){return _?_.toUpperCase():""})}function We(e,t,_){if(this._vdom){var r={};r[e]=_=_??void 0,r[De(e)]=_,this._vdom=xe(this._vdom,r),V(this._vdom,this._root)}}function Ve(){V(this._vdom=null,this._root)}function ce(e,t){var _=this;return D("slot",_e({},e,{ref:function(r){r?(_.ref=r,_._listener||(_._listener=function(n){n.stopPropagation(),n.detail.context=t},r.addEventListener("_preact",_._listener))):_.ref.removeEventListener("_preact",_._listener)}}))}function Pe(e,t,_,r){function n(){var o=Reflect.construct(HTMLElement,[],n);return o._vdomComponent=e,o._root=o,o}return(n.prototype=Object.create(HTMLElement.prototype)).constructor=n,n.prototype.connectedCallback=Ie,n.prototype.attributeChangedCallback=We,n.prototype.disconnectedCallback=Ve,_=_||e.observedAttributes||Object.keys(e.propTypes||{}),n.observedAttributes=_,_.forEach(function(o){Object.defineProperty(n.prototype,o,{get:function(){return this._vdom.props[o]},set:function(l){this._vdom?this.attributeChangedCallback(o,null,l):(this._props||(this._props={}),this._props[o]=l,this.connectedCallback());var c=typeof l;l!=null&&c!=="string"&&c!=="boolean"&&c!=="number"||this.setAttribute(o,l)}})}),customElements.define(t||e.tagName||e.displayName||e.name,n)}var j,b,B,se,Q=0,He=[],m=p,ae=m.__b,ue=m.__r,fe=m.diffed,de=m.__c,pe=m.unmount,he=m.__;function Ne(e,t){m.__h&&m.__h(b,e,Q||t),Q=0;var _=b.__H||(b.__H={__:[],__h:[]});return e>=_.__.length&&_.__.push({}),_.__[e]}function I(e,t){var _=Ne(j++,3);!m.__s&&Te(_.__H,t)&&(_.__=e,_.i=t,b.__H.__h.push(_))}function Se(e){return Q=5,qe(function(){return{current:e}},[])}function qe(e,t){var _=Ne(j++,7);return Te(_.__H,t)&&(_.__=e(),_.__H=t,_.__h=e),_.__}function Be(){for(var e;e=He.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(F),e.__H.__h.forEach(X),e.__H.__h=[]}catch(t){e.__H.__h=[],m.__e(t,e.__v)}}m.__b=function(e){b=null,ae&&ae(e)},m.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),he&&he(e,t)},m.__r=function(e){ue&&ue(e),j=0;var t=(b=e.__c).__H;t&&(B===b?(t.__h=[],b.__h=[],t.__.forEach(function(_){_.__N&&(_.__=_.__N),_.i=_.__N=void 0})):(t.__h.forEach(F),t.__h.forEach(X),t.__h=[],j=0)),B=b},m.diffed=function(e){fe&&fe(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(He.push(t)!==1&&se===m.requestAnimationFrame||((se=m.requestAnimationFrame)||ze)(Be)),t.__H.__.forEach(function(_){_.i&&(_.__H=_.i),_.i=void 0})),B=b=null},m.__c=function(e,t){t.some(function(_){try{_.__h.forEach(F),_.__h=_.__h.filter(function(r){return!r.__||X(r)})}catch(r){t.some(function(n){n.__h&&(n.__h=[])}),t=[],m.__e(r,_.__v)}}),de&&de(e,t)},m.unmount=function(e){pe&&pe(e);var t,_=e.__c;_&&_.__H&&(_.__H.__.forEach(function(r){try{F(r)}catch(n){t=n}}),_.__H=void 0,t&&m.__e(t,_.__v))};var me=typeof requestAnimationFrame=="function";function ze(e){var t,_=function(){clearTimeout(r),me&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(_,100);me&&(t=requestAnimationFrame(_))}function F(e){var t=b,_=e.__c;typeof _=="function"&&(e.__c=void 0,_()),b=t}function X(e){var t=b;e.__c=e.__(),b=t}function Te(e,t){return!e||e.length!==t.length||t.some(function(_,r){return _!==e[r]})}var Je=0;function Le(e,t,_,r,n,o){t||(t={});var l,c,a=t;if("ref"in a)for(c in a={},t)c=="ref"?l=t[c]:a[c]=t[c];var s={type:e,props:a,key:_,ref:l,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--Je,__i:-1,__u:0,__source:n,__self:o};return p.vnode&&p.vnode(s),s}function Ge(e){const t=Se(null);function _(){const n=e.host||"https://app.documenso.com",o=btoa(encodeURIComponent(JSON.stringify({name:e.name,lockName:e.lockName,email:e.email,lockEmail:e.lockEmail,css:e.css,cssVars:e.cssVars,darkModeDisabled:e.darkModeDisabled,...e.additionalProps}))),l=new URL(`/embed/direct/${e.token}`,n);return e.externalId&&l.searchParams.set("externalId",e.externalId),`${l}#${o}`}function r(n){var o,l,c,a,s,f;if(((o=t.current)==null?void 0:o.contentWindow)===n.source)switch(n.data.action){case"document-ready":(l=e.onDocumentReady)==null||l.call(e);break;case"document-completed":(c=e.onDocumentCompleted)==null||c.call(e,n.data.data);break;case"document-error":(a=e.onDocumentError)==null||a.call(e,n.data.data);break;case"field-signed":(s=e.onFieldSigned)==null||s.call(e);break;case"field-unsigned":(f=e.onFieldUnsigned)==null||f.call(e);break}}return I(()=>{window.addEventListener("message",r)},[]),I(()=>()=>{window.removeEventListener("message",r)},[]),Le("iframe",{ref:t,className:e.className,src:_()})}function Ke(e){const t=Se(null);function _(){const n=e.host||"https://app.documenso.com",o=btoa(encodeURIComponent(JSON.stringify({name:e.name,lockName:e.lockName,css:e.css,cssVars:e.cssVars,darkModeDisabled:e.darkModeDisabled,allowDocumentRejection:e.allowDocumentRejection,...e.additionalProps})));return`${new URL(`/embed/sign/${e.token}`,n)}#${o}`}function r(n){var o,l,c,a,s;if(((o=t.current)==null?void 0:o.contentWindow)===n.source)switch(n.data.action){case"document-ready":(l=e.onDocumentReady)==null||l.call(e);break;case"document-completed":(c=e.onDocumentCompleted)==null||c.call(e,n.data.data);break;case"document-error":(a=e.onDocumentError)==null||a.call(e,n.data.data);break;case"document-rejected":(s=e.onDocumentRejected)==null||s.call(e,n.data.data);break}}return I(()=>{window.addEventListener("message",r)},[]),I(()=>()=>{window.removeEventListener("message",r)},[]),Le("iframe",{ref:t,className:e.className,src:_()})}Pe(Ge,"documenso-embed-direct-template",["token","host","externalId","css","email","lockEmail","name","lockName","onDocumentReady","onDocumentCompleted","onDocumentError"]);Pe(Ke,"documenso-embed-sign-document",["token","host","css","name","lockName","onDocumentReady","onDocumentCompleted","onDocumentError"]);
1
+ "use strict";var T,p,ve,E,oe,ye,z,Y,J,G,S={},ge=[],Me=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Z=Array.isArray;function $(e,t){for(var _ in t)e[_]=t[_];return e}function be(e){var t=e.parentNode;t&&t.removeChild(e)}function D(e,t,_){var o,n,r,s={};for(r in t)r=="key"?o=t[r]:r=="ref"?n=t[r]:s[r]=t[r];if(arguments.length>2&&(s.children=arguments.length>3?T.call(arguments,2):_),typeof e=="function"&&e.defaultProps!=null)for(r in e.defaultProps)s[r]===void 0&&(s[r]=e.defaultProps[r]);return N(e,s,o,n,null)}function N(e,t,_,o,n){var r={type:e,props:t,key:_,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:n??++ve,__i:-1,__u:0};return n==null&&p.vnode!=null&&p.vnode(r),r}function W(e){return e.children}function A(e,t){this.props=e,this.context=t}function x(e,t){if(t==null)return e.__?x(e.__,e.__i+1):null;for(var _;t<e.__k.length;t++)if((_=e.__k[t])!=null&&_.__e!=null)return _.__e;return typeof e.type=="function"?x(e):null}function ke(e){var t,_;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((_=e.__k[t])!=null&&_.__e!=null){e.__e=e.__c.base=_.__e;break}return ke(e)}}function re(e){(!e.__d&&(e.__d=!0)&&E.push(e)&&!O.__r++||oe!==p.debounceRendering)&&((oe=p.debounceRendering)||ye)(O)}function O(){var e,t,_,o,n,r,s,c;for(E.sort(z);e=E.shift();)e.__d&&(t=E.length,o=void 0,r=(n=(_=e).__v).__e,s=[],c=[],_.__P&&((o=$({},n)).__v=n.__v+1,p.vnode&&p.vnode(o),ee(_.__P,o,n,_.__n,_.__P.namespaceURI,32&n.__u?[r]:null,s,r??x(n),!!(32&n.__u),c),o.__v=n.__v,o.__.__k[o.__i]=o,Ce(s,o,c),o.__e!=r&&ke(o)),E.length>t&&E.sort(z));O.__r=0}function we(e,t,_,o,n,r,s,c,l,a,f){var i,g,u,v,k,y=o&&o.__k||ge,d=t.length;for(_.__d=l,Ue(_,t,y),l=_.__d,i=0;i<d;i++)(u=_.__k[i])!=null&&typeof u!="boolean"&&typeof u!="function"&&(g=u.__i===-1?S:y[u.__i]||S,u.__i=i,ee(e,u,g,n,r,s,c,l,a,f),v=u.__e,u.ref&&g.ref!=u.ref&&(g.ref&&te(g.ref,null,u),f.push(u.ref,u.__c||v,u)),k==null&&v!=null&&(k=v),65536&u.__u||g.__k===u.__k?l=$e(u,l,e):typeof u.type=="function"&&u.__d!==void 0?l=u.__d:v&&(l=v.nextSibling),u.__d=void 0,u.__u&=-196609);_.__d=l,_.__e=k}function Ue(e,t,_){var o,n,r,s,c,l=t.length,a=_.length,f=a,i=0;for(e.__k=[],o=0;o<l;o++)s=o+i,(n=e.__k[o]=(n=t[o])==null||typeof n=="boolean"||typeof n=="function"?null:typeof n=="string"||typeof n=="number"||typeof n=="bigint"||n.constructor==String?N(null,n,null,null,null):Z(n)?N(W,{children:n},null,null,null):n.constructor===void 0&&n.__b>0?N(n.type,n.props,n.key,n.ref?n.ref:null,n.__v):n)!=null?(n.__=e,n.__b=e.__b+1,c=Re(n,_,s,f),n.__i=c,r=null,c!==-1&&(f--,(r=_[c])&&(r.__u|=131072)),r==null||r.__v===null?(c==-1&&i--,typeof n.type!="function"&&(n.__u|=65536)):c!==s&&(c==s-1?i--:c==s+1?i++:c>s?f>l-s?i+=c-s:i--:c<s&&(c==s-i?i-=c-s:i++),c!==o+i&&(n.__u|=65536))):(r=_[s])&&r.key==null&&r.__e&&(131072&r.__u)==0&&(r.__e==e.__d&&(e.__d=x(r)),K(r,r,!1),_[s]=null,f--);if(f)for(o=0;o<a;o++)(r=_[o])!=null&&(131072&r.__u)==0&&(r.__e==e.__d&&(e.__d=x(r)),K(r,r))}function $e(e,t,_){var o,n;if(typeof e.type=="function"){for(o=e.__k,n=0;o&&n<o.length;n++)o[n]&&(o[n].__=e,t=$e(o[n],t,_));return t}e.__e!=t&&(t&&e.type&&!_.contains(t)&&(t=x(e)),_.insertBefore(e.__e,t||null),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType===8);return t}function Re(e,t,_,o){var n=e.key,r=e.type,s=_-1,c=_+1,l=t[_];if(l===null||l&&n==l.key&&r===l.type&&(131072&l.__u)==0)return _;if(o>(l!=null&&(131072&l.__u)==0?1:0))for(;s>=0||c<t.length;){if(s>=0){if((l=t[s])&&(131072&l.__u)==0&&n==l.key&&r===l.type)return s;s--}if(c<t.length){if((l=t[c])&&(131072&l.__u)==0&&n==l.key&&r===l.type)return c;c++}}return-1}function ie(e,t,_){t[0]==="-"?e.setProperty(t,_??""):e[t]=_==null?"":typeof _!="number"||Me.test(t)?_:_+"px"}function R(e,t,_,o,n){var r;e:if(t==="style")if(typeof _=="string")e.style.cssText=_;else{if(typeof o=="string"&&(e.style.cssText=o=""),o)for(t in o)_&&t in _||ie(e.style,t,"");if(_)for(t in _)o&&_[t]===o[t]||ie(e.style,t,_[t])}else if(t[0]==="o"&&t[1]==="n")r=t!==(t=t.replace(/(PointerCapture)$|Capture$/i,"$1")),t=t.toLowerCase()in e||t==="onFocusOut"||t==="onFocusIn"?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+r]=_,_?o?_.u=o.u:(_.u=Y,e.addEventListener(t,r?G:J,r)):e.removeEventListener(t,r?G:J,r);else{if(n=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=_??"";break e}catch{}typeof _=="function"||(_==null||_===!1&&t[4]!=="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&_==1?"":_))}}function se(e){return function(t){if(this.l){var _=this.l[t.type+e];if(t.t==null)t.t=Y++;else if(t.t<_.u)return;return _(p.event?p.event(t):t)}}}function ee(e,t,_,o,n,r,s,c,l,a){var f,i,g,u,v,k,y,d,h,P,C,L,H,ne,M,q,w=t.type;if(t.constructor!==void 0)return null;128&_.__u&&(l=!!(32&_.__u),r=[c=t.__e=_.__e]),(f=p.__b)&&f(t);e:if(typeof w=="function")try{if(d=t.props,h="prototype"in w&&w.prototype.render,P=(f=w.contextType)&&o[f.__c],C=f?P?P.props.value:f.__:o,_.__c?y=(i=t.__c=_.__c).__=i.__E:(h?t.__c=i=new w(d,C):(t.__c=i=new A(d,C),i.constructor=w,i.render=Fe),P&&P.sub(i),i.props=d,i.state||(i.state={}),i.context=C,i.__n=o,g=i.__d=!0,i.__h=[],i._sb=[]),h&&i.__s==null&&(i.__s=i.state),h&&w.getDerivedStateFromProps!=null&&(i.__s==i.state&&(i.__s=$({},i.__s)),$(i.__s,w.getDerivedStateFromProps(d,i.__s))),u=i.props,v=i.state,i.__v=t,g)h&&w.getDerivedStateFromProps==null&&i.componentWillMount!=null&&i.componentWillMount(),h&&i.componentDidMount!=null&&i.__h.push(i.componentDidMount);else{if(h&&w.getDerivedStateFromProps==null&&d!==u&&i.componentWillReceiveProps!=null&&i.componentWillReceiveProps(d,C),!i.__e&&(i.shouldComponentUpdate!=null&&i.shouldComponentUpdate(d,i.__s,C)===!1||t.__v===_.__v)){for(t.__v!==_.__v&&(i.props=d,i.state=i.__s,i.__d=!1),t.__e=_.__e,t.__k=_.__k,t.__k.forEach(function(U){U&&(U.__=t)}),L=0;L<i._sb.length;L++)i.__h.push(i._sb[L]);i._sb=[],i.__h.length&&s.push(i);break e}i.componentWillUpdate!=null&&i.componentWillUpdate(d,i.__s,C),h&&i.componentDidUpdate!=null&&i.__h.push(function(){i.componentDidUpdate(u,v,k)})}if(i.context=C,i.props=d,i.__P=e,i.__e=!1,H=p.__r,ne=0,h){for(i.state=i.__s,i.__d=!1,H&&H(t),f=i.render(i.props,i.state,i.context),M=0;M<i._sb.length;M++)i.__h.push(i._sb[M]);i._sb=[]}else do i.__d=!1,H&&H(t),f=i.render(i.props,i.state,i.context),i.state=i.__s;while(i.__d&&++ne<25);i.state=i.__s,i.getChildContext!=null&&(o=$($({},o),i.getChildContext())),h&&!g&&i.getSnapshotBeforeUpdate!=null&&(k=i.getSnapshotBeforeUpdate(u,v)),we(e,Z(q=f!=null&&f.type===W&&f.key==null?f.props.children:f)?q:[q],t,_,o,n,r,s,c,l,a),i.base=t.__e,t.__u&=-161,i.__h.length&&s.push(i),y&&(i.__E=i.__=null)}catch(U){if(t.__v=null,l||r!=null){for(t.__u|=l?160:32;c&&c.nodeType===8&&c.nextSibling;)c=c.nextSibling;r[r.indexOf(c)]=null,t.__e=c}else t.__e=_.__e,t.__k=_.__k;p.__e(U,t,_)}else r==null&&t.__v===_.__v?(t.__k=_.__k,t.__e=_.__e):t.__e=Ae(_.__e,t,_,o,n,r,s,l,a);(f=p.diffed)&&f(t)}function Ce(e,t,_){t.__d=void 0;for(var o=0;o<_.length;o++)te(_[o],_[++o],_[++o]);p.__c&&p.__c(t,e),e.some(function(n){try{e=n.__h,n.__h=[],e.some(function(r){r.call(n)})}catch(r){p.__e(r,n.__v)}})}function Ae(e,t,_,o,n,r,s,c,l){var a,f,i,g,u,v,k,y=_.props,d=t.props,h=t.type;if(h==="svg"?n="http://www.w3.org/2000/svg":h==="math"?n="http://www.w3.org/1998/Math/MathML":n||(n="http://www.w3.org/1999/xhtml"),r!=null){for(a=0;a<r.length;a++)if((u=r[a])&&"setAttribute"in u==!!h&&(h?u.localName===h:u.nodeType===3)){e=u,r[a]=null;break}}if(e==null){if(h===null)return document.createTextNode(d);e=document.createElementNS(n,h,d.is&&d),r=null,c=!1}if(h===null)y===d||c&&e.data===d||(e.data=d);else{if(r=r&&T.call(e.childNodes),y=_.props||S,!c&&r!=null)for(y={},a=0;a<e.attributes.length;a++)y[(u=e.attributes[a]).name]=u.value;for(a in y)if(u=y[a],a!="children"){if(a=="dangerouslySetInnerHTML")i=u;else if(a!=="key"&&!(a in d)){if(a=="value"&&"defaultValue"in d||a=="checked"&&"defaultChecked"in d)continue;R(e,a,null,u,n)}}for(a in d)u=d[a],a=="children"?g=u:a=="dangerouslySetInnerHTML"?f=u:a=="value"?v=u:a=="checked"?k=u:a==="key"||c&&typeof u!="function"||y[a]===u||R(e,a,u,y[a],n);if(f)c||i&&(f.__html===i.__html||f.__html===e.innerHTML)||(e.innerHTML=f.__html),t.__k=[];else if(i&&(e.innerHTML=""),we(e,Z(g)?g:[g],t,_,o,h==="foreignObject"?"http://www.w3.org/1999/xhtml":n,r,s,r?r[0]:_.__k&&x(_,0),c,l),r!=null)for(a=r.length;a--;)r[a]!=null&&be(r[a]);c||(a="value",v!==void 0&&(v!==e[a]||h==="progress"&&!v||h==="option"&&v!==y[a])&&R(e,a,v,y[a],n),a="checked",k!==void 0&&k!==e[a]&&R(e,a,k,y[a],n))}return e}function te(e,t,_){try{if(typeof e=="function"){var o=typeof e.__u=="function";o&&e.__u(),o&&t==null||(e.__u=e(t))}else e.current=t}catch(n){p.__e(n,_)}}function K(e,t,_){var o,n;if(p.unmount&&p.unmount(e),(o=e.ref)&&(o.current&&o.current!==e.__e||te(o,null,t)),(o=e.__c)!=null){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(r){p.__e(r,t)}o.base=o.__P=null}if(o=e.__k)for(n=0;n<o.length;n++)o[n]&&K(o[n],t,_||typeof e.type!="function");_||e.__e==null||be(e.__e),e.__c=e.__=e.__e=e.__d=void 0}function Fe(e,t,_){return this.constructor(e,_)}function V(e,t,_){var o,n,r,s;p.__&&p.__(e,t),n=(o=typeof _=="function")?null:_&&_.__k||t.__k,r=[],s=[],ee(t,e=(!o&&_||t).__k=D(W,null,[e]),n||S,S,t.namespaceURI,!o&&_?[_]:n?null:t.firstChild?T.call(t.childNodes):null,r,!o&&_?_:n?n.__e:t.firstChild,o,s),Ce(r,e,s)}function Ee(e,t){V(e,t,Ee)}function xe(e,t,_){var o,n,r,s,c=$({},e.props);for(r in e.type&&e.type.defaultProps&&(s=e.type.defaultProps),t)r=="key"?o=t[r]:r=="ref"?n=t[r]:c[r]=t[r]===void 0&&s!==void 0?s[r]:t[r];return arguments.length>2&&(c.children=arguments.length>3?T.call(arguments,2):_),N(e.type,c,o||e.key,n||e.ref,null)}T=ge.slice,p={__e:function(e,t,_,o){for(var n,r,s;t=t.__;)if((n=t.__c)&&!n.__)try{if((r=n.constructor)&&r.getDerivedStateFromError!=null&&(n.setState(r.getDerivedStateFromError(e)),s=n.__d),n.componentDidCatch!=null&&(n.componentDidCatch(e,o||{}),s=n.__d),s)return n.__E=n}catch(c){e=c}throw e}},ve=0,A.prototype.setState=function(e,t){var _;_=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=$({},this.state),typeof e=="function"&&(e=e($({},_),this.props)),e&&$(_,e),e!=null&&this.__v&&(t&&this._sb.push(t),re(this))},A.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),re(this))},A.prototype.render=W,E=[],ye=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,z=function(e,t){return e.__v.__b-t.__v.__b},O.__r=0,Y=0,J=se(!1),G=se(!0);function _e(){return(_e=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var _=arguments[t];for(var o in _)Object.prototype.hasOwnProperty.call(_,o)&&(e[o]=_[o])}return e}).apply(this,arguments)}var Oe=["context","children"];function je(e){this.getChildContext=function(){return e.context};var t=e.children,_=(function(o,n){if(o==null)return{};var r,s,c={},l=Object.keys(o);for(s=0;s<l.length;s++)n.indexOf(r=l[s])>=0||(c[r]=o[r]);return c})(e,Oe);return xe(t,_)}function Ie(){var e=new CustomEvent("_preact",{detail:{},bubbles:!0,cancelable:!0});this.dispatchEvent(e),this._vdom=D(je,_e({},this._props,{context:e.detail.context}),(function t(_,o){if(_.nodeType===3)return _.data;if(_.nodeType!==1)return null;var n=[],r={},s=0,c=_.attributes,l=_.childNodes;for(s=c.length;s--;)c[s].name!=="slot"&&(r[c[s].name]=c[s].value,r[De(c[s].name)]=c[s].value);for(s=l.length;s--;){var a=t(l[s],null),f=l[s].slot;f?r[f]=D(ce,{name:f},a):n[s]=a}var i=o?D(ce,null,n):n;return D(o||_.nodeName.toLowerCase(),r,i)})(this,this._vdomComponent)),(this.hasAttribute("hydrate")?Ee:V)(this._vdom,this._root)}function De(e){return e.replace(/-(\w)/g,function(t,_){return _?_.toUpperCase():""})}function We(e,t,_){if(this._vdom){var o={};o[e]=_=_??void 0,o[De(e)]=_,this._vdom=xe(this._vdom,o),V(this._vdom,this._root)}}function Ve(){V(this._vdom=null,this._root)}function ce(e,t){var _=this;return D("slot",_e({},e,{ref:function(o){o?(_.ref=o,_._listener||(_._listener=function(n){n.stopPropagation(),n.detail.context=t},o.addEventListener("_preact",_._listener))):_.ref.removeEventListener("_preact",_._listener)}}))}function Pe(e,t,_,o){function n(){var r=Reflect.construct(HTMLElement,[],n);return r._vdomComponent=e,r._root=r,r}return(n.prototype=Object.create(HTMLElement.prototype)).constructor=n,n.prototype.connectedCallback=Ie,n.prototype.attributeChangedCallback=We,n.prototype.disconnectedCallback=Ve,_=_||e.observedAttributes||Object.keys(e.propTypes||{}),n.observedAttributes=_,_.forEach(function(r){Object.defineProperty(n.prototype,r,{get:function(){return this._vdom.props[r]},set:function(s){this._vdom?this.attributeChangedCallback(r,null,s):(this._props||(this._props={}),this._props[r]=s,this.connectedCallback());var c=typeof s;s!=null&&c!=="string"&&c!=="boolean"&&c!=="number"||this.setAttribute(r,s)}})}),customElements.define(t||e.tagName||e.displayName||e.name,n)}var j,b,B,ae,Q=0,He=[],m=p,le=m.__b,ue=m.__r,fe=m.diffed,de=m.__c,pe=m.unmount,he=m.__;function Ne(e,t){m.__h&&m.__h(b,e,Q||t),Q=0;var _=b.__H||(b.__H={__:[],__h:[]});return e>=_.__.length&&_.__.push({}),_.__[e]}function I(e,t){var _=Ne(j++,3);!m.__s&&Te(_.__H,t)&&(_.__=e,_.i=t,b.__H.__h.push(_))}function Se(e){return Q=5,qe(function(){return{current:e}},[])}function qe(e,t){var _=Ne(j++,7);return Te(_.__H,t)&&(_.__=e(),_.__H=t,_.__h=e),_.__}function Be(){for(var e;e=He.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(F),e.__H.__h.forEach(X),e.__H.__h=[]}catch(t){e.__H.__h=[],m.__e(t,e.__v)}}m.__b=function(e){b=null,le&&le(e)},m.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),he&&he(e,t)},m.__r=function(e){ue&&ue(e),j=0;var t=(b=e.__c).__H;t&&(B===b?(t.__h=[],b.__h=[],t.__.forEach(function(_){_.__N&&(_.__=_.__N),_.i=_.__N=void 0})):(t.__h.forEach(F),t.__h.forEach(X),t.__h=[],j=0)),B=b},m.diffed=function(e){fe&&fe(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(He.push(t)!==1&&ae===m.requestAnimationFrame||((ae=m.requestAnimationFrame)||ze)(Be)),t.__H.__.forEach(function(_){_.i&&(_.__H=_.i),_.i=void 0})),B=b=null},m.__c=function(e,t){t.some(function(_){try{_.__h.forEach(F),_.__h=_.__h.filter(function(o){return!o.__||X(o)})}catch(o){t.some(function(n){n.__h&&(n.__h=[])}),t=[],m.__e(o,_.__v)}}),de&&de(e,t)},m.unmount=function(e){pe&&pe(e);var t,_=e.__c;_&&_.__H&&(_.__H.__.forEach(function(o){try{F(o)}catch(n){t=n}}),_.__H=void 0,t&&m.__e(t,_.__v))};var me=typeof requestAnimationFrame=="function";function ze(e){var t,_=function(){clearTimeout(o),me&&cancelAnimationFrame(t),setTimeout(e)},o=setTimeout(_,100);me&&(t=requestAnimationFrame(_))}function F(e){var t=b,_=e.__c;typeof _=="function"&&(e.__c=void 0,_()),b=t}function X(e){var t=b;e.__c=e.__(),b=t}function Te(e,t){return!e||e.length!==t.length||t.some(function(_,o){return _!==e[o]})}var Je=0;function Le(e,t,_,o,n,r){t||(t={});var s,c,l=t;if("ref"in l)for(c in l={},t)c=="ref"?s=t[c]:l[c]=t[c];var a={type:e,props:l,key:_,ref:s,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--Je,__i:-1,__u:0,__source:n,__self:r};return p.vnode&&p.vnode(a),a}function Ge(e){const t=Se(null);function _(){const n=e.host||"https://app.documenso.com",r=btoa(encodeURIComponent(JSON.stringify({name:e.name,lockName:e.lockName,email:e.email,lockEmail:e.lockEmail,css:e.css,cssVars:e.cssVars,darkModeDisabled:e.darkModeDisabled,...e.additionalProps}))),s=new URL(`/embed/direct/${e.token}`,n);return e.externalId&&s.searchParams.set("externalId",e.externalId),`${s}#${r}`}function o(n){if(t.current?.contentWindow===n.source)switch(n.data.action){case"document-ready":e.onDocumentReady?.();break;case"document-completed":e.onDocumentCompleted?.(n.data.data);break;case"document-error":e.onDocumentError?.(n.data.data);break;case"field-signed":e.onFieldSigned?.();break;case"field-unsigned":e.onFieldUnsigned?.();break}}return I(()=>{window.addEventListener("message",o)},[]),I(()=>()=>{window.removeEventListener("message",o)},[]),Le("iframe",{ref:t,className:e.className,src:_()})}function Ke(e){const t=Se(null);function _(){const n=e.host||"https://app.documenso.com",r=btoa(encodeURIComponent(JSON.stringify({name:e.name,lockName:e.lockName,css:e.css,cssVars:e.cssVars,darkModeDisabled:e.darkModeDisabled,allowDocumentRejection:e.allowDocumentRejection,...e.additionalProps})));return`${new URL(`/embed/sign/${e.token}`,n)}#${r}`}function o(n){if(t.current?.contentWindow===n.source)switch(n.data.action){case"document-ready":e.onDocumentReady?.();break;case"document-completed":e.onDocumentCompleted?.(n.data.data);break;case"document-error":e.onDocumentError?.(n.data.data);break;case"document-rejected":e.onDocumentRejected?.(n.data.data);break}}return I(()=>{window.addEventListener("message",o)},[]),I(()=>()=>{window.removeEventListener("message",o)},[]),Le("iframe",{ref:t,className:e.className,src:_()})}Pe(Ge,"documenso-embed-direct-template",["token","host","externalId","css","email","lockEmail","name","lockName","onDocumentReady","onDocumentCompleted","onDocumentError"]);Pe(Ke,"documenso-embed-sign-document",["token","host","css","name","lockName","onDocumentReady","onDocumentCompleted","onDocumentError"]);
package/dist/index.mjs CHANGED
@@ -8,14 +8,14 @@ function be(e) {
8
8
  t && t.removeChild(e);
9
9
  }
10
10
  function D(e, t, _) {
11
- var r, n, o, l = {};
12
- for (o in t) o == "key" ? r = t[o] : o == "ref" ? n = t[o] : l[o] = t[o];
13
- if (arguments.length > 2 && (l.children = arguments.length > 3 ? T.call(arguments, 2) : _), typeof e == "function" && e.defaultProps != null) for (o in e.defaultProps) l[o] === void 0 && (l[o] = e.defaultProps[o]);
14
- return N(e, l, r, n, null);
11
+ var o, n, r, c = {};
12
+ for (r in t) r == "key" ? o = t[r] : r == "ref" ? n = t[r] : c[r] = t[r];
13
+ if (arguments.length > 2 && (c.children = arguments.length > 3 ? T.call(arguments, 2) : _), typeof e == "function" && e.defaultProps != null) for (r in e.defaultProps) c[r] === void 0 && (c[r] = e.defaultProps[r]);
14
+ return N(e, c, o, n, null);
15
15
  }
16
- function N(e, t, _, r, n) {
17
- var o = { type: e, props: t, key: _, ref: r, __k: null, __: null, __b: 0, __e: null, __d: void 0, __c: null, constructor: void 0, __v: n ?? ++ve, __i: -1, __u: 0 };
18
- return n == null && p.vnode != null && p.vnode(o), o;
16
+ function N(e, t, _, o, n) {
17
+ var r = { type: e, props: t, key: _, ref: o, __k: null, __: null, __b: 0, __e: null, __d: void 0, __c: null, constructor: void 0, __v: n ?? ++ve, __i: -1, __u: 0 };
18
+ return n == null && p.vnode != null && p.vnode(r), r;
19
19
  }
20
20
  function W(e) {
21
21
  return e.children;
@@ -42,24 +42,24 @@ function re(e) {
42
42
  (!e.__d && (e.__d = !0) && E.push(e) && !O.__r++ || oe !== p.debounceRendering) && ((oe = p.debounceRendering) || ye)(O);
43
43
  }
44
44
  function O() {
45
- var e, t, _, r, n, o, l, c;
46
- for (E.sort(z); e = E.shift(); ) e.__d && (t = E.length, r = void 0, o = (n = (_ = e).__v).__e, l = [], c = [], _.__P && ((r = $({}, n)).__v = n.__v + 1, p.vnode && p.vnode(r), ee(_.__P, r, n, _.__n, _.__P.namespaceURI, 32 & n.__u ? [o] : null, l, o ?? x(n), !!(32 & n.__u), c), r.__v = n.__v, r.__.__k[r.__i] = r, Ce(l, r, c), r.__e != o && ke(r)), E.length > t && E.sort(z));
45
+ var e, t, _, o, n, r, c, s;
46
+ for (E.sort(z); e = E.shift(); ) e.__d && (t = E.length, o = void 0, r = (n = (_ = e).__v).__e, c = [], s = [], _.__P && ((o = $({}, n)).__v = n.__v + 1, p.vnode && p.vnode(o), ee(_.__P, o, n, _.__n, _.__P.namespaceURI, 32 & n.__u ? [r] : null, c, r ?? x(n), !!(32 & n.__u), s), o.__v = n.__v, o.__.__k[o.__i] = o, Ce(c, o, s), o.__e != r && ke(o)), E.length > t && E.sort(z));
47
47
  O.__r = 0;
48
48
  }
49
- function we(e, t, _, r, n, o, l, c, a, s, f) {
50
- var i, g, u, v, k, y = r && r.__k || ge, d = t.length;
51
- for (_.__d = a, Ue(_, t, y), a = _.__d, i = 0; i < d; i++) (u = _.__k[i]) != null && typeof u != "boolean" && typeof u != "function" && (g = u.__i === -1 ? S : y[u.__i] || S, u.__i = i, ee(e, u, g, n, o, l, c, a, s, f), v = u.__e, u.ref && g.ref != u.ref && (g.ref && te(g.ref, null, u), f.push(u.ref, u.__c || v, u)), k == null && v != null && (k = v), 65536 & u.__u || g.__k === u.__k ? a = $e(u, a, e) : typeof u.type == "function" && u.__d !== void 0 ? a = u.__d : v && (a = v.nextSibling), u.__d = void 0, u.__u &= -196609);
52
- _.__d = a, _.__e = k;
49
+ function we(e, t, _, o, n, r, c, s, l, a, f) {
50
+ var i, g, u, v, k, y = o && o.__k || ge, d = t.length;
51
+ for (_.__d = l, Ue(_, t, y), l = _.__d, i = 0; i < d; i++) (u = _.__k[i]) != null && typeof u != "boolean" && typeof u != "function" && (g = u.__i === -1 ? S : y[u.__i] || S, u.__i = i, ee(e, u, g, n, r, c, s, l, a, f), v = u.__e, u.ref && g.ref != u.ref && (g.ref && te(g.ref, null, u), f.push(u.ref, u.__c || v, u)), k == null && v != null && (k = v), 65536 & u.__u || g.__k === u.__k ? l = $e(u, l, e) : typeof u.type == "function" && u.__d !== void 0 ? l = u.__d : v && (l = v.nextSibling), u.__d = void 0, u.__u &= -196609);
52
+ _.__d = l, _.__e = k;
53
53
  }
54
54
  function Ue(e, t, _) {
55
- var r, n, o, l, c, a = t.length, s = _.length, f = s, i = 0;
56
- for (e.__k = [], r = 0; r < a; r++) l = r + i, (n = e.__k[r] = (n = t[r]) == null || typeof n == "boolean" || typeof n == "function" ? null : typeof n == "string" || typeof n == "number" || typeof n == "bigint" || n.constructor == String ? N(null, n, null, null, null) : Z(n) ? N(W, { children: n }, null, null, null) : n.constructor === void 0 && n.__b > 0 ? N(n.type, n.props, n.key, n.ref ? n.ref : null, n.__v) : n) != null ? (n.__ = e, n.__b = e.__b + 1, c = Re(n, _, l, f), n.__i = c, o = null, c !== -1 && (f--, (o = _[c]) && (o.__u |= 131072)), o == null || o.__v === null ? (c == -1 && i--, typeof n.type != "function" && (n.__u |= 65536)) : c !== l && (c == l - 1 ? i-- : c == l + 1 ? i++ : c > l ? f > a - l ? i += c - l : i-- : c < l && (c == l - i ? i -= c - l : i++), c !== r + i && (n.__u |= 65536))) : (o = _[l]) && o.key == null && o.__e && !(131072 & o.__u) && (o.__e == e.__d && (e.__d = x(o)), K(o, o, !1), _[l] = null, f--);
57
- if (f) for (r = 0; r < s; r++) (o = _[r]) != null && !(131072 & o.__u) && (o.__e == e.__d && (e.__d = x(o)), K(o, o));
55
+ var o, n, r, c, s, l = t.length, a = _.length, f = a, i = 0;
56
+ for (e.__k = [], o = 0; o < l; o++) c = o + i, (n = e.__k[o] = (n = t[o]) == null || typeof n == "boolean" || typeof n == "function" ? null : typeof n == "string" || typeof n == "number" || typeof n == "bigint" || n.constructor == String ? N(null, n, null, null, null) : Z(n) ? N(W, { children: n }, null, null, null) : n.constructor === void 0 && n.__b > 0 ? N(n.type, n.props, n.key, n.ref ? n.ref : null, n.__v) : n) != null ? (n.__ = e, n.__b = e.__b + 1, s = Re(n, _, c, f), n.__i = s, r = null, s !== -1 && (f--, (r = _[s]) && (r.__u |= 131072)), r == null || r.__v === null ? (s == -1 && i--, typeof n.type != "function" && (n.__u |= 65536)) : s !== c && (s == c - 1 ? i-- : s == c + 1 ? i++ : s > c ? f > l - c ? i += s - c : i-- : s < c && (s == c - i ? i -= s - c : i++), s !== o + i && (n.__u |= 65536))) : (r = _[c]) && r.key == null && r.__e && (131072 & r.__u) == 0 && (r.__e == e.__d && (e.__d = x(r)), K(r, r, !1), _[c] = null, f--);
57
+ if (f) for (o = 0; o < a; o++) (r = _[o]) != null && (131072 & r.__u) == 0 && (r.__e == e.__d && (e.__d = x(r)), K(r, r));
58
58
  }
59
59
  function $e(e, t, _) {
60
- var r, n;
60
+ var o, n;
61
61
  if (typeof e.type == "function") {
62
- for (r = e.__k, n = 0; r && n < r.length; n++) r[n] && (r[n].__ = e, t = $e(r[n], t, _));
62
+ for (o = e.__k, n = 0; o && n < o.length; n++) o[n] && (o[n].__ = e, t = $e(o[n], t, _));
63
63
  return t;
64
64
  }
65
65
  e.__e != t && (t && e.type && !_.contains(t) && (t = x(e)), _.insertBefore(e.__e, t || null), t = e.__e);
@@ -68,17 +68,17 @@ function $e(e, t, _) {
68
68
  while (t != null && t.nodeType === 8);
69
69
  return t;
70
70
  }
71
- function Re(e, t, _, r) {
72
- var n = e.key, o = e.type, l = _ - 1, c = _ + 1, a = t[_];
73
- if (a === null || a && n == a.key && o === a.type && !(131072 & a.__u)) return _;
74
- if (r > (a != null && !(131072 & a.__u) ? 1 : 0)) for (; l >= 0 || c < t.length; ) {
75
- if (l >= 0) {
76
- if ((a = t[l]) && !(131072 & a.__u) && n == a.key && o === a.type) return l;
77
- l--;
71
+ function Re(e, t, _, o) {
72
+ var n = e.key, r = e.type, c = _ - 1, s = _ + 1, l = t[_];
73
+ if (l === null || l && n == l.key && r === l.type && (131072 & l.__u) == 0) return _;
74
+ if (o > (l != null && (131072 & l.__u) == 0 ? 1 : 0)) for (; c >= 0 || s < t.length; ) {
75
+ if (c >= 0) {
76
+ if ((l = t[c]) && (131072 & l.__u) == 0 && n == l.key && r === l.type) return c;
77
+ c--;
78
78
  }
79
- if (c < t.length) {
80
- if ((a = t[c]) && !(131072 & a.__u) && n == a.key && o === a.type) return c;
81
- c++;
79
+ if (s < t.length) {
80
+ if ((l = t[s]) && (131072 & l.__u) == 0 && n == l.key && r === l.type) return s;
81
+ s++;
82
82
  }
83
83
  }
84
84
  return -1;
@@ -86,14 +86,14 @@ function Re(e, t, _, r) {
86
86
  function ie(e, t, _) {
87
87
  t[0] === "-" ? e.setProperty(t, _ ?? "") : e[t] = _ == null ? "" : typeof _ != "number" || Me.test(t) ? _ : _ + "px";
88
88
  }
89
- function R(e, t, _, r, n) {
90
- var o;
89
+ function R(e, t, _, o, n) {
90
+ var r;
91
91
  e: if (t === "style") if (typeof _ == "string") e.style.cssText = _;
92
92
  else {
93
- if (typeof r == "string" && (e.style.cssText = r = ""), r) for (t in r) _ && t in _ || ie(e.style, t, "");
94
- if (_) for (t in _) r && _[t] === r[t] || ie(e.style, t, _[t]);
93
+ if (typeof o == "string" && (e.style.cssText = o = ""), o) for (t in o) _ && t in _ || ie(e.style, t, "");
94
+ if (_) for (t in _) o && _[t] === o[t] || ie(e.style, t, _[t]);
95
95
  }
96
- else if (t[0] === "o" && t[1] === "n") o = t !== (t = t.replace(/(PointerCapture)$|Capture$/i, "$1")), t = t.toLowerCase() in e || t === "onFocusOut" || t === "onFocusIn" ? t.toLowerCase().slice(2) : t.slice(2), e.l || (e.l = {}), e.l[t + o] = _, _ ? r ? _.u = r.u : (_.u = Y, e.addEventListener(t, o ? G : J, o)) : e.removeEventListener(t, o ? G : J, o);
96
+ else if (t[0] === "o" && t[1] === "n") r = t !== (t = t.replace(/(PointerCapture)$|Capture$/i, "$1")), t = t.toLowerCase() in e || t === "onFocusOut" || t === "onFocusIn" ? t.toLowerCase().slice(2) : t.slice(2), e.l || (e.l = {}), e.l[t + r] = _, _ ? o ? _.u = o.u : (_.u = Y, e.addEventListener(t, r ? G : J, r)) : e.removeEventListener(t, r ? G : J, r);
97
97
  else {
98
98
  if (n == "http://www.w3.org/2000/svg") t = t.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
99
99
  else if (t != "width" && t != "height" && t != "href" && t != "list" && t != "form" && t != "tabIndex" && t != "download" && t != "rowSpan" && t != "colSpan" && t != "role" && t != "popover" && t in e) try {
@@ -104,7 +104,7 @@ function R(e, t, _, r, n) {
104
104
  typeof _ == "function" || (_ == null || _ === !1 && t[4] !== "-" ? e.removeAttribute(t) : e.setAttribute(t, t == "popover" && _ == 1 ? "" : _));
105
105
  }
106
106
  }
107
- function le(e) {
107
+ function ce(e) {
108
108
  return function(t) {
109
109
  if (this.l) {
110
110
  var _ = this.l[t.type + e];
@@ -114,18 +114,18 @@ function le(e) {
114
114
  }
115
115
  };
116
116
  }
117
- function ee(e, t, _, r, n, o, l, c, a, s) {
117
+ function ee(e, t, _, o, n, r, c, s, l, a) {
118
118
  var f, i, g, u, v, k, y, d, h, P, C, L, H, ne, M, q, w = t.type;
119
119
  if (t.constructor !== void 0) return null;
120
- 128 & _.__u && (a = !!(32 & _.__u), o = [c = t.__e = _.__e]), (f = p.__b) && f(t);
120
+ 128 & _.__u && (l = !!(32 & _.__u), r = [s = t.__e = _.__e]), (f = p.__b) && f(t);
121
121
  e: if (typeof w == "function") try {
122
- if (d = t.props, h = "prototype" in w && w.prototype.render, P = (f = w.contextType) && r[f.__c], C = f ? P ? P.props.value : f.__ : r, _.__c ? y = (i = t.__c = _.__c).__ = i.__E : (h ? t.__c = i = new w(d, C) : (t.__c = i = new A(d, C), i.constructor = w, i.render = Fe), P && P.sub(i), i.props = d, i.state || (i.state = {}), i.context = C, i.__n = r, g = i.__d = !0, i.__h = [], i._sb = []), h && i.__s == null && (i.__s = i.state), h && w.getDerivedStateFromProps != null && (i.__s == i.state && (i.__s = $({}, i.__s)), $(i.__s, w.getDerivedStateFromProps(d, i.__s))), u = i.props, v = i.state, i.__v = t, g) h && w.getDerivedStateFromProps == null && i.componentWillMount != null && i.componentWillMount(), h && i.componentDidMount != null && i.__h.push(i.componentDidMount);
122
+ if (d = t.props, h = "prototype" in w && w.prototype.render, P = (f = w.contextType) && o[f.__c], C = f ? P ? P.props.value : f.__ : o, _.__c ? y = (i = t.__c = _.__c).__ = i.__E : (h ? t.__c = i = new w(d, C) : (t.__c = i = new A(d, C), i.constructor = w, i.render = Fe), P && P.sub(i), i.props = d, i.state || (i.state = {}), i.context = C, i.__n = o, g = i.__d = !0, i.__h = [], i._sb = []), h && i.__s == null && (i.__s = i.state), h && w.getDerivedStateFromProps != null && (i.__s == i.state && (i.__s = $({}, i.__s)), $(i.__s, w.getDerivedStateFromProps(d, i.__s))), u = i.props, v = i.state, i.__v = t, g) h && w.getDerivedStateFromProps == null && i.componentWillMount != null && i.componentWillMount(), h && i.componentDidMount != null && i.__h.push(i.componentDidMount);
123
123
  else {
124
124
  if (h && w.getDerivedStateFromProps == null && d !== u && i.componentWillReceiveProps != null && i.componentWillReceiveProps(d, C), !i.__e && (i.shouldComponentUpdate != null && i.shouldComponentUpdate(d, i.__s, C) === !1 || t.__v === _.__v)) {
125
125
  for (t.__v !== _.__v && (i.props = d, i.state = i.__s, i.__d = !1), t.__e = _.__e, t.__k = _.__k, t.__k.forEach(function(U) {
126
126
  U && (U.__ = t);
127
127
  }), L = 0; L < i._sb.length; L++) i.__h.push(i._sb[L]);
128
- i._sb = [], i.__h.length && l.push(i);
128
+ i._sb = [], i.__h.length && c.push(i);
129
129
  break e;
130
130
  }
131
131
  i.componentWillUpdate != null && i.componentWillUpdate(d, i.__s, C), h && i.componentDidUpdate != null && i.__h.push(function() {
@@ -138,102 +138,102 @@ function ee(e, t, _, r, n, o, l, c, a, s) {
138
138
  } else do
139
139
  i.__d = !1, H && H(t), f = i.render(i.props, i.state, i.context), i.state = i.__s;
140
140
  while (i.__d && ++ne < 25);
141
- i.state = i.__s, i.getChildContext != null && (r = $($({}, r), i.getChildContext())), h && !g && i.getSnapshotBeforeUpdate != null && (k = i.getSnapshotBeforeUpdate(u, v)), we(e, Z(q = f != null && f.type === W && f.key == null ? f.props.children : f) ? q : [q], t, _, r, n, o, l, c, a, s), i.base = t.__e, t.__u &= -161, i.__h.length && l.push(i), y && (i.__E = i.__ = null);
141
+ i.state = i.__s, i.getChildContext != null && (o = $($({}, o), i.getChildContext())), h && !g && i.getSnapshotBeforeUpdate != null && (k = i.getSnapshotBeforeUpdate(u, v)), we(e, Z(q = f != null && f.type === W && f.key == null ? f.props.children : f) ? q : [q], t, _, o, n, r, c, s, l, a), i.base = t.__e, t.__u &= -161, i.__h.length && c.push(i), y && (i.__E = i.__ = null);
142
142
  } catch (U) {
143
- if (t.__v = null, a || o != null) {
144
- for (t.__u |= a ? 160 : 32; c && c.nodeType === 8 && c.nextSibling; ) c = c.nextSibling;
145
- o[o.indexOf(c)] = null, t.__e = c;
143
+ if (t.__v = null, l || r != null) {
144
+ for (t.__u |= l ? 160 : 32; s && s.nodeType === 8 && s.nextSibling; ) s = s.nextSibling;
145
+ r[r.indexOf(s)] = null, t.__e = s;
146
146
  } else t.__e = _.__e, t.__k = _.__k;
147
147
  p.__e(U, t, _);
148
148
  }
149
- else o == null && t.__v === _.__v ? (t.__k = _.__k, t.__e = _.__e) : t.__e = Ae(_.__e, t, _, r, n, o, l, a, s);
149
+ else r == null && t.__v === _.__v ? (t.__k = _.__k, t.__e = _.__e) : t.__e = Ae(_.__e, t, _, o, n, r, c, l, a);
150
150
  (f = p.diffed) && f(t);
151
151
  }
152
152
  function Ce(e, t, _) {
153
153
  t.__d = void 0;
154
- for (var r = 0; r < _.length; r++) te(_[r], _[++r], _[++r]);
154
+ for (var o = 0; o < _.length; o++) te(_[o], _[++o], _[++o]);
155
155
  p.__c && p.__c(t, e), e.some(function(n) {
156
156
  try {
157
- e = n.__h, n.__h = [], e.some(function(o) {
158
- o.call(n);
157
+ e = n.__h, n.__h = [], e.some(function(r) {
158
+ r.call(n);
159
159
  });
160
- } catch (o) {
161
- p.__e(o, n.__v);
160
+ } catch (r) {
161
+ p.__e(r, n.__v);
162
162
  }
163
163
  });
164
164
  }
165
- function Ae(e, t, _, r, n, o, l, c, a) {
166
- var s, f, i, g, u, v, k, y = _.props, d = t.props, h = t.type;
167
- if (h === "svg" ? n = "http://www.w3.org/2000/svg" : h === "math" ? n = "http://www.w3.org/1998/Math/MathML" : n || (n = "http://www.w3.org/1999/xhtml"), o != null) {
168
- for (s = 0; s < o.length; s++) if ((u = o[s]) && "setAttribute" in u == !!h && (h ? u.localName === h : u.nodeType === 3)) {
169
- e = u, o[s] = null;
165
+ function Ae(e, t, _, o, n, r, c, s, l) {
166
+ var a, f, i, g, u, v, k, y = _.props, d = t.props, h = t.type;
167
+ if (h === "svg" ? n = "http://www.w3.org/2000/svg" : h === "math" ? n = "http://www.w3.org/1998/Math/MathML" : n || (n = "http://www.w3.org/1999/xhtml"), r != null) {
168
+ for (a = 0; a < r.length; a++) if ((u = r[a]) && "setAttribute" in u == !!h && (h ? u.localName === h : u.nodeType === 3)) {
169
+ e = u, r[a] = null;
170
170
  break;
171
171
  }
172
172
  }
173
173
  if (e == null) {
174
174
  if (h === null) return document.createTextNode(d);
175
- e = document.createElementNS(n, h, d.is && d), o = null, c = !1;
175
+ e = document.createElementNS(n, h, d.is && d), r = null, s = !1;
176
176
  }
177
- if (h === null) y === d || c && e.data === d || (e.data = d);
177
+ if (h === null) y === d || s && e.data === d || (e.data = d);
178
178
  else {
179
- if (o = o && T.call(e.childNodes), y = _.props || S, !c && o != null) for (y = {}, s = 0; s < e.attributes.length; s++) y[(u = e.attributes[s]).name] = u.value;
180
- for (s in y) if (u = y[s], s != "children") {
181
- if (s == "dangerouslySetInnerHTML") i = u;
182
- else if (s !== "key" && !(s in d)) {
183
- if (s == "value" && "defaultValue" in d || s == "checked" && "defaultChecked" in d) continue;
184
- R(e, s, null, u, n);
179
+ if (r = r && T.call(e.childNodes), y = _.props || S, !s && r != null) for (y = {}, a = 0; a < e.attributes.length; a++) y[(u = e.attributes[a]).name] = u.value;
180
+ for (a in y) if (u = y[a], a != "children") {
181
+ if (a == "dangerouslySetInnerHTML") i = u;
182
+ else if (a !== "key" && !(a in d)) {
183
+ if (a == "value" && "defaultValue" in d || a == "checked" && "defaultChecked" in d) continue;
184
+ R(e, a, null, u, n);
185
185
  }
186
186
  }
187
- for (s in d) u = d[s], s == "children" ? g = u : s == "dangerouslySetInnerHTML" ? f = u : s == "value" ? v = u : s == "checked" ? k = u : s === "key" || c && typeof u != "function" || y[s] === u || R(e, s, u, y[s], n);
188
- if (f) c || i && (f.__html === i.__html || f.__html === e.innerHTML) || (e.innerHTML = f.__html), t.__k = [];
189
- else if (i && (e.innerHTML = ""), we(e, Z(g) ? g : [g], t, _, r, h === "foreignObject" ? "http://www.w3.org/1999/xhtml" : n, o, l, o ? o[0] : _.__k && x(_, 0), c, a), o != null) for (s = o.length; s--; ) o[s] != null && be(o[s]);
190
- c || (s = "value", v !== void 0 && (v !== e[s] || h === "progress" && !v || h === "option" && v !== y[s]) && R(e, s, v, y[s], n), s = "checked", k !== void 0 && k !== e[s] && R(e, s, k, y[s], n));
187
+ for (a in d) u = d[a], a == "children" ? g = u : a == "dangerouslySetInnerHTML" ? f = u : a == "value" ? v = u : a == "checked" ? k = u : a === "key" || s && typeof u != "function" || y[a] === u || R(e, a, u, y[a], n);
188
+ if (f) s || i && (f.__html === i.__html || f.__html === e.innerHTML) || (e.innerHTML = f.__html), t.__k = [];
189
+ else if (i && (e.innerHTML = ""), we(e, Z(g) ? g : [g], t, _, o, h === "foreignObject" ? "http://www.w3.org/1999/xhtml" : n, r, c, r ? r[0] : _.__k && x(_, 0), s, l), r != null) for (a = r.length; a--; ) r[a] != null && be(r[a]);
190
+ s || (a = "value", v !== void 0 && (v !== e[a] || h === "progress" && !v || h === "option" && v !== y[a]) && R(e, a, v, y[a], n), a = "checked", k !== void 0 && k !== e[a] && R(e, a, k, y[a], n));
191
191
  }
192
192
  return e;
193
193
  }
194
194
  function te(e, t, _) {
195
195
  try {
196
196
  if (typeof e == "function") {
197
- var r = typeof e.__u == "function";
198
- r && e.__u(), r && t == null || (e.__u = e(t));
197
+ var o = typeof e.__u == "function";
198
+ o && e.__u(), o && t == null || (e.__u = e(t));
199
199
  } else e.current = t;
200
200
  } catch (n) {
201
201
  p.__e(n, _);
202
202
  }
203
203
  }
204
204
  function K(e, t, _) {
205
- var r, n;
206
- if (p.unmount && p.unmount(e), (r = e.ref) && (r.current && r.current !== e.__e || te(r, null, t)), (r = e.__c) != null) {
207
- if (r.componentWillUnmount) try {
208
- r.componentWillUnmount();
209
- } catch (o) {
210
- p.__e(o, t);
205
+ var o, n;
206
+ if (p.unmount && p.unmount(e), (o = e.ref) && (o.current && o.current !== e.__e || te(o, null, t)), (o = e.__c) != null) {
207
+ if (o.componentWillUnmount) try {
208
+ o.componentWillUnmount();
209
+ } catch (r) {
210
+ p.__e(r, t);
211
211
  }
212
- r.base = r.__P = null;
212
+ o.base = o.__P = null;
213
213
  }
214
- if (r = e.__k) for (n = 0; n < r.length; n++) r[n] && K(r[n], t, _ || typeof e.type != "function");
214
+ if (o = e.__k) for (n = 0; n < o.length; n++) o[n] && K(o[n], t, _ || typeof e.type != "function");
215
215
  _ || e.__e == null || be(e.__e), e.__c = e.__ = e.__e = e.__d = void 0;
216
216
  }
217
217
  function Fe(e, t, _) {
218
218
  return this.constructor(e, _);
219
219
  }
220
220
  function V(e, t, _) {
221
- var r, n, o, l;
222
- p.__ && p.__(e, t), n = (r = typeof _ == "function") ? null : _ && _.__k || t.__k, o = [], l = [], ee(t, e = (!r && _ || t).__k = D(W, null, [e]), n || S, S, t.namespaceURI, !r && _ ? [_] : n ? null : t.firstChild ? T.call(t.childNodes) : null, o, !r && _ ? _ : n ? n.__e : t.firstChild, r, l), Ce(o, e, l);
221
+ var o, n, r, c;
222
+ p.__ && p.__(e, t), n = (o = typeof _ == "function") ? null : _ && _.__k || t.__k, r = [], c = [], ee(t, e = (!o && _ || t).__k = D(W, null, [e]), n || S, S, t.namespaceURI, !o && _ ? [_] : n ? null : t.firstChild ? T.call(t.childNodes) : null, r, !o && _ ? _ : n ? n.__e : t.firstChild, o, c), Ce(r, e, c);
223
223
  }
224
224
  function Ee(e, t) {
225
225
  V(e, t, Ee);
226
226
  }
227
227
  function xe(e, t, _) {
228
- var r, n, o, l, c = $({}, e.props);
229
- for (o in e.type && e.type.defaultProps && (l = e.type.defaultProps), t) o == "key" ? r = t[o] : o == "ref" ? n = t[o] : c[o] = t[o] === void 0 && l !== void 0 ? l[o] : t[o];
230
- return arguments.length > 2 && (c.children = arguments.length > 3 ? T.call(arguments, 2) : _), N(e.type, c, r || e.key, n || e.ref, null);
231
- }
232
- T = ge.slice, p = { __e: function(e, t, _, r) {
233
- for (var n, o, l; t = t.__; ) if ((n = t.__c) && !n.__) try {
234
- if ((o = n.constructor) && o.getDerivedStateFromError != null && (n.setState(o.getDerivedStateFromError(e)), l = n.__d), n.componentDidCatch != null && (n.componentDidCatch(e, r || {}), l = n.__d), l) return n.__E = n;
235
- } catch (c) {
236
- e = c;
228
+ var o, n, r, c, s = $({}, e.props);
229
+ for (r in e.type && e.type.defaultProps && (c = e.type.defaultProps), t) r == "key" ? o = t[r] : r == "ref" ? n = t[r] : s[r] = t[r] === void 0 && c !== void 0 ? c[r] : t[r];
230
+ return arguments.length > 2 && (s.children = arguments.length > 3 ? T.call(arguments, 2) : _), N(e.type, s, o || e.key, n || e.ref, null);
231
+ }
232
+ T = ge.slice, p = { __e: function(e, t, _, o) {
233
+ for (var n, r, c; t = t.__; ) if ((n = t.__c) && !n.__) try {
234
+ if ((r = n.constructor) && r.getDerivedStateFromError != null && (n.setState(r.getDerivedStateFromError(e)), c = n.__d), n.componentDidCatch != null && (n.componentDidCatch(e, o || {}), c = n.__d), c) return n.__E = n;
235
+ } catch (s) {
236
+ e = s;
237
237
  }
238
238
  throw e;
239
239
  } }, ve = 0, A.prototype.setState = function(e, t) {
@@ -243,12 +243,12 @@ T = ge.slice, p = { __e: function(e, t, _, r) {
243
243
  this.__v && (this.__e = !0, e && this.__h.push(e), re(this));
244
244
  }, A.prototype.render = W, E = [], ye = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, z = function(e, t) {
245
245
  return e.__v.__b - t.__v.__b;
246
- }, O.__r = 0, Y = 0, J = le(!1), G = le(!0);
246
+ }, O.__r = 0, Y = 0, J = ce(!1), G = ce(!0);
247
247
  function _e() {
248
248
  return (_e = Object.assign ? Object.assign.bind() : function(e) {
249
249
  for (var t = 1; t < arguments.length; t++) {
250
250
  var _ = arguments[t];
251
- for (var r in _) Object.prototype.hasOwnProperty.call(_, r) && (e[r] = _[r]);
251
+ for (var o in _) Object.prototype.hasOwnProperty.call(_, o) && (e[o] = _[o]);
252
252
  }
253
253
  return e;
254
254
  }).apply(this, arguments);
@@ -258,28 +258,28 @@ function je(e) {
258
258
  this.getChildContext = function() {
259
259
  return e.context;
260
260
  };
261
- var t = e.children, _ = function(r, n) {
262
- if (r == null) return {};
263
- var o, l, c = {}, a = Object.keys(r);
264
- for (l = 0; l < a.length; l++) n.indexOf(o = a[l]) >= 0 || (c[o] = r[o]);
265
- return c;
266
- }(e, Oe);
261
+ var t = e.children, _ = (function(o, n) {
262
+ if (o == null) return {};
263
+ var r, c, s = {}, l = Object.keys(o);
264
+ for (c = 0; c < l.length; c++) n.indexOf(r = l[c]) >= 0 || (s[r] = o[r]);
265
+ return s;
266
+ })(e, Oe);
267
267
  return xe(t, _);
268
268
  }
269
269
  function Ie() {
270
270
  var e = new CustomEvent("_preact", { detail: {}, bubbles: !0, cancelable: !0 });
271
- this.dispatchEvent(e), this._vdom = D(je, _e({}, this._props, { context: e.detail.context }), function t(_, r) {
271
+ this.dispatchEvent(e), this._vdom = D(je, _e({}, this._props, { context: e.detail.context }), (function t(_, o) {
272
272
  if (_.nodeType === 3) return _.data;
273
273
  if (_.nodeType !== 1) return null;
274
- var n = [], o = {}, l = 0, c = _.attributes, a = _.childNodes;
275
- for (l = c.length; l--; ) c[l].name !== "slot" && (o[c[l].name] = c[l].value, o[De(c[l].name)] = c[l].value);
276
- for (l = a.length; l--; ) {
277
- var s = t(a[l], null), f = a[l].slot;
278
- f ? o[f] = D(ce, { name: f }, s) : n[l] = s;
274
+ var n = [], r = {}, c = 0, s = _.attributes, l = _.childNodes;
275
+ for (c = s.length; c--; ) s[c].name !== "slot" && (r[s[c].name] = s[c].value, r[De(s[c].name)] = s[c].value);
276
+ for (c = l.length; c--; ) {
277
+ var a = t(l[c], null), f = l[c].slot;
278
+ f ? r[f] = D(se, { name: f }, a) : n[c] = a;
279
279
  }
280
- var i = r ? D(ce, null, n) : n;
281
- return D(r || _.nodeName.toLowerCase(), o, i);
282
- }(this, this._vdomComponent)), (this.hasAttribute("hydrate") ? Ee : V)(this._vdom, this._root);
280
+ var i = o ? D(se, null, n) : n;
281
+ return D(o || _.nodeName.toLowerCase(), r, i);
282
+ })(this, this._vdomComponent)), (this.hasAttribute("hydrate") ? Ee : V)(this._vdom, this._root);
283
283
  }
284
284
  function De(e) {
285
285
  return e.replace(/-(\w)/g, function(t, _) {
@@ -288,37 +288,37 @@ function De(e) {
288
288
  }
289
289
  function We(e, t, _) {
290
290
  if (this._vdom) {
291
- var r = {};
292
- r[e] = _ = _ ?? void 0, r[De(e)] = _, this._vdom = xe(this._vdom, r), V(this._vdom, this._root);
291
+ var o = {};
292
+ o[e] = _ = _ ?? void 0, o[De(e)] = _, this._vdom = xe(this._vdom, o), V(this._vdom, this._root);
293
293
  }
294
294
  }
295
295
  function Ve() {
296
296
  V(this._vdom = null, this._root);
297
297
  }
298
- function ce(e, t) {
298
+ function se(e, t) {
299
299
  var _ = this;
300
- return D("slot", _e({}, e, { ref: function(r) {
301
- r ? (_.ref = r, _._listener || (_._listener = function(n) {
300
+ return D("slot", _e({}, e, { ref: function(o) {
301
+ o ? (_.ref = o, _._listener || (_._listener = function(n) {
302
302
  n.stopPropagation(), n.detail.context = t;
303
- }, r.addEventListener("_preact", _._listener))) : _.ref.removeEventListener("_preact", _._listener);
303
+ }, o.addEventListener("_preact", _._listener))) : _.ref.removeEventListener("_preact", _._listener);
304
304
  } }));
305
305
  }
306
- function Pe(e, t, _, r) {
306
+ function Pe(e, t, _, o) {
307
307
  function n() {
308
- var o = Reflect.construct(HTMLElement, [], n);
309
- return o._vdomComponent = e, o._root = o, o;
308
+ var r = Reflect.construct(HTMLElement, [], n);
309
+ return r._vdomComponent = e, r._root = r, r;
310
310
  }
311
- return (n.prototype = Object.create(HTMLElement.prototype)).constructor = n, n.prototype.connectedCallback = Ie, n.prototype.attributeChangedCallback = We, n.prototype.disconnectedCallback = Ve, _ = _ || e.observedAttributes || Object.keys(e.propTypes || {}), n.observedAttributes = _, _.forEach(function(o) {
312
- Object.defineProperty(n.prototype, o, { get: function() {
313
- return this._vdom.props[o];
314
- }, set: function(l) {
315
- this._vdom ? this.attributeChangedCallback(o, null, l) : (this._props || (this._props = {}), this._props[o] = l, this.connectedCallback());
316
- var c = typeof l;
317
- l != null && c !== "string" && c !== "boolean" && c !== "number" || this.setAttribute(o, l);
311
+ return (n.prototype = Object.create(HTMLElement.prototype)).constructor = n, n.prototype.connectedCallback = Ie, n.prototype.attributeChangedCallback = We, n.prototype.disconnectedCallback = Ve, _ = _ || e.observedAttributes || Object.keys(e.propTypes || {}), n.observedAttributes = _, _.forEach(function(r) {
312
+ Object.defineProperty(n.prototype, r, { get: function() {
313
+ return this._vdom.props[r];
314
+ }, set: function(c) {
315
+ this._vdom ? this.attributeChangedCallback(r, null, c) : (this._props || (this._props = {}), this._props[r] = c, this.connectedCallback());
316
+ var s = typeof c;
317
+ c != null && s !== "string" && s !== "boolean" && s !== "number" || this.setAttribute(r, c);
318
318
  } });
319
319
  }), customElements.define(t || e.tagName || e.displayName || e.name, n);
320
320
  }
321
- var j, b, B, se, Q = 0, He = [], m = p, ae = m.__b, ue = m.__r, fe = m.diffed, de = m.__c, pe = m.unmount, he = m.__;
321
+ var j, b, B, ae, Q = 0, He = [], m = p, le = m.__b, ue = m.__r, fe = m.diffed, de = m.__c, pe = m.unmount, he = m.__;
322
322
  function Ne(e, t) {
323
323
  m.__h && m.__h(b, e, Q || t), Q = 0;
324
324
  var _ = b.__H || (b.__H = { __: [], __h: [] });
@@ -345,7 +345,7 @@ function Be() {
345
345
  }
346
346
  }
347
347
  m.__b = function(e) {
348
- b = null, ae && ae(e);
348
+ b = null, le && le(e);
349
349
  }, m.__ = function(e, t) {
350
350
  e && t.__k && t.__k.__m && (e.__m = t.__k.__m), he && he(e, t);
351
351
  }, m.__r = function(e) {
@@ -357,27 +357,27 @@ m.__b = function(e) {
357
357
  }, m.diffed = function(e) {
358
358
  fe && fe(e);
359
359
  var t = e.__c;
360
- t && t.__H && (t.__H.__h.length && (He.push(t) !== 1 && se === m.requestAnimationFrame || ((se = m.requestAnimationFrame) || ze)(Be)), t.__H.__.forEach(function(_) {
360
+ t && t.__H && (t.__H.__h.length && (He.push(t) !== 1 && ae === m.requestAnimationFrame || ((ae = m.requestAnimationFrame) || ze)(Be)), t.__H.__.forEach(function(_) {
361
361
  _.i && (_.__H = _.i), _.i = void 0;
362
362
  })), B = b = null;
363
363
  }, m.__c = function(e, t) {
364
364
  t.some(function(_) {
365
365
  try {
366
- _.__h.forEach(F), _.__h = _.__h.filter(function(r) {
367
- return !r.__ || X(r);
366
+ _.__h.forEach(F), _.__h = _.__h.filter(function(o) {
367
+ return !o.__ || X(o);
368
368
  });
369
- } catch (r) {
369
+ } catch (o) {
370
370
  t.some(function(n) {
371
371
  n.__h && (n.__h = []);
372
- }), t = [], m.__e(r, _.__v);
372
+ }), t = [], m.__e(o, _.__v);
373
373
  }
374
374
  }), de && de(e, t);
375
375
  }, m.unmount = function(e) {
376
376
  pe && pe(e);
377
377
  var t, _ = e.__c;
378
- _ && _.__H && (_.__H.__.forEach(function(r) {
378
+ _ && _.__H && (_.__H.__.forEach(function(o) {
379
379
  try {
380
- F(r);
380
+ F(o);
381
381
  } catch (n) {
382
382
  t = n;
383
383
  }
@@ -386,8 +386,8 @@ m.__b = function(e) {
386
386
  var me = typeof requestAnimationFrame == "function";
387
387
  function ze(e) {
388
388
  var t, _ = function() {
389
- clearTimeout(r), me && cancelAnimationFrame(t), setTimeout(e);
390
- }, r = setTimeout(_, 100);
389
+ clearTimeout(o), me && cancelAnimationFrame(t), setTimeout(e);
390
+ }, o = setTimeout(_, 100);
391
391
  me && (t = requestAnimationFrame(_));
392
392
  }
393
393
  function F(e) {
@@ -399,22 +399,22 @@ function X(e) {
399
399
  e.__c = e.__(), b = t;
400
400
  }
401
401
  function Te(e, t) {
402
- return !e || e.length !== t.length || t.some(function(_, r) {
403
- return _ !== e[r];
402
+ return !e || e.length !== t.length || t.some(function(_, o) {
403
+ return _ !== e[o];
404
404
  });
405
405
  }
406
406
  var Je = 0;
407
- function Le(e, t, _, r, n, o) {
407
+ function Le(e, t, _, o, n, r) {
408
408
  t || (t = {});
409
- var l, c, a = t;
410
- if ("ref" in a) for (c in a = {}, t) c == "ref" ? l = t[c] : a[c] = t[c];
411
- var s = { type: e, props: a, key: _, ref: l, __k: null, __: null, __b: 0, __e: null, __d: void 0, __c: null, constructor: void 0, __v: --Je, __i: -1, __u: 0, __source: n, __self: o };
412
- return p.vnode && p.vnode(s), s;
409
+ var c, s, l = t;
410
+ if ("ref" in l) for (s in l = {}, t) s == "ref" ? c = t[s] : l[s] = t[s];
411
+ var a = { type: e, props: l, key: _, ref: c, __k: null, __: null, __b: 0, __e: null, __d: void 0, __c: null, constructor: void 0, __v: --Je, __i: -1, __u: 0, __source: n, __self: r };
412
+ return p.vnode && p.vnode(a), a;
413
413
  }
414
414
  function Ge(e) {
415
415
  const t = Se(null);
416
416
  function _() {
417
- const n = e.host || "https://app.documenso.com", o = btoa(
417
+ const n = e.host || "https://app.documenso.com", r = btoa(
418
418
  encodeURIComponent(
419
419
  JSON.stringify({
420
420
  name: e.name,
@@ -427,40 +427,39 @@ function Ge(e) {
427
427
  ...e.additionalProps
428
428
  })
429
429
  )
430
- ), l = new URL(`/embed/direct/${e.token}`, n);
431
- return e.externalId && l.searchParams.set("externalId", e.externalId), `${l}#${o}`;
430
+ ), c = new URL(`/embed/direct/${e.token}`, n);
431
+ return e.externalId && c.searchParams.set("externalId", e.externalId), `${c}#${r}`;
432
432
  }
433
- function r(n) {
434
- var o, l, c, a, s, f;
435
- if (((o = t.current) == null ? void 0 : o.contentWindow) === n.source)
433
+ function o(n) {
434
+ if (t.current?.contentWindow === n.source)
436
435
  switch (n.data.action) {
437
436
  case "document-ready":
438
- (l = e.onDocumentReady) == null || l.call(e);
437
+ e.onDocumentReady?.();
439
438
  break;
440
439
  case "document-completed":
441
- (c = e.onDocumentCompleted) == null || c.call(e, n.data.data);
440
+ e.onDocumentCompleted?.(n.data.data);
442
441
  break;
443
442
  case "document-error":
444
- (a = e.onDocumentError) == null || a.call(e, n.data.data);
443
+ e.onDocumentError?.(n.data.data);
445
444
  break;
446
445
  case "field-signed":
447
- (s = e.onFieldSigned) == null || s.call(e);
446
+ e.onFieldSigned?.();
448
447
  break;
449
448
  case "field-unsigned":
450
- (f = e.onFieldUnsigned) == null || f.call(e);
449
+ e.onFieldUnsigned?.();
451
450
  break;
452
451
  }
453
452
  }
454
453
  return I(() => {
455
- window.addEventListener("message", r);
454
+ window.addEventListener("message", o);
456
455
  }, []), I(() => () => {
457
- window.removeEventListener("message", r);
456
+ window.removeEventListener("message", o);
458
457
  }, []), /* @__PURE__ */ Le("iframe", { ref: t, className: e.className, src: _() });
459
458
  }
460
459
  function Ke(e) {
461
460
  const t = Se(null);
462
461
  function _() {
463
- const n = e.host || "https://app.documenso.com", o = btoa(
462
+ const n = e.host || "https://app.documenso.com", r = btoa(
464
463
  encodeURIComponent(
465
464
  JSON.stringify({
466
465
  name: e.name,
@@ -473,30 +472,29 @@ function Ke(e) {
473
472
  })
474
473
  )
475
474
  );
476
- return `${new URL(`/embed/sign/${e.token}`, n)}#${o}`;
475
+ return `${new URL(`/embed/sign/${e.token}`, n)}#${r}`;
477
476
  }
478
- function r(n) {
479
- var o, l, c, a, s;
480
- if (((o = t.current) == null ? void 0 : o.contentWindow) === n.source)
477
+ function o(n) {
478
+ if (t.current?.contentWindow === n.source)
481
479
  switch (n.data.action) {
482
480
  case "document-ready":
483
- (l = e.onDocumentReady) == null || l.call(e);
481
+ e.onDocumentReady?.();
484
482
  break;
485
483
  case "document-completed":
486
- (c = e.onDocumentCompleted) == null || c.call(e, n.data.data);
484
+ e.onDocumentCompleted?.(n.data.data);
487
485
  break;
488
486
  case "document-error":
489
- (a = e.onDocumentError) == null || a.call(e, n.data.data);
487
+ e.onDocumentError?.(n.data.data);
490
488
  break;
491
489
  case "document-rejected":
492
- (s = e.onDocumentRejected) == null || s.call(e, n.data.data);
490
+ e.onDocumentRejected?.(n.data.data);
493
491
  break;
494
492
  }
495
493
  }
496
494
  return I(() => {
497
- window.addEventListener("message", r);
495
+ window.addEventListener("message", o);
498
496
  }, []), I(() => () => {
499
- window.removeEventListener("message", r);
497
+ window.removeEventListener("message", o);
500
498
  }, []), /* @__PURE__ */ Le("iframe", { ref: t, className: e.className, src: _() });
501
499
  }
502
500
  Pe(Ge, "documenso-embed-direct-template", [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@documenso/embed-webcomponent",
3
- "version": "0.2.3",
3
+ "version": "0.4.0",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "dist"
@@ -41,7 +41,7 @@
41
41
  "devDependencies": {
42
42
  "@documenso/embed": "*",
43
43
  "@types/preact-custom-element": "^4.0.4",
44
- "vite": "^5.4.2",
44
+ "vite": "^7.0.0",
45
45
  "vite-plugin-dts": "^4.1.0"
46
46
  }
47
47
  }