@documenso/embed-webcomponent 0.0.1

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.
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";var L,h,ye,C,re,ge,V,Z,G,K,S={},be=[],Ue=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,ee=Array.isArray;function $(e,t){for(var n in t)e[n]=t[n];return e}function ke(e){var t=e.parentNode;t&&t.removeChild(e)}function P(e,t,n){var r,_,o,l={};for(o in t)o=="key"?r=t[o]:o=="ref"?_=t[o]:l[o]=t[o];if(arguments.length>2&&(l.children=arguments.length>3?L.call(arguments,2):n),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,_,null)}function N(e,t,n,r,_){var o={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:_??++ye,__i:-1,__u:0};return _==null&&h.vnode!=null&&h.vnode(o),o}function q(e){return e.children}function M(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 n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?x(e):null}function we(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=e.__c.base=n.__e;break}return we(e)}}function ie(e){(!e.__d&&(e.__d=!0)&&C.push(e)&&!R.__r++||re!==h.debounceRendering)&&((re=h.debounceRendering)||ge)(R)}function R(){var e,t,n,r,_,o,l,c;for(C.sort(V);e=C.shift();)e.__d&&(t=C.length,r=void 0,o=(_=(n=e).__v).__e,l=[],c=[],n.__P&&((r=$({},_)).__v=_.__v+1,h.vnode&&h.vnode(r),te(n.__P,r,_,n.__n,n.__P.namespaceURI,32&_.__u?[o]:null,l,o??x(_),!!(32&_.__u),c),r.__v=_.__v,r.__.__k[r.__i]=r,Ce(l,r,c),r.__e!=o&&we(r)),C.length>t&&C.sort(V));R.__r=0}function $e(e,t,n,r,_,o,l,c,a,s,f){var i,g,u,v,k,y=r&&r.__k||be,d=t.length;for(n.__d=a,Ae(n,t,y),a=n.__d,i=0;i<d;i++)(u=n.__k[i])!=null&&typeof u!="boolean"&&typeof u!="function"&&(g=u.__i===-1?S:y[u.__i]||S,u.__i=i,te(e,u,g,_,o,l,c,a,s,f),v=u.__e,u.ref&&g.ref!=u.ref&&(g.ref&&ne(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=Ee(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);n.__d=a,n.__e=k}function Ae(e,t,n){var r,_,o,l,c,a=t.length,s=n.length,f=s,i=0;for(e.__k=[],r=0;r<a;r++)l=r+i,(_=e.__k[r]=(_=t[r])==null||typeof _=="boolean"||typeof _=="function"?null:typeof _=="string"||typeof _=="number"||typeof _=="bigint"||_.constructor==String?N(null,_,null,null,null):ee(_)?N(q,{children:_},null,null,null):_.constructor===void 0&&_.__b>0?N(_.type,_.props,_.key,_.ref?_.ref:null,_.__v):_)!=null?(_.__=e,_.__b=e.__b+1,c=Me(_,n,l,f),_.__i=c,o=null,c!==-1&&(f--,(o=n[c])&&(o.__u|=131072)),o==null||o.__v===null?(c==-1&&i--,typeof _.type!="function"&&(_.__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&&(_.__u|=65536))):(o=n[l])&&o.key==null&&o.__e&&!(131072&o.__u)&&(o.__e==e.__d&&(e.__d=x(o)),Q(o,o,!1),n[l]=null,f--);if(f)for(r=0;r<s;r++)(o=n[r])!=null&&!(131072&o.__u)&&(o.__e==e.__d&&(e.__d=x(o)),Q(o,o))}function Ee(e,t,n){var r,_;if(typeof e.type=="function"){for(r=e.__k,_=0;r&&_<r.length;_++)r[_]&&(r[_].__=e,t=Ee(r[_],t,n));return t}e.__e!=t&&(t&&e.type&&!n.contains(t)&&(t=x(e)),n.insertBefore(e.__e,t||null),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType===8);return t}function Me(e,t,n,r){var _=e.key,o=e.type,l=n-1,c=n+1,a=t[n];if(a===null||a&&_==a.key&&o===a.type&&!(131072&a.__u))return n;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)&&_==a.key&&o===a.type)return l;l--}if(c<t.length){if((a=t[c])&&!(131072&a.__u)&&_==a.key&&o===a.type)return c;c++}}return-1}function le(e,t,n){t[0]==="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||Ue.test(t)?n:n+"px"}function A(e,t,n,r,_){var o;e:if(t==="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||le(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||le(e.style,t,n[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]=n,n?r?n.u=r.u:(n.u=Z,e.addEventListener(t,o?K:G,o)):e.removeEventListener(t,o?K:G,o);else{if(_=="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]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!=="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function ce(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t.t==null)t.t=Z++;else if(t.t<n.u)return;return n(h.event?h.event(t):t)}}}function te(e,t,n,r,_,o,l,c,a,s){var f,i,g,u,v,k,y,d,p,D,E,T,H,oe,F,z,w=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(a=!!(32&n.__u),o=[c=t.__e=n.__e]),(f=h.__b)&&f(t);e:if(typeof w=="function")try{if(d=t.props,p="prototype"in w&&w.prototype.render,D=(f=w.contextType)&&r[f.__c],E=f?D?D.props.value:f.__:r,n.__c?y=(i=t.__c=n.__c).__=i.__E:(p?t.__c=i=new w(d,E):(t.__c=i=new M(d,E),i.constructor=w,i.render=Re),D&&D.sub(i),i.props=d,i.state||(i.state={}),i.context=E,i.__n=r,g=i.__d=!0,i.__h=[],i._sb=[]),p&&i.__s==null&&(i.__s=i.state),p&&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)p&&w.getDerivedStateFromProps==null&&i.componentWillMount!=null&&i.componentWillMount(),p&&i.componentDidMount!=null&&i.__h.push(i.componentDidMount);else{if(p&&w.getDerivedStateFromProps==null&&d!==u&&i.componentWillReceiveProps!=null&&i.componentWillReceiveProps(d,E),!i.__e&&(i.shouldComponentUpdate!=null&&i.shouldComponentUpdate(d,i.__s,E)===!1||t.__v===n.__v)){for(t.__v!==n.__v&&(i.props=d,i.state=i.__s,i.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.forEach(function(U){U&&(U.__=t)}),T=0;T<i._sb.length;T++)i.__h.push(i._sb[T]);i._sb=[],i.__h.length&&l.push(i);break e}i.componentWillUpdate!=null&&i.componentWillUpdate(d,i.__s,E),p&&i.componentDidUpdate!=null&&i.__h.push(function(){i.componentDidUpdate(u,v,k)})}if(i.context=E,i.props=d,i.__P=e,i.__e=!1,H=h.__r,oe=0,p){for(i.state=i.__s,i.__d=!1,H&&H(t),f=i.render(i.props,i.state,i.context),F=0;F<i._sb.length;F++)i.__h.push(i._sb[F]);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&&++oe<25);i.state=i.__s,i.getChildContext!=null&&(r=$($({},r),i.getChildContext())),p&&!g&&i.getSnapshotBeforeUpdate!=null&&(k=i.getSnapshotBeforeUpdate(u,v)),$e(e,ee(z=f!=null&&f.type===q&&f.key==null?f.props.children:f)?z:[z],t,n,r,_,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=n.__e,t.__k=n.__k;h.__e(U,t,n)}else o==null&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=Oe(n.__e,t,n,r,_,o,l,a,s);(f=h.diffed)&&f(t)}function Ce(e,t,n){t.__d=void 0;for(var r=0;r<n.length;r++)ne(n[r],n[++r],n[++r]);h.__c&&h.__c(t,e),e.some(function(_){try{e=_.__h,_.__h=[],e.some(function(o){o.call(_)})}catch(o){h.__e(o,_.__v)}})}function Oe(e,t,n,r,_,o,l,c,a){var s,f,i,g,u,v,k,y=n.props,d=t.props,p=t.type;if(p==="svg"?_="http://www.w3.org/2000/svg":p==="math"?_="http://www.w3.org/1998/Math/MathML":_||(_="http://www.w3.org/1999/xhtml"),o!=null){for(s=0;s<o.length;s++)if((u=o[s])&&"setAttribute"in u==!!p&&(p?u.localName===p:u.nodeType===3)){e=u,o[s]=null;break}}if(e==null){if(p===null)return document.createTextNode(d);e=document.createElementNS(_,p,d.is&&d),o=null,c=!1}if(p===null)y===d||c&&e.data===d||(e.data=d);else{if(o=o&&L.call(e.childNodes),y=n.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;A(e,s,null,u,_)}}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||A(e,s,u,y[s],_);if(f)c||i&&(f.__html===i.__html||f.__html===e.innerHTML)||(e.innerHTML=f.__html),t.__k=[];else if(i&&(e.innerHTML=""),$e(e,ee(g)?g:[g],t,n,r,p==="foreignObject"?"http://www.w3.org/1999/xhtml":_,o,l,o?o[0]:n.__k&&x(n,0),c,a),o!=null)for(s=o.length;s--;)o[s]!=null&&ke(o[s]);c||(s="value",v!==void 0&&(v!==e[s]||p==="progress"&&!v||p==="option"&&v!==y[s])&&A(e,s,v,y[s],_),s="checked",k!==void 0&&k!==e[s]&&A(e,s,k,y[s],_))}return e}function ne(e,t,n){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(_){h.__e(_,n)}}function Q(e,t,n){var r,_;if(h.unmount&&h.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||ne(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(o){h.__e(o,t)}r.base=r.__P=null}if(r=e.__k)for(_=0;_<r.length;_++)r[_]&&Q(r[_],t,n||typeof e.type!="function");n||e.__e==null||ke(e.__e),e.__c=e.__=e.__e=e.__d=void 0}function Re(e,t,n){return this.constructor(e,n)}function B(e,t,n){var r,_,o,l;h.__&&h.__(e,t),_=(r=typeof n=="function")?null:n&&n.__k||t.__k,o=[],l=[],te(t,e=(!r&&n||t).__k=P(q,null,[e]),_||S,S,t.namespaceURI,!r&&n?[n]:_?null:t.firstChild?L.call(t.childNodes):null,o,!r&&n?n:_?_.__e:t.firstChild,r,l),Ce(o,e,l)}function xe(e,t){B(e,t,xe)}function Pe(e,t,n){var r,_,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"?_=t[o]:c[o]=t[o]===void 0&&l!==void 0?l[o]:t[o];return arguments.length>2&&(c.children=arguments.length>3?L.call(arguments,2):n),N(e.type,c,r||e.key,_||e.ref,null)}L=be.slice,h={__e:function(e,t,n,r){for(var _,o,l;t=t.__;)if((_=t.__c)&&!_.__)try{if((o=_.constructor)&&o.getDerivedStateFromError!=null&&(_.setState(o.getDerivedStateFromError(e)),l=_.__d),_.componentDidCatch!=null&&(_.componentDidCatch(e,r||{}),l=_.__d),l)return _.__E=_}catch(c){e=c}throw e}},ye=0,M.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=$({},this.state),typeof e=="function"&&(e=e($({},n),this.props)),e&&$(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),ie(this))},M.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),ie(this))},M.prototype.render=q,C=[],ge=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,V=function(e,t){return e.__v.__b-t.__v.__b},R.__r=0,Z=0,G=ce(!1),K=ce(!0);function _e(){return(_e=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}var Ie=["context","children"];function We(e){this.getChildContext=function(){return e.context};var t=e.children,n=function(r,_){if(r==null)return{};var o,l,c={},a=Object.keys(r);for(l=0;l<a.length;l++)_.indexOf(o=a[l])>=0||(c[o]=r[o]);return c}(e,Ie);return Pe(t,n)}function je(){var e=new CustomEvent("_preact",{detail:{},bubbles:!0,cancelable:!0});this.dispatchEvent(e),this._vdom=P(We,_e({},this._props,{context:e.detail.context}),function t(n,r){if(n.nodeType===3)return n.data;if(n.nodeType!==1)return null;var _=[],o={},l=0,c=n.attributes,a=n.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]=P(se,{name:f},s):_[l]=s}var i=r?P(se,null,_):_;return P(r||n.nodeName.toLowerCase(),o,i)}(this,this._vdomComponent)),(this.hasAttribute("hydrate")?xe:B)(this._vdom,this._root)}function De(e){return e.replace(/-(\w)/g,function(t,n){return n?n.toUpperCase():""})}function qe(e,t,n){if(this._vdom){var r={};r[e]=n=n??void 0,r[De(e)]=n,this._vdom=Pe(this._vdom,r),B(this._vdom,this._root)}}function Be(){B(this._vdom=null,this._root)}function se(e,t){var n=this;return P("slot",_e({},e,{ref:function(r){r?(n.ref=r,n._listener||(n._listener=function(_){_.stopPropagation(),_.detail.context=t},r.addEventListener("_preact",n._listener))):n.ref.removeEventListener("_preact",n._listener)}}))}function He(e,t,n,r){function _(){var o=Reflect.construct(HTMLElement,[],_);return o._vdomComponent=e,o._root=o,o}return(_.prototype=Object.create(HTMLElement.prototype)).constructor=_,_.prototype.connectedCallback=je,_.prototype.attributeChangedCallback=qe,_.prototype.disconnectedCallback=Be,n=n||e.observedAttributes||Object.keys(e.propTypes||{}),_.observedAttributes=n,n.forEach(function(o){Object.defineProperty(_.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,_)}var I;I={__e:function(e,t,n,r){for(var _,o,l;t=t.__;)if((_=t.__c)&&!_.__)try{if((o=_.constructor)&&o.getDerivedStateFromError!=null&&(_.setState(o.getDerivedStateFromError(e)),l=_.__d),_.componentDidCatch!=null&&(_.componentDidCatch(e,r||{}),l=_.__d),l)return _.__E=_}catch(c){e=c}throw e}},typeof Promise=="function"&&Promise.prototype.then.bind(Promise.resolve());var ze=0;function Ne(e,t,n,r,_,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:n,ref:l,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--ze,__i:-1,__u:0,__source:_,__self:o};return I.vnode&&I.vnode(s),s}var W,b,J,ae,X=0,Se=[],m=I,ue=m.__b,fe=m.__r,de=m.diffed,pe=m.__c,he=m.unmount,me=m.__;function Le(e,t){m.__h&&m.__h(b,e,X||t),X=0;var n=b.__H||(b.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function j(e,t){var n=Le(W++,3);!m.__s&&Fe(n.__H,t)&&(n.__=e,n.i=t,b.__H.__h.push(n))}function Te(e){return X=5,Je(function(){return{current:e}},[])}function Je(e,t){var n=Le(W++,7);return Fe(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Ve(){for(var e;e=Se.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(O),e.__H.__h.forEach(Y),e.__H.__h=[]}catch(t){e.__H.__h=[],m.__e(t,e.__v)}}m.__b=function(e){b=null,ue&&ue(e)},m.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),me&&me(e,t)},m.__r=function(e){fe&&fe(e),W=0;var t=(b=e.__c).__H;t&&(J===b?(t.__h=[],b.__h=[],t.__.forEach(function(n){n.__N&&(n.__=n.__N),n.i=n.__N=void 0})):(t.__h.forEach(O),t.__h.forEach(Y),t.__h=[],W=0)),J=b},m.diffed=function(e){de&&de(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Se.push(t)!==1&&ae===m.requestAnimationFrame||((ae=m.requestAnimationFrame)||Ge)(Ve)),t.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.i=void 0})),J=b=null},m.__c=function(e,t){t.some(function(n){try{n.__h.forEach(O),n.__h=n.__h.filter(function(r){return!r.__||Y(r)})}catch(r){t.some(function(_){_.__h&&(_.__h=[])}),t=[],m.__e(r,n.__v)}}),pe&&pe(e,t)},m.unmount=function(e){he&&he(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(r){try{O(r)}catch(_){t=_}}),n.__H=void 0,t&&m.__e(t,n.__v))};var ve=typeof requestAnimationFrame=="function";function Ge(e){var t,n=function(){clearTimeout(r),ve&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);ve&&(t=requestAnimationFrame(n))}function O(e){var t=b,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),b=t}function Y(e){var t=b;e.__c=e.__(),b=t}function Fe(e,t){return!e||e.length!==t.length||t.some(function(n,r){return n!==e[r]})}function Ke(e){const t=Te(null);function n(){const _=e.host||"https://app.documenso.com",o=btoa(JSON.stringify({name:e.name,lockName:e.lockName,email:e.email,lockEmail:e.lockEmail,css:e.css})),l=new URL(`/embed/direct/${e.token}`,_);return e.externalId&&l.searchParams.set("externalId",e.externalId),`${l}#${o}`}function r(_){var o,l,c,a,s,f;if(((o=t.current)==null?void 0:o.contentWindow)===_.source)switch(_.data.action){case"document-ready":(l=e.onDocumentReady)==null||l.call(e);break;case"document-completed":(c=e.onDocumentCompleted)==null||c.call(e,_.data.data);break;case"document-error":(a=e.onDocumentError)==null||a.call(e,_.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 j(()=>{window.addEventListener("message",r)},[]),j(()=>()=>{window.removeEventListener("message",r)},[]),Ne("iframe",{ref:t,className:e.className,src:n()})}function Qe(e){const t=Te(null);function n(){const _=e.host||"https://app.documenso.com",o=btoa(JSON.stringify({name:e.name,lockName:e.lockName,css:e.css}));return`${new URL(`/embed/sign/${e.token}`,_)}#${o}`}function r(_){var o,l,c,a;if(((o=t.current)==null?void 0:o.contentWindow)===_.source)switch(_.data.action){case"document-ready":(l=e.onDocumentReady)==null||l.call(e);break;case"document-completed":(c=e.onDocumentCompleted)==null||c.call(e,_.data.data);break;case"document-error":(a=e.onDocumentError)==null||a.call(e,_.data.data);break}}return j(()=>{window.addEventListener("message",r)},[]),j(()=>()=>{window.removeEventListener("message",r)},[]),Ne("iframe",{ref:t,className:e.className,src:n()})}He(Ke,"documenso-embed-direct-template",["token","host","externalId","css","email","lockEmail","name","lockName","onDocumentReady","onDocumentCompleted","onDocumentError"]);He(Qe,"documenso-embed-sign-document",["token","host","css","name","lockName","onDocumentReady","onDocumentCompleted","onDocumentError"]);
package/dist/index.mjs ADDED
@@ -0,0 +1,519 @@
1
+ var L, h, ye, C, re, ge, V, Z, G, K, S = {}, be = [], Ue = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, ee = Array.isArray;
2
+ function $(e, t) {
3
+ for (var n in t) e[n] = t[n];
4
+ return e;
5
+ }
6
+ function ke(e) {
7
+ var t = e.parentNode;
8
+ t && t.removeChild(e);
9
+ }
10
+ function P(e, t, n) {
11
+ var r, _, o, l = {};
12
+ for (o in t) o == "key" ? r = t[o] : o == "ref" ? _ = t[o] : l[o] = t[o];
13
+ if (arguments.length > 2 && (l.children = arguments.length > 3 ? L.call(arguments, 2) : n), 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, _, null);
15
+ }
16
+ function N(e, t, n, r, _) {
17
+ var o = { type: e, props: t, key: n, ref: r, __k: null, __: null, __b: 0, __e: null, __d: void 0, __c: null, constructor: void 0, __v: _ ?? ++ye, __i: -1, __u: 0 };
18
+ return _ == null && h.vnode != null && h.vnode(o), o;
19
+ }
20
+ function q(e) {
21
+ return e.children;
22
+ }
23
+ function M(e, t) {
24
+ this.props = e, this.context = t;
25
+ }
26
+ function x(e, t) {
27
+ if (t == null) return e.__ ? x(e.__, e.__i + 1) : null;
28
+ for (var n; t < e.__k.length; t++) if ((n = e.__k[t]) != null && n.__e != null) return n.__e;
29
+ return typeof e.type == "function" ? x(e) : null;
30
+ }
31
+ function we(e) {
32
+ var t, n;
33
+ if ((e = e.__) != null && e.__c != null) {
34
+ for (e.__e = e.__c.base = null, t = 0; t < e.__k.length; t++) if ((n = e.__k[t]) != null && n.__e != null) {
35
+ e.__e = e.__c.base = n.__e;
36
+ break;
37
+ }
38
+ return we(e);
39
+ }
40
+ }
41
+ function ie(e) {
42
+ (!e.__d && (e.__d = !0) && C.push(e) && !R.__r++ || re !== h.debounceRendering) && ((re = h.debounceRendering) || ge)(R);
43
+ }
44
+ function R() {
45
+ var e, t, n, r, _, o, l, c;
46
+ for (C.sort(V); e = C.shift(); ) e.__d && (t = C.length, r = void 0, o = (_ = (n = e).__v).__e, l = [], c = [], n.__P && ((r = $({}, _)).__v = _.__v + 1, h.vnode && h.vnode(r), te(n.__P, r, _, n.__n, n.__P.namespaceURI, 32 & _.__u ? [o] : null, l, o ?? x(_), !!(32 & _.__u), c), r.__v = _.__v, r.__.__k[r.__i] = r, Ce(l, r, c), r.__e != o && we(r)), C.length > t && C.sort(V));
47
+ R.__r = 0;
48
+ }
49
+ function $e(e, t, n, r, _, o, l, c, a, s, f) {
50
+ var i, g, u, v, k, y = r && r.__k || be, d = t.length;
51
+ for (n.__d = a, Ae(n, t, y), a = n.__d, i = 0; i < d; i++) (u = n.__k[i]) != null && typeof u != "boolean" && typeof u != "function" && (g = u.__i === -1 ? S : y[u.__i] || S, u.__i = i, te(e, u, g, _, o, l, c, a, s, f), v = u.__e, u.ref && g.ref != u.ref && (g.ref && ne(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 = Ee(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
+ n.__d = a, n.__e = k;
53
+ }
54
+ function Ae(e, t, n) {
55
+ var r, _, o, l, c, a = t.length, s = n.length, f = s, i = 0;
56
+ for (e.__k = [], r = 0; r < a; r++) l = r + i, (_ = e.__k[r] = (_ = t[r]) == null || typeof _ == "boolean" || typeof _ == "function" ? null : typeof _ == "string" || typeof _ == "number" || typeof _ == "bigint" || _.constructor == String ? N(null, _, null, null, null) : ee(_) ? N(q, { children: _ }, null, null, null) : _.constructor === void 0 && _.__b > 0 ? N(_.type, _.props, _.key, _.ref ? _.ref : null, _.__v) : _) != null ? (_.__ = e, _.__b = e.__b + 1, c = Me(_, n, l, f), _.__i = c, o = null, c !== -1 && (f--, (o = n[c]) && (o.__u |= 131072)), o == null || o.__v === null ? (c == -1 && i--, typeof _.type != "function" && (_.__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 && (_.__u |= 65536))) : (o = n[l]) && o.key == null && o.__e && !(131072 & o.__u) && (o.__e == e.__d && (e.__d = x(o)), Q(o, o, !1), n[l] = null, f--);
57
+ if (f) for (r = 0; r < s; r++) (o = n[r]) != null && !(131072 & o.__u) && (o.__e == e.__d && (e.__d = x(o)), Q(o, o));
58
+ }
59
+ function Ee(e, t, n) {
60
+ var r, _;
61
+ if (typeof e.type == "function") {
62
+ for (r = e.__k, _ = 0; r && _ < r.length; _++) r[_] && (r[_].__ = e, t = Ee(r[_], t, n));
63
+ return t;
64
+ }
65
+ e.__e != t && (t && e.type && !n.contains(t) && (t = x(e)), n.insertBefore(e.__e, t || null), t = e.__e);
66
+ do
67
+ t = t && t.nextSibling;
68
+ while (t != null && t.nodeType === 8);
69
+ return t;
70
+ }
71
+ function Me(e, t, n, r) {
72
+ var _ = e.key, o = e.type, l = n - 1, c = n + 1, a = t[n];
73
+ if (a === null || a && _ == a.key && o === a.type && !(131072 & a.__u)) return n;
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) && _ == a.key && o === a.type) return l;
77
+ l--;
78
+ }
79
+ if (c < t.length) {
80
+ if ((a = t[c]) && !(131072 & a.__u) && _ == a.key && o === a.type) return c;
81
+ c++;
82
+ }
83
+ }
84
+ return -1;
85
+ }
86
+ function le(e, t, n) {
87
+ t[0] === "-" ? e.setProperty(t, n ?? "") : e[t] = n == null ? "" : typeof n != "number" || Ue.test(t) ? n : n + "px";
88
+ }
89
+ function A(e, t, n, r, _) {
90
+ var o;
91
+ e: if (t === "style") if (typeof n == "string") e.style.cssText = n;
92
+ else {
93
+ if (typeof r == "string" && (e.style.cssText = r = ""), r) for (t in r) n && t in n || le(e.style, t, "");
94
+ if (n) for (t in n) r && n[t] === r[t] || le(e.style, t, n[t]);
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] = n, n ? r ? n.u = r.u : (n.u = Z, e.addEventListener(t, o ? K : G, o)) : e.removeEventListener(t, o ? K : G, o);
97
+ else {
98
+ if (_ == "http://www.w3.org/2000/svg") t = t.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
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 {
100
+ e[t] = n ?? "";
101
+ break e;
102
+ } catch {
103
+ }
104
+ typeof n == "function" || (n == null || n === !1 && t[4] !== "-" ? e.removeAttribute(t) : e.setAttribute(t, t == "popover" && n == 1 ? "" : n));
105
+ }
106
+ }
107
+ function ce(e) {
108
+ return function(t) {
109
+ if (this.l) {
110
+ var n = this.l[t.type + e];
111
+ if (t.t == null) t.t = Z++;
112
+ else if (t.t < n.u) return;
113
+ return n(h.event ? h.event(t) : t);
114
+ }
115
+ };
116
+ }
117
+ function te(e, t, n, r, _, o, l, c, a, s) {
118
+ var f, i, g, u, v, k, y, d, p, D, E, T, H, oe, F, z, w = t.type;
119
+ if (t.constructor !== void 0) return null;
120
+ 128 & n.__u && (a = !!(32 & n.__u), o = [c = t.__e = n.__e]), (f = h.__b) && f(t);
121
+ e: if (typeof w == "function") try {
122
+ if (d = t.props, p = "prototype" in w && w.prototype.render, D = (f = w.contextType) && r[f.__c], E = f ? D ? D.props.value : f.__ : r, n.__c ? y = (i = t.__c = n.__c).__ = i.__E : (p ? t.__c = i = new w(d, E) : (t.__c = i = new M(d, E), i.constructor = w, i.render = Re), D && D.sub(i), i.props = d, i.state || (i.state = {}), i.context = E, i.__n = r, g = i.__d = !0, i.__h = [], i._sb = []), p && i.__s == null && (i.__s = i.state), p && 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) p && w.getDerivedStateFromProps == null && i.componentWillMount != null && i.componentWillMount(), p && i.componentDidMount != null && i.__h.push(i.componentDidMount);
123
+ else {
124
+ if (p && w.getDerivedStateFromProps == null && d !== u && i.componentWillReceiveProps != null && i.componentWillReceiveProps(d, E), !i.__e && (i.shouldComponentUpdate != null && i.shouldComponentUpdate(d, i.__s, E) === !1 || t.__v === n.__v)) {
125
+ for (t.__v !== n.__v && (i.props = d, i.state = i.__s, i.__d = !1), t.__e = n.__e, t.__k = n.__k, t.__k.forEach(function(U) {
126
+ U && (U.__ = t);
127
+ }), T = 0; T < i._sb.length; T++) i.__h.push(i._sb[T]);
128
+ i._sb = [], i.__h.length && l.push(i);
129
+ break e;
130
+ }
131
+ i.componentWillUpdate != null && i.componentWillUpdate(d, i.__s, E), p && i.componentDidUpdate != null && i.__h.push(function() {
132
+ i.componentDidUpdate(u, v, k);
133
+ });
134
+ }
135
+ if (i.context = E, i.props = d, i.__P = e, i.__e = !1, H = h.__r, oe = 0, p) {
136
+ for (i.state = i.__s, i.__d = !1, H && H(t), f = i.render(i.props, i.state, i.context), F = 0; F < i._sb.length; F++) i.__h.push(i._sb[F]);
137
+ i._sb = [];
138
+ } else do
139
+ i.__d = !1, H && H(t), f = i.render(i.props, i.state, i.context), i.state = i.__s;
140
+ while (i.__d && ++oe < 25);
141
+ i.state = i.__s, i.getChildContext != null && (r = $($({}, r), i.getChildContext())), p && !g && i.getSnapshotBeforeUpdate != null && (k = i.getSnapshotBeforeUpdate(u, v)), $e(e, ee(z = f != null && f.type === q && f.key == null ? f.props.children : f) ? z : [z], t, n, r, _, o, l, c, a, s), i.base = t.__e, t.__u &= -161, i.__h.length && l.push(i), y && (i.__E = i.__ = null);
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;
146
+ } else t.__e = n.__e, t.__k = n.__k;
147
+ h.__e(U, t, n);
148
+ }
149
+ else o == null && t.__v === n.__v ? (t.__k = n.__k, t.__e = n.__e) : t.__e = Oe(n.__e, t, n, r, _, o, l, a, s);
150
+ (f = h.diffed) && f(t);
151
+ }
152
+ function Ce(e, t, n) {
153
+ t.__d = void 0;
154
+ for (var r = 0; r < n.length; r++) ne(n[r], n[++r], n[++r]);
155
+ h.__c && h.__c(t, e), e.some(function(_) {
156
+ try {
157
+ e = _.__h, _.__h = [], e.some(function(o) {
158
+ o.call(_);
159
+ });
160
+ } catch (o) {
161
+ h.__e(o, _.__v);
162
+ }
163
+ });
164
+ }
165
+ function Oe(e, t, n, r, _, o, l, c, a) {
166
+ var s, f, i, g, u, v, k, y = n.props, d = t.props, p = t.type;
167
+ if (p === "svg" ? _ = "http://www.w3.org/2000/svg" : p === "math" ? _ = "http://www.w3.org/1998/Math/MathML" : _ || (_ = "http://www.w3.org/1999/xhtml"), o != null) {
168
+ for (s = 0; s < o.length; s++) if ((u = o[s]) && "setAttribute" in u == !!p && (p ? u.localName === p : u.nodeType === 3)) {
169
+ e = u, o[s] = null;
170
+ break;
171
+ }
172
+ }
173
+ if (e == null) {
174
+ if (p === null) return document.createTextNode(d);
175
+ e = document.createElementNS(_, p, d.is && d), o = null, c = !1;
176
+ }
177
+ if (p === null) y === d || c && e.data === d || (e.data = d);
178
+ else {
179
+ if (o = o && L.call(e.childNodes), y = n.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
+ A(e, s, null, u, _);
185
+ }
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 || A(e, s, u, y[s], _);
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 = ""), $e(e, ee(g) ? g : [g], t, n, r, p === "foreignObject" ? "http://www.w3.org/1999/xhtml" : _, o, l, o ? o[0] : n.__k && x(n, 0), c, a), o != null) for (s = o.length; s--; ) o[s] != null && ke(o[s]);
190
+ c || (s = "value", v !== void 0 && (v !== e[s] || p === "progress" && !v || p === "option" && v !== y[s]) && A(e, s, v, y[s], _), s = "checked", k !== void 0 && k !== e[s] && A(e, s, k, y[s], _));
191
+ }
192
+ return e;
193
+ }
194
+ function ne(e, t, n) {
195
+ try {
196
+ if (typeof e == "function") {
197
+ var r = typeof e.__u == "function";
198
+ r && e.__u(), r && t == null || (e.__u = e(t));
199
+ } else e.current = t;
200
+ } catch (_) {
201
+ h.__e(_, n);
202
+ }
203
+ }
204
+ function Q(e, t, n) {
205
+ var r, _;
206
+ if (h.unmount && h.unmount(e), (r = e.ref) && (r.current && r.current !== e.__e || ne(r, null, t)), (r = e.__c) != null) {
207
+ if (r.componentWillUnmount) try {
208
+ r.componentWillUnmount();
209
+ } catch (o) {
210
+ h.__e(o, t);
211
+ }
212
+ r.base = r.__P = null;
213
+ }
214
+ if (r = e.__k) for (_ = 0; _ < r.length; _++) r[_] && Q(r[_], t, n || typeof e.type != "function");
215
+ n || e.__e == null || ke(e.__e), e.__c = e.__ = e.__e = e.__d = void 0;
216
+ }
217
+ function Re(e, t, n) {
218
+ return this.constructor(e, n);
219
+ }
220
+ function B(e, t, n) {
221
+ var r, _, o, l;
222
+ h.__ && h.__(e, t), _ = (r = typeof n == "function") ? null : n && n.__k || t.__k, o = [], l = [], te(t, e = (!r && n || t).__k = P(q, null, [e]), _ || S, S, t.namespaceURI, !r && n ? [n] : _ ? null : t.firstChild ? L.call(t.childNodes) : null, o, !r && n ? n : _ ? _.__e : t.firstChild, r, l), Ce(o, e, l);
223
+ }
224
+ function xe(e, t) {
225
+ B(e, t, xe);
226
+ }
227
+ function Pe(e, t, n) {
228
+ var r, _, 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" ? _ = 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 ? L.call(arguments, 2) : n), N(e.type, c, r || e.key, _ || e.ref, null);
231
+ }
232
+ L = be.slice, h = { __e: function(e, t, n, r) {
233
+ for (var _, o, l; t = t.__; ) if ((_ = t.__c) && !_.__) try {
234
+ if ((o = _.constructor) && o.getDerivedStateFromError != null && (_.setState(o.getDerivedStateFromError(e)), l = _.__d), _.componentDidCatch != null && (_.componentDidCatch(e, r || {}), l = _.__d), l) return _.__E = _;
235
+ } catch (c) {
236
+ e = c;
237
+ }
238
+ throw e;
239
+ } }, ye = 0, M.prototype.setState = function(e, t) {
240
+ var n;
241
+ n = this.__s != null && this.__s !== this.state ? this.__s : this.__s = $({}, this.state), typeof e == "function" && (e = e($({}, n), this.props)), e && $(n, e), e != null && this.__v && (t && this._sb.push(t), ie(this));
242
+ }, M.prototype.forceUpdate = function(e) {
243
+ this.__v && (this.__e = !0, e && this.__h.push(e), ie(this));
244
+ }, M.prototype.render = q, C = [], ge = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, V = function(e, t) {
245
+ return e.__v.__b - t.__v.__b;
246
+ }, R.__r = 0, Z = 0, G = ce(!1), K = ce(!0);
247
+ function _e() {
248
+ return (_e = Object.assign ? Object.assign.bind() : function(e) {
249
+ for (var t = 1; t < arguments.length; t++) {
250
+ var n = arguments[t];
251
+ for (var r in n) Object.prototype.hasOwnProperty.call(n, r) && (e[r] = n[r]);
252
+ }
253
+ return e;
254
+ }).apply(this, arguments);
255
+ }
256
+ var Ie = ["context", "children"];
257
+ function We(e) {
258
+ this.getChildContext = function() {
259
+ return e.context;
260
+ };
261
+ var t = e.children, n = function(r, _) {
262
+ if (r == null) return {};
263
+ var o, l, c = {}, a = Object.keys(r);
264
+ for (l = 0; l < a.length; l++) _.indexOf(o = a[l]) >= 0 || (c[o] = r[o]);
265
+ return c;
266
+ }(e, Ie);
267
+ return Pe(t, n);
268
+ }
269
+ function je() {
270
+ var e = new CustomEvent("_preact", { detail: {}, bubbles: !0, cancelable: !0 });
271
+ this.dispatchEvent(e), this._vdom = P(We, _e({}, this._props, { context: e.detail.context }), function t(n, r) {
272
+ if (n.nodeType === 3) return n.data;
273
+ if (n.nodeType !== 1) return null;
274
+ var _ = [], o = {}, l = 0, c = n.attributes, a = n.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] = P(se, { name: f }, s) : _[l] = s;
279
+ }
280
+ var i = r ? P(se, null, _) : _;
281
+ return P(r || n.nodeName.toLowerCase(), o, i);
282
+ }(this, this._vdomComponent)), (this.hasAttribute("hydrate") ? xe : B)(this._vdom, this._root);
283
+ }
284
+ function De(e) {
285
+ return e.replace(/-(\w)/g, function(t, n) {
286
+ return n ? n.toUpperCase() : "";
287
+ });
288
+ }
289
+ function qe(e, t, n) {
290
+ if (this._vdom) {
291
+ var r = {};
292
+ r[e] = n = n ?? void 0, r[De(e)] = n, this._vdom = Pe(this._vdom, r), B(this._vdom, this._root);
293
+ }
294
+ }
295
+ function Be() {
296
+ B(this._vdom = null, this._root);
297
+ }
298
+ function se(e, t) {
299
+ var n = this;
300
+ return P("slot", _e({}, e, { ref: function(r) {
301
+ r ? (n.ref = r, n._listener || (n._listener = function(_) {
302
+ _.stopPropagation(), _.detail.context = t;
303
+ }, r.addEventListener("_preact", n._listener))) : n.ref.removeEventListener("_preact", n._listener);
304
+ } }));
305
+ }
306
+ function He(e, t, n, r) {
307
+ function _() {
308
+ var o = Reflect.construct(HTMLElement, [], _);
309
+ return o._vdomComponent = e, o._root = o, o;
310
+ }
311
+ return (_.prototype = Object.create(HTMLElement.prototype)).constructor = _, _.prototype.connectedCallback = je, _.prototype.attributeChangedCallback = qe, _.prototype.disconnectedCallback = Be, n = n || e.observedAttributes || Object.keys(e.propTypes || {}), _.observedAttributes = n, n.forEach(function(o) {
312
+ Object.defineProperty(_.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);
318
+ } });
319
+ }), customElements.define(t || e.tagName || e.displayName || e.name, _);
320
+ }
321
+ var I;
322
+ I = { __e: function(e, t, n, r) {
323
+ for (var _, o, l; t = t.__; ) if ((_ = t.__c) && !_.__) try {
324
+ if ((o = _.constructor) && o.getDerivedStateFromError != null && (_.setState(o.getDerivedStateFromError(e)), l = _.__d), _.componentDidCatch != null && (_.componentDidCatch(e, r || {}), l = _.__d), l) return _.__E = _;
325
+ } catch (c) {
326
+ e = c;
327
+ }
328
+ throw e;
329
+ } }, typeof Promise == "function" && Promise.prototype.then.bind(Promise.resolve());
330
+ var ze = 0;
331
+ function Ne(e, t, n, r, _, o) {
332
+ t || (t = {});
333
+ var l, c, a = t;
334
+ if ("ref" in a) for (c in a = {}, t) c == "ref" ? l = t[c] : a[c] = t[c];
335
+ var s = { type: e, props: a, key: n, ref: l, __k: null, __: null, __b: 0, __e: null, __d: void 0, __c: null, constructor: void 0, __v: --ze, __i: -1, __u: 0, __source: _, __self: o };
336
+ return I.vnode && I.vnode(s), s;
337
+ }
338
+ var W, b, J, ae, X = 0, Se = [], m = I, ue = m.__b, fe = m.__r, de = m.diffed, pe = m.__c, he = m.unmount, me = m.__;
339
+ function Le(e, t) {
340
+ m.__h && m.__h(b, e, X || t), X = 0;
341
+ var n = b.__H || (b.__H = { __: [], __h: [] });
342
+ return e >= n.__.length && n.__.push({}), n.__[e];
343
+ }
344
+ function j(e, t) {
345
+ var n = Le(W++, 3);
346
+ !m.__s && Fe(n.__H, t) && (n.__ = e, n.i = t, b.__H.__h.push(n));
347
+ }
348
+ function Te(e) {
349
+ return X = 5, Je(function() {
350
+ return { current: e };
351
+ }, []);
352
+ }
353
+ function Je(e, t) {
354
+ var n = Le(W++, 7);
355
+ return Fe(n.__H, t) && (n.__ = e(), n.__H = t, n.__h = e), n.__;
356
+ }
357
+ function Ve() {
358
+ for (var e; e = Se.shift(); ) if (e.__P && e.__H) try {
359
+ e.__H.__h.forEach(O), e.__H.__h.forEach(Y), e.__H.__h = [];
360
+ } catch (t) {
361
+ e.__H.__h = [], m.__e(t, e.__v);
362
+ }
363
+ }
364
+ m.__b = function(e) {
365
+ b = null, ue && ue(e);
366
+ }, m.__ = function(e, t) {
367
+ e && t.__k && t.__k.__m && (e.__m = t.__k.__m), me && me(e, t);
368
+ }, m.__r = function(e) {
369
+ fe && fe(e), W = 0;
370
+ var t = (b = e.__c).__H;
371
+ t && (J === b ? (t.__h = [], b.__h = [], t.__.forEach(function(n) {
372
+ n.__N && (n.__ = n.__N), n.i = n.__N = void 0;
373
+ })) : (t.__h.forEach(O), t.__h.forEach(Y), t.__h = [], W = 0)), J = b;
374
+ }, m.diffed = function(e) {
375
+ de && de(e);
376
+ var t = e.__c;
377
+ t && t.__H && (t.__H.__h.length && (Se.push(t) !== 1 && ae === m.requestAnimationFrame || ((ae = m.requestAnimationFrame) || Ge)(Ve)), t.__H.__.forEach(function(n) {
378
+ n.i && (n.__H = n.i), n.i = void 0;
379
+ })), J = b = null;
380
+ }, m.__c = function(e, t) {
381
+ t.some(function(n) {
382
+ try {
383
+ n.__h.forEach(O), n.__h = n.__h.filter(function(r) {
384
+ return !r.__ || Y(r);
385
+ });
386
+ } catch (r) {
387
+ t.some(function(_) {
388
+ _.__h && (_.__h = []);
389
+ }), t = [], m.__e(r, n.__v);
390
+ }
391
+ }), pe && pe(e, t);
392
+ }, m.unmount = function(e) {
393
+ he && he(e);
394
+ var t, n = e.__c;
395
+ n && n.__H && (n.__H.__.forEach(function(r) {
396
+ try {
397
+ O(r);
398
+ } catch (_) {
399
+ t = _;
400
+ }
401
+ }), n.__H = void 0, t && m.__e(t, n.__v));
402
+ };
403
+ var ve = typeof requestAnimationFrame == "function";
404
+ function Ge(e) {
405
+ var t, n = function() {
406
+ clearTimeout(r), ve && cancelAnimationFrame(t), setTimeout(e);
407
+ }, r = setTimeout(n, 100);
408
+ ve && (t = requestAnimationFrame(n));
409
+ }
410
+ function O(e) {
411
+ var t = b, n = e.__c;
412
+ typeof n == "function" && (e.__c = void 0, n()), b = t;
413
+ }
414
+ function Y(e) {
415
+ var t = b;
416
+ e.__c = e.__(), b = t;
417
+ }
418
+ function Fe(e, t) {
419
+ return !e || e.length !== t.length || t.some(function(n, r) {
420
+ return n !== e[r];
421
+ });
422
+ }
423
+ function Ke(e) {
424
+ const t = Te(null);
425
+ function n() {
426
+ const _ = e.host || "https://app.documenso.com", o = btoa(
427
+ JSON.stringify({
428
+ name: e.name,
429
+ lockName: e.lockName,
430
+ email: e.email,
431
+ lockEmail: e.lockEmail,
432
+ css: e.css
433
+ })
434
+ ), l = new URL(`/embed/direct/${e.token}`, _);
435
+ return e.externalId && l.searchParams.set("externalId", e.externalId), `${l}#${o}`;
436
+ }
437
+ function r(_) {
438
+ var o, l, c, a, s, f;
439
+ if (((o = t.current) == null ? void 0 : o.contentWindow) === _.source)
440
+ switch (_.data.action) {
441
+ case "document-ready":
442
+ (l = e.onDocumentReady) == null || l.call(e);
443
+ break;
444
+ case "document-completed":
445
+ (c = e.onDocumentCompleted) == null || c.call(e, _.data.data);
446
+ break;
447
+ case "document-error":
448
+ (a = e.onDocumentError) == null || a.call(e, _.data.data);
449
+ break;
450
+ case "field-signed":
451
+ (s = e.onFieldSigned) == null || s.call(e);
452
+ break;
453
+ case "field-unsigned":
454
+ (f = e.onFieldUnsigned) == null || f.call(e);
455
+ break;
456
+ }
457
+ }
458
+ return j(() => {
459
+ window.addEventListener("message", r);
460
+ }, []), j(() => () => {
461
+ window.removeEventListener("message", r);
462
+ }, []), /* @__PURE__ */ Ne("iframe", { ref: t, className: e.className, src: n() });
463
+ }
464
+ function Qe(e) {
465
+ const t = Te(null);
466
+ function n() {
467
+ const _ = e.host || "https://app.documenso.com", o = btoa(
468
+ JSON.stringify({
469
+ name: e.name,
470
+ lockName: e.lockName,
471
+ css: e.css
472
+ })
473
+ );
474
+ return `${new URL(`/embed/sign/${e.token}`, _)}#${o}`;
475
+ }
476
+ function r(_) {
477
+ var o, l, c, a;
478
+ if (((o = t.current) == null ? void 0 : o.contentWindow) === _.source)
479
+ switch (_.data.action) {
480
+ case "document-ready":
481
+ (l = e.onDocumentReady) == null || l.call(e);
482
+ break;
483
+ case "document-completed":
484
+ (c = e.onDocumentCompleted) == null || c.call(e, _.data.data);
485
+ break;
486
+ case "document-error":
487
+ (a = e.onDocumentError) == null || a.call(e, _.data.data);
488
+ break;
489
+ }
490
+ }
491
+ return j(() => {
492
+ window.addEventListener("message", r);
493
+ }, []), j(() => () => {
494
+ window.removeEventListener("message", r);
495
+ }, []), /* @__PURE__ */ Ne("iframe", { ref: t, className: e.className, src: n() });
496
+ }
497
+ He(Ke, "documenso-embed-direct-template", [
498
+ "token",
499
+ "host",
500
+ "externalId",
501
+ "css",
502
+ "email",
503
+ "lockEmail",
504
+ "name",
505
+ "lockName",
506
+ "onDocumentReady",
507
+ "onDocumentCompleted",
508
+ "onDocumentError"
509
+ ]);
510
+ He(Qe, "documenso-embed-sign-document", [
511
+ "token",
512
+ "host",
513
+ "css",
514
+ "name",
515
+ "lockName",
516
+ "onDocumentReady",
517
+ "onDocumentCompleted",
518
+ "onDocumentError"
519
+ ]);
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "@documenso/embed-webcomponent",
3
+ "version": "0.0.1",
4
+ "license": "MIT",
5
+ "files": [
6
+ "dist"
7
+ ],
8
+ "types": "dist/index.d.ts",
9
+ "main": "dist/index.js",
10
+ "module": "dist/index.mjs",
11
+ "exports": {
12
+ "./package.json": "./package.json",
13
+ ".": {
14
+ "import": {
15
+ "types": "./dist/index.d.mts",
16
+ "default": "./dist/index.mjs"
17
+ },
18
+ "require": {
19
+ "types": "./dist/index.d.ts",
20
+ "default": "./dist/index.js"
21
+ }
22
+ }
23
+ },
24
+ "publishConfig": {
25
+ "access": "public"
26
+ },
27
+ "scripts": {
28
+ "build": "vite build",
29
+ "clean": "rimraf node_modules",
30
+ "check-exports": "attw --pack .",
31
+ "publint": "publint"
32
+ },
33
+ "dependencies": {
34
+ "@documenso/embed-preact": "*",
35
+ "preact": "^10.0.0",
36
+ "preact-custom-element": "^4.3.0"
37
+ },
38
+ "peerDependencies": {
39
+ "preact": "^10.0.0"
40
+ },
41
+ "devDependencies": {
42
+ "@documenso/embed": "*",
43
+ "@types/preact-custom-element": "^4.0.4",
44
+ "vite": "^5.4.2",
45
+ "vite-plugin-dts": "^4.1.0"
46
+ }
47
+ }