drill-widgets 2.7.5 → 2.7.6

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.
@@ -3156,7 +3156,7 @@ let w = class extends P {
3156
3156
  description: this._templateData.description || "",
3157
3157
  steps: this._templateData.steps || []
3158
3158
  };
3159
- console.log("💾 Builder Widget: Save button clicked"), console.log("📄 Workflow Template:", JSON.stringify(t, null, 2)), console.log("🔄 Calling onSave callback with workflow template"), (e = this.onSave) == null || e.call(this, t);
3159
+ console.log("💾 Builder Widget: Save button clicked"), console.log("📄 Workflow Template:", JSON.stringify(t, null, 2)), console.log("🔄 Calling onWorkflow updated callback with workflow template"), (e = this.onWorkflowUpdated) == null || e.call(this, t);
3160
3160
  } else
3161
3161
  console.log("⚠️ Builder Widget: Save attempted but no title provided");
3162
3162
  }
@@ -12,15 +12,15 @@
12
12
  * SPDX-License-Identifier: BSD-3-Clause
13
13
  */const H=globalThis,K=H.trustedTypes,ke=K?K.createPolicy("lit-html",{createHTML:i=>i}):void 0,$e="$lit$",F=`lit$${Math.random().toFixed(9).slice(2)}$`,De="?"+F,qe=`<${De}>`,T=document,V=()=>T.createComment(""),j=i=>i===null||typeof i!="object"&&typeof i!="function",de=Array.isArray,Ke=i=>de(i)||typeof(i==null?void 0:i[Symbol.iterator])=="function",le=`[
14
14
  \f\r]`,Q=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ce=/-->/g,Ee=/>/g,z=RegExp(`>|${le}(?:([^\\s"'>=/]+)(${le}*=${le}*(?:[^
15
- \f\r"'\`<>=]|("|')|))|$)`,"g"),Ae=/'/g,Me=/"/g,Fe=/^(?:script|style|textarea|title)$/i,Je=i=>(e,...t)=>({_$litType$:i,strings:e,values:t}),l=Je(1),I=Symbol.for("lit-noChange"),v=Symbol.for("lit-nothing"),Te=new WeakMap,U=T.createTreeWalker(T,129);function ze(i,e){if(!de(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return ke!==void 0?ke.createHTML(e):e}const Xe=(i,e)=>{const t=i.length-1,n=[];let s,r=e===2?"<svg>":e===3?"<math>":"",o=Q;for(let a=0;a<t;a++){const d=i[a];let p,c,u=-1,h=0;for(;h<d.length&&(o.lastIndex=h,c=o.exec(d),c!==null);)h=o.lastIndex,o===Q?c[1]==="!--"?o=Ce:c[1]!==void 0?o=Ee:c[2]!==void 0?(Fe.test(c[2])&&(s=RegExp("</"+c[2],"g")),o=z):c[3]!==void 0&&(o=z):o===z?c[0]===">"?(o=s??Q,u=-1):c[1]===void 0?u=-2:(u=o.lastIndex-c[2].length,p=c[1],o=c[3]===void 0?z:c[3]==='"'?Me:Ae):o===Me||o===Ae?o=z:o===Ce||o===Ee?o=Q:(o=z,s=void 0);const f=o===z&&i[a+1].startsWith("/>")?" ":"";r+=o===Q?d+qe:u>=0?(n.push(p),d.slice(0,u)+$e+d.slice(u)+F+f):d+F+(u===-2?a:f)}return[ze(i,r+(i[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]};class B{constructor({strings:e,_$litType$:t},n){let s;this.parts=[];let r=0,o=0;const a=e.length-1,d=this.parts,[p,c]=Xe(e,t);if(this.el=B.createElement(p,n),U.currentNode=this.el.content,t===2||t===3){const u=this.el.content.firstChild;u.replaceWith(...u.childNodes)}for(;(s=U.nextNode())!==null&&d.length<a;){if(s.nodeType===1){if(s.hasAttributes())for(const u of s.getAttributeNames())if(u.endsWith($e)){const h=c[o++],f=s.getAttribute(u).split(F),b=/([.?@])?(.*)/.exec(h);d.push({type:1,index:r,name:b[2],strings:f,ctor:b[1]==="."?et:b[1]==="?"?tt:b[1]==="@"?it:J}),s.removeAttribute(u)}else u.startsWith(F)&&(d.push({type:6,index:r}),s.removeAttribute(u));if(Fe.test(s.tagName)){const u=s.textContent.split(F),h=u.length-1;if(h>0){s.textContent=K?K.emptyScript:"";for(let f=0;f<h;f++)s.append(u[f],V()),U.nextNode(),d.push({type:2,index:++r});s.append(u[h],V())}}}else if(s.nodeType===8)if(s.data===De)d.push({type:2,index:r});else{let u=-1;for(;(u=s.data.indexOf(F,u+1))!==-1;)d.push({type:7,index:r}),u+=F.length-1}r++}}static createElement(e,t){const n=T.createElement("template");return n.innerHTML=e,n}}function O(i,e,t=i,n){var o,a;if(e===I)return e;let s=n!==void 0?(o=t._$Co)==null?void 0:o[n]:t._$Cl;const r=j(e)?void 0:e._$litDirective$;return(s==null?void 0:s.constructor)!==r&&((a=s==null?void 0:s._$AO)==null||a.call(s,!1),r===void 0?s=void 0:(s=new r(i),s._$AT(i,t,n)),n!==void 0?(t._$Co??(t._$Co=[]))[n]=s:t._$Cl=s),s!==void 0&&(e=O(i,s._$AS(i,e.values),s,n)),e}class Ze{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:n}=this._$AD,s=((e==null?void 0:e.creationScope)??T).importNode(t,!0);U.currentNode=s;let r=U.nextNode(),o=0,a=0,d=n[0];for(;d!==void 0;){if(o===d.index){let p;d.type===2?p=new G(r,r.nextSibling,this,e):d.type===1?p=new d.ctor(r,d.name,d.strings,this,e):d.type===6&&(p=new nt(r,this,e)),this._$AV.push(p),d=n[++a]}o!==(d==null?void 0:d.index)&&(r=U.nextNode(),o++)}return U.currentNode=T,s}p(e){let t=0;for(const n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}}class G{get _$AU(){var e;return((e=this._$AM)==null?void 0:e._$AU)??this._$Cv}constructor(e,t,n,s){this.type=2,this._$AH=v,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=s,this._$Cv=(s==null?void 0:s.isConnected)??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&(e==null?void 0:e.nodeType)===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=O(this,e,t),j(e)?e===v||e==null||e===""?(this._$AH!==v&&this._$AR(),this._$AH=v):e!==this._$AH&&e!==I&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Ke(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==v&&j(this._$AH)?this._$AA.nextSibling.data=e:this.T(T.createTextNode(e)),this._$AH=e}$(e){var r;const{values:t,_$litType$:n}=e,s=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=B.createElement(ze(n.h,n.h[0]),this.options)),n);if(((r=this._$AH)==null?void 0:r._$AD)===s)this._$AH.p(t);else{const o=new Ze(s,this),a=o.u(this.options);o.p(t),this.T(a),this._$AH=o}}_$AC(e){let t=Te.get(e.strings);return t===void 0&&Te.set(e.strings,t=new B(e)),t}k(e){de(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let n,s=0;for(const r of e)s===t.length?t.push(n=new G(this.O(V()),this.O(V()),this,this.options)):n=t[s],n._$AI(r),s++;s<t.length&&(this._$AR(n&&n._$AB.nextSibling,s),t.length=s)}_$AR(e=this._$AA.nextSibling,t){var n;for((n=this._$AP)==null?void 0:n.call(this,!1,!0,t);e&&e!==this._$AB;){const s=e.nextSibling;e.remove(),e=s}}setConnected(e){var t;this._$AM===void 0&&(this._$Cv=e,(t=this._$AP)==null||t.call(this,e))}}class J{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,s,r){this.type=1,this._$AH=v,this._$AN=void 0,this.element=e,this.name=t,this._$AM=s,this.options=r,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=v}_$AI(e,t=this,n,s){const r=this.strings;let o=!1;if(r===void 0)e=O(this,e,t,0),o=!j(e)||e!==this._$AH&&e!==I,o&&(this._$AH=e);else{const a=e;let d,p;for(e=r[0],d=0;d<r.length-1;d++)p=O(this,a[n+d],t,d),p===I&&(p=this._$AH[d]),o||(o=!j(p)||p!==this._$AH[d]),p===v?e=v:e!==v&&(e+=(p??"")+r[d+1]),this._$AH[d]=p}o&&!s&&this.j(e)}j(e){e===v?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class et extends J{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===v?void 0:e}}class tt extends J{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==v)}}class it extends J{constructor(e,t,n,s,r){super(e,t,n,s,r),this.type=5}_$AI(e,t=this){if((e=O(this,e,t,0)??v)===I)return;const n=this._$AH,s=e===v&&n!==v||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,r=e!==v&&(n===v||s);s&&this.element.removeEventListener(this.name,this,n),r&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t;typeof this._$AH=="function"?this._$AH.call(((t=this.options)==null?void 0:t.host)??this.element,e):this._$AH.handleEvent(e)}}class nt{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){O(this,e)}}const pe=H.litHtmlPolyfillSupport;pe==null||pe(B,G),(H.litHtmlVersions??(H.litHtmlVersions=[])).push("3.3.0");const st=(i,e,t)=>{const n=(t==null?void 0:t.renderBefore)??e;let s=n._$litPart$;if(s===void 0){const r=(t==null?void 0:t.renderBefore)??null;n._$litPart$=s=new G(e.insertBefore(V(),r),r,void 0,t??{})}return s._$AI(i),s};/**
15
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),Ae=/'/g,Me=/"/g,Fe=/^(?:script|style|textarea|title)$/i,Je=i=>(e,...t)=>({_$litType$:i,strings:e,values:t}),l=Je(1),U=Symbol.for("lit-noChange"),v=Symbol.for("lit-nothing"),Te=new WeakMap,I=T.createTreeWalker(T,129);function ze(i,e){if(!de(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return ke!==void 0?ke.createHTML(e):e}const Xe=(i,e)=>{const t=i.length-1,n=[];let s,r=e===2?"<svg>":e===3?"<math>":"",o=Q;for(let a=0;a<t;a++){const d=i[a];let p,c,u=-1,h=0;for(;h<d.length&&(o.lastIndex=h,c=o.exec(d),c!==null);)h=o.lastIndex,o===Q?c[1]==="!--"?o=Ce:c[1]!==void 0?o=Ee:c[2]!==void 0?(Fe.test(c[2])&&(s=RegExp("</"+c[2],"g")),o=z):c[3]!==void 0&&(o=z):o===z?c[0]===">"?(o=s??Q,u=-1):c[1]===void 0?u=-2:(u=o.lastIndex-c[2].length,p=c[1],o=c[3]===void 0?z:c[3]==='"'?Me:Ae):o===Me||o===Ae?o=z:o===Ce||o===Ee?o=Q:(o=z,s=void 0);const f=o===z&&i[a+1].startsWith("/>")?" ":"";r+=o===Q?d+qe:u>=0?(n.push(p),d.slice(0,u)+$e+d.slice(u)+F+f):d+F+(u===-2?a:f)}return[ze(i,r+(i[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]};class B{constructor({strings:e,_$litType$:t},n){let s;this.parts=[];let r=0,o=0;const a=e.length-1,d=this.parts,[p,c]=Xe(e,t);if(this.el=B.createElement(p,n),I.currentNode=this.el.content,t===2||t===3){const u=this.el.content.firstChild;u.replaceWith(...u.childNodes)}for(;(s=I.nextNode())!==null&&d.length<a;){if(s.nodeType===1){if(s.hasAttributes())for(const u of s.getAttributeNames())if(u.endsWith($e)){const h=c[o++],f=s.getAttribute(u).split(F),b=/([.?@])?(.*)/.exec(h);d.push({type:1,index:r,name:b[2],strings:f,ctor:b[1]==="."?et:b[1]==="?"?tt:b[1]==="@"?it:J}),s.removeAttribute(u)}else u.startsWith(F)&&(d.push({type:6,index:r}),s.removeAttribute(u));if(Fe.test(s.tagName)){const u=s.textContent.split(F),h=u.length-1;if(h>0){s.textContent=K?K.emptyScript:"";for(let f=0;f<h;f++)s.append(u[f],V()),I.nextNode(),d.push({type:2,index:++r});s.append(u[h],V())}}}else if(s.nodeType===8)if(s.data===De)d.push({type:2,index:r});else{let u=-1;for(;(u=s.data.indexOf(F,u+1))!==-1;)d.push({type:7,index:r}),u+=F.length-1}r++}}static createElement(e,t){const n=T.createElement("template");return n.innerHTML=e,n}}function O(i,e,t=i,n){var o,a;if(e===U)return e;let s=n!==void 0?(o=t._$Co)==null?void 0:o[n]:t._$Cl;const r=j(e)?void 0:e._$litDirective$;return(s==null?void 0:s.constructor)!==r&&((a=s==null?void 0:s._$AO)==null||a.call(s,!1),r===void 0?s=void 0:(s=new r(i),s._$AT(i,t,n)),n!==void 0?(t._$Co??(t._$Co=[]))[n]=s:t._$Cl=s),s!==void 0&&(e=O(i,s._$AS(i,e.values),s,n)),e}class Ze{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:n}=this._$AD,s=((e==null?void 0:e.creationScope)??T).importNode(t,!0);I.currentNode=s;let r=I.nextNode(),o=0,a=0,d=n[0];for(;d!==void 0;){if(o===d.index){let p;d.type===2?p=new G(r,r.nextSibling,this,e):d.type===1?p=new d.ctor(r,d.name,d.strings,this,e):d.type===6&&(p=new nt(r,this,e)),this._$AV.push(p),d=n[++a]}o!==(d==null?void 0:d.index)&&(r=I.nextNode(),o++)}return I.currentNode=T,s}p(e){let t=0;for(const n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}}class G{get _$AU(){var e;return((e=this._$AM)==null?void 0:e._$AU)??this._$Cv}constructor(e,t,n,s){this.type=2,this._$AH=v,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=s,this._$Cv=(s==null?void 0:s.isConnected)??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&(e==null?void 0:e.nodeType)===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=O(this,e,t),j(e)?e===v||e==null||e===""?(this._$AH!==v&&this._$AR(),this._$AH=v):e!==this._$AH&&e!==U&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Ke(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==v&&j(this._$AH)?this._$AA.nextSibling.data=e:this.T(T.createTextNode(e)),this._$AH=e}$(e){var r;const{values:t,_$litType$:n}=e,s=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=B.createElement(ze(n.h,n.h[0]),this.options)),n);if(((r=this._$AH)==null?void 0:r._$AD)===s)this._$AH.p(t);else{const o=new Ze(s,this),a=o.u(this.options);o.p(t),this.T(a),this._$AH=o}}_$AC(e){let t=Te.get(e.strings);return t===void 0&&Te.set(e.strings,t=new B(e)),t}k(e){de(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let n,s=0;for(const r of e)s===t.length?t.push(n=new G(this.O(V()),this.O(V()),this,this.options)):n=t[s],n._$AI(r),s++;s<t.length&&(this._$AR(n&&n._$AB.nextSibling,s),t.length=s)}_$AR(e=this._$AA.nextSibling,t){var n;for((n=this._$AP)==null?void 0:n.call(this,!1,!0,t);e&&e!==this._$AB;){const s=e.nextSibling;e.remove(),e=s}}setConnected(e){var t;this._$AM===void 0&&(this._$Cv=e,(t=this._$AP)==null||t.call(this,e))}}class J{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,s,r){this.type=1,this._$AH=v,this._$AN=void 0,this.element=e,this.name=t,this._$AM=s,this.options=r,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=v}_$AI(e,t=this,n,s){const r=this.strings;let o=!1;if(r===void 0)e=O(this,e,t,0),o=!j(e)||e!==this._$AH&&e!==U,o&&(this._$AH=e);else{const a=e;let d,p;for(e=r[0],d=0;d<r.length-1;d++)p=O(this,a[n+d],t,d),p===U&&(p=this._$AH[d]),o||(o=!j(p)||p!==this._$AH[d]),p===v?e=v:e!==v&&(e+=(p??"")+r[d+1]),this._$AH[d]=p}o&&!s&&this.j(e)}j(e){e===v?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class et extends J{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===v?void 0:e}}class tt extends J{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==v)}}class it extends J{constructor(e,t,n,s,r){super(e,t,n,s,r),this.type=5}_$AI(e,t=this){if((e=O(this,e,t,0)??v)===U)return;const n=this._$AH,s=e===v&&n!==v||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,r=e!==v&&(n===v||s);s&&this.element.removeEventListener(this.name,this,n),r&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t;typeof this._$AH=="function"?this._$AH.call(((t=this.options)==null?void 0:t.host)??this.element,e):this._$AH.handleEvent(e)}}class nt{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){O(this,e)}}const pe=H.litHtmlPolyfillSupport;pe==null||pe(B,G),(H.litHtmlVersions??(H.litHtmlVersions=[])).push("3.3.0");const st=(i,e,t)=>{const n=(t==null?void 0:t.renderBefore)??e;let s=n._$litPart$;if(s===void 0){const r=(t==null?void 0:t.renderBefore)??null;n._$litPart$=s=new G(e.insertBefore(V(),r),r,void 0,t??{})}return s._$AI(i),s};/**
16
16
  * @license
17
17
  * Copyright 2017 Google LLC
18
18
  * SPDX-License-Identifier: BSD-3-Clause
19
- */const P=globalThis;let R=class extends N{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t;const e=super.createRenderRoot();return(t=this.renderOptions).renderBefore??(t.renderBefore=e.firstChild),e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=st(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),(e=this._$Do)==null||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._$Do)==null||e.setConnected(!1)}render(){return I}};R._$litElement$=!0,R.finalized=!0,(Oe=P.litElementHydrateSupport)==null||Oe.call(P,{LitElement:R});const ce=P.litElementPolyfillSupport;ce==null||ce({LitElement:R}),(P.litElementVersions??(P.litElementVersions=[])).push("4.2.0");/**
19
+ */const P=globalThis;let R=class extends N{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t;const e=super.createRenderRoot();return(t=this.renderOptions).renderBefore??(t.renderBefore=e.firstChild),e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=st(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),(e=this._$Do)==null||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._$Do)==null||e.setConnected(!1)}render(){return U}};R._$litElement$=!0,R.finalized=!0,(Oe=P.litElementHydrateSupport)==null||Oe.call(P,{LitElement:R});const ce=P.litElementPolyfillSupport;ce==null||ce({LitElement:R}),(P.litElementVersions??(P.litElementVersions=[])).push("4.2.0");/**
20
20
  * @license
21
21
  * Copyright 2017 Google LLC
22
22
  * SPDX-License-Identifier: BSD-3-Clause
23
- */const Ie=i=>(e,t)=>{t!==void 0?t.addInitializer(()=>{customElements.define(i,e)}):customElements.define(i,e)};/**
23
+ */const Ue=i=>(e,t)=>{t!==void 0?t.addInitializer(()=>{customElements.define(i,e)}):customElements.define(i,e)};/**
24
24
  * @license
25
25
  * Copyright 2017 Google LLC
26
26
  * SPDX-License-Identifier: BSD-3-Clause
@@ -28,7 +28,7 @@
28
28
  * @license
29
29
  * Copyright 2017 Google LLC
30
30
  * SPDX-License-Identifier: BSD-3-Clause
31
- */function _(i){return C({...i,state:!0,attribute:!1})}const S=[];for(let i=0;i<256;++i)S.push((i+256).toString(16).slice(1));function at(i,e=0){return(S[i[e+0]]+S[i[e+1]]+S[i[e+2]]+S[i[e+3]]+"-"+S[i[e+4]]+S[i[e+5]]+"-"+S[i[e+6]]+S[i[e+7]]+"-"+S[i[e+8]]+S[i[e+9]]+"-"+S[i[e+10]]+S[i[e+11]]+S[i[e+12]]+S[i[e+13]]+S[i[e+14]]+S[i[e+15]]).toLowerCase()}let ue;const dt=new Uint8Array(16);function lt(){if(!ue){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");ue=crypto.getRandomValues.bind(crypto)}return ue(dt)}const Ue={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function he(i,e,t){var s;if(Ue.randomUUID&&!i)return Ue.randomUUID();i=i||{};const n=i.random??((s=i.rng)==null?void 0:s.call(i))??lt();if(n.length<16)throw new Error("Random bytes length must be >= 16");return n[6]=n[6]&15|64,n[8]=n[8]&63|128,at(n)}const pt=L`
31
+ */function _(i){return C({...i,state:!0,attribute:!1})}const S=[];for(let i=0;i<256;++i)S.push((i+256).toString(16).slice(1));function at(i,e=0){return(S[i[e+0]]+S[i[e+1]]+S[i[e+2]]+S[i[e+3]]+"-"+S[i[e+4]]+S[i[e+5]]+"-"+S[i[e+6]]+S[i[e+7]]+"-"+S[i[e+8]]+S[i[e+9]]+"-"+S[i[e+10]]+S[i[e+11]]+S[i[e+12]]+S[i[e+13]]+S[i[e+14]]+S[i[e+15]]).toLowerCase()}let ue;const dt=new Uint8Array(16);function lt(){if(!ue){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");ue=crypto.getRandomValues.bind(crypto)}return ue(dt)}const Ie={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function he(i,e,t){var s;if(Ie.randomUUID&&!i)return Ie.randomUUID();i=i||{};const n=i.random??((s=i.rng)==null?void 0:s.call(i))??lt();if(n.length<16)throw new Error("Random bytes length must be >= 16");return n[6]=n[6]&15|64,n[8]=n[8]&63|128,at(n)}const pt=L`
32
32
  :host {
33
33
  display: block;
34
34
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
@@ -2491,7 +2491,7 @@
2491
2491
  .modal-create-button:hover {
2492
2492
  background-color: #2563eb;
2493
2493
  }
2494
- `;var gt=Object.defineProperty,ft=Object.getOwnPropertyDescriptor,E=(i,e,t,n)=>{for(var s=n>1?void 0:n?ft(e,t):e,r=i.length-1,o;r>=0;r--)(o=i[r])&&(s=(n?o(e,t,s):o(s))||s);return n&&s&&gt(e,t,s),s};let w=class extends R{constructor(){super(...arguments),this._templateData={name:"",description:"",steps:[]},this._showStepModal=!1,this._stepFormData={title:"",description:""},this._draggedStepId=null,this._dragOverStepId=null,this._selectedStepId=null,this._questions=[]}connectedCallback(){super.connectedCallback(),this._templateData=this._getDefaultWorkflowData()}_getDefaultWorkflowData(){const i={id:"step-1",title:"Step 1",description:"",order:1,assignment:{category:"individual",type:"subject"},elements:[],status:"pending"};return{id:he(),name:"",description:"",steps:[i]}}_handleTitleChange(i){const e=i.target;this._templateData={...this._templateData,name:e.value}}_handleDescriptionChange(i){const e=i.target;this._templateData={...this._templateData,description:e.value}}_handleCancel(){var i;console.log("🚫 Builder Widget: Cancel button clicked"),(i=this.onCancel)==null||i.call(this)}_handleSave(){var i,e;if((i=this._templateData.name)!=null&&i.trim()){const t={id:this._templateData.id||he(),name:this._templateData.name,description:this._templateData.description||"",steps:this._templateData.steps||[]};console.log("💾 Builder Widget: Save button clicked"),console.log("📄 Workflow Template:",JSON.stringify(t,null,2)),console.log("🔄 Calling onSave callback with workflow template"),(e=this.onSave)==null||e.call(this,t)}else console.log("⚠️ Builder Widget: Save attempted but no title provided")}_addStep(){console.log("🔹 Opening step creation modal"),this._stepFormData={title:"",description:""},this._showStepModal=!0}_closeStepModal(){console.log("🔹 Closing step creation modal"),this._showStepModal=!1,this._stepFormData={title:"",description:""}}_handleStepFormInput(i){const e=i.target,{name:t,value:n}=e;this._stepFormData={...this._stepFormData,[t]:n}}_createStep(){var t,n;if(!((t=this._stepFormData.title)!=null&&t.trim())){console.log("⚠️ Step title is required");return}const i=this._templateData.steps||[],e={id:he(),title:this._stepFormData.title.trim(),description:((n=this._stepFormData.description)==null?void 0:n.trim())||"",order:i.length+1,assignment:{category:"individual",type:"subject"},elements:[],status:"pending"};this._templateData={...this._templateData,steps:[...i,e]},this._selectedStepId=e.id,console.log("✅ Step created and selected:",e),this._closeStepModal()}_selectStep(i){this._selectedStepId=i,console.log("🎯 Step selected:",i)}_getSelectedStep(){return!this._selectedStepId||!this._templateData.steps?null:this._templateData.steps.find(i=>i.id===this._selectedStepId)||null}_handleDragStart(i,e){this._draggedStepId=e,i.dataTransfer&&(i.dataTransfer.effectAllowed="move",i.dataTransfer.setData("text/plain",e)),console.log("🔄 Drag started for step:",e)}_handleDragEnd(i){this._draggedStepId=null,this._dragOverStepId=null,console.log("🔄 Drag ended")}_handleDragOver(i,e){i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect="move"),this._dragOverStepId!==e&&(this._dragOverStepId=e)}_handleDragLeave(i){const e=i.relatedTarget;i.currentTarget.contains(e)||(this._dragOverStepId=null)}_handleDrop(i,e){if(i.preventDefault(),!this._draggedStepId||this._draggedStepId===e){this._draggedStepId=null,this._dragOverStepId=null;return}const t=this._templateData.steps||[],n=t.findIndex(a=>a.id===this._draggedStepId),s=t.findIndex(a=>a.id===e);if(n===-1||s===-1){console.error("Could not find step indices for reordering");return}console.log("🔄 Before reorder:",t.map((a,d)=>`${d+1}: ${a.title}`));const r=[...t],[o]=r.splice(n,1);r.splice(s,0,o),r.forEach((a,d)=>{a.order=d+1}),console.log("🔄 After reorder:",r.map((a,d)=>`${d+1}: ${a.title}`)),this._templateData={...this._templateData,steps:r},console.log("📝 Template updated with new step order"),this._draggedStepId=null,this._dragOverStepId=null}_addQuestion(i="text_input"){var n,s;if(!this._templateData.steps||this._templateData.steps.length===0||!this._selectedStepId){console.log("⚠️ Cannot add questions without steps or selected step");return}const e=this._getSelectedStep();if(!e){console.log("⚠️ No step selected");return}if(["text","html","divider","markdown"].includes(i)){let r={id:`c-${Date.now()}`,type:i,order:(((n=e.elements)==null?void 0:n.length)||0)+1};switch(i){case"text":r.content="Enter your text content here...";break;case"html":r.content="<p>Enter your HTML content here...</p>";break;case"divider":r.content="",r.caption="Section Divider";break;case"markdown":r.content=`## Enter your markdown content here...
2494
+ `;var gt=Object.defineProperty,ft=Object.getOwnPropertyDescriptor,E=(i,e,t,n)=>{for(var s=n>1?void 0:n?ft(e,t):e,r=i.length-1,o;r>=0;r--)(o=i[r])&&(s=(n?o(e,t,s):o(s))||s);return n&&s&&gt(e,t,s),s};let w=class extends R{constructor(){super(...arguments),this._templateData={name:"",description:"",steps:[]},this._showStepModal=!1,this._stepFormData={title:"",description:""},this._draggedStepId=null,this._dragOverStepId=null,this._selectedStepId=null,this._questions=[]}connectedCallback(){super.connectedCallback(),this._templateData=this._getDefaultWorkflowData()}_getDefaultWorkflowData(){const i={id:"step-1",title:"Step 1",description:"",order:1,assignment:{category:"individual",type:"subject"},elements:[],status:"pending"};return{id:he(),name:"",description:"",steps:[i]}}_handleTitleChange(i){const e=i.target;this._templateData={...this._templateData,name:e.value}}_handleDescriptionChange(i){const e=i.target;this._templateData={...this._templateData,description:e.value}}_handleCancel(){var i;console.log("🚫 Builder Widget: Cancel button clicked"),(i=this.onCancel)==null||i.call(this)}_handleSave(){var i,e;if((i=this._templateData.name)!=null&&i.trim()){const t={id:this._templateData.id||he(),name:this._templateData.name,description:this._templateData.description||"",steps:this._templateData.steps||[]};console.log("💾 Builder Widget: Save button clicked"),console.log("📄 Workflow Template:",JSON.stringify(t,null,2)),console.log("🔄 Calling onWorkflow updated callback with workflow template"),(e=this.onWorkflowUpdated)==null||e.call(this,t)}else console.log("⚠️ Builder Widget: Save attempted but no title provided")}_addStep(){console.log("🔹 Opening step creation modal"),this._stepFormData={title:"",description:""},this._showStepModal=!0}_closeStepModal(){console.log("🔹 Closing step creation modal"),this._showStepModal=!1,this._stepFormData={title:"",description:""}}_handleStepFormInput(i){const e=i.target,{name:t,value:n}=e;this._stepFormData={...this._stepFormData,[t]:n}}_createStep(){var t,n;if(!((t=this._stepFormData.title)!=null&&t.trim())){console.log("⚠️ Step title is required");return}const i=this._templateData.steps||[],e={id:he(),title:this._stepFormData.title.trim(),description:((n=this._stepFormData.description)==null?void 0:n.trim())||"",order:i.length+1,assignment:{category:"individual",type:"subject"},elements:[],status:"pending"};this._templateData={...this._templateData,steps:[...i,e]},this._selectedStepId=e.id,console.log("✅ Step created and selected:",e),this._closeStepModal()}_selectStep(i){this._selectedStepId=i,console.log("🎯 Step selected:",i)}_getSelectedStep(){return!this._selectedStepId||!this._templateData.steps?null:this._templateData.steps.find(i=>i.id===this._selectedStepId)||null}_handleDragStart(i,e){this._draggedStepId=e,i.dataTransfer&&(i.dataTransfer.effectAllowed="move",i.dataTransfer.setData("text/plain",e)),console.log("🔄 Drag started for step:",e)}_handleDragEnd(i){this._draggedStepId=null,this._dragOverStepId=null,console.log("🔄 Drag ended")}_handleDragOver(i,e){i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect="move"),this._dragOverStepId!==e&&(this._dragOverStepId=e)}_handleDragLeave(i){const e=i.relatedTarget;i.currentTarget.contains(e)||(this._dragOverStepId=null)}_handleDrop(i,e){if(i.preventDefault(),!this._draggedStepId||this._draggedStepId===e){this._draggedStepId=null,this._dragOverStepId=null;return}const t=this._templateData.steps||[],n=t.findIndex(a=>a.id===this._draggedStepId),s=t.findIndex(a=>a.id===e);if(n===-1||s===-1){console.error("Could not find step indices for reordering");return}console.log("🔄 Before reorder:",t.map((a,d)=>`${d+1}: ${a.title}`));const r=[...t],[o]=r.splice(n,1);r.splice(s,0,o),r.forEach((a,d)=>{a.order=d+1}),console.log("🔄 After reorder:",r.map((a,d)=>`${d+1}: ${a.title}`)),this._templateData={...this._templateData,steps:r},console.log("📝 Template updated with new step order"),this._draggedStepId=null,this._dragOverStepId=null}_addQuestion(i="text_input"){var n,s;if(!this._templateData.steps||this._templateData.steps.length===0||!this._selectedStepId){console.log("⚠️ Cannot add questions without steps or selected step");return}const e=this._getSelectedStep();if(!e){console.log("⚠️ No step selected");return}if(["text","html","divider","markdown"].includes(i)){let r={id:`c-${Date.now()}`,type:i,order:(((n=e.elements)==null?void 0:n.length)||0)+1};switch(i){case"text":r.content="Enter your text content here...";break;case"html":r.content="<p>Enter your HTML content here...</p>";break;case"divider":r.content="",r.caption="Section Divider";break;case"markdown":r.content=`## Enter your markdown content here...
2495
2495
 
2496
2496
  Use **bold** and *italic* text.`;break}const o=this._templateData.steps.map(a=>a.id===this._selectedStepId?{...a,elements:[...a.elements||[],r]}:a);this._templateData={...this._templateData,steps:o},console.log("✅ Content element added to step:",this._selectedStepId)}else{const r={id:`q-${Date.now()}`,type:i,label:this._getQuestionTypeDisplayName(i),order:(((s=e.elements)==null?void 0:s.length)||0)+1,required:!1};["select","radio","checkbox"].includes(i)&&(r.options=["Option 1","Option 2"]);const o=this._templateData.steps.map(a=>a.id===this._selectedStepId?{...a,elements:[...a.elements||[],r]}:a);this._templateData={...this._templateData,steps:o},console.log("✅ Question added to step:",this._selectedStepId)}}_addContentElement(i){var s;if(!this._templateData.steps||this._templateData.steps.length===0||!this._selectedStepId){console.log("⚠️ Cannot add content without steps or selected step");return}const e=this._getSelectedStep();if(!e){console.log("⚠️ No step selected");return}let t={id:`c-${Date.now()}`,type:i,order:(((s=e.elements)==null?void 0:s.length)||0)+1};switch(i){case"text":t.content="Enter your text content here...";break;case"html":t.content="<p>Enter your HTML content here...</p>";break;case"image":t.content="",t.url="",t.alt="",t.caption="";break;case"video":t.content="",t.url="",t.caption="";break;case"file":t.content="",t.url="",t.caption="";break;case"divider":t.content="",t.caption="Section Divider";break;case"markdown":t.content=`## Enter your markdown content here...
2497
2497
 
@@ -2965,7 +2965,7 @@ Use **bold** and *italic* text.`;break}const n=this._templateData.steps.map(r=>r
2965
2965
  ${ut}
2966
2966
  ${Pe}
2967
2967
  ${ht}
2968
- `,E([_()],w.prototype,"_templateData",2),E([_()],w.prototype,"_showStepModal",2),E([_()],w.prototype,"_stepFormData",2),E([_()],w.prototype,"_draggedStepId",2),E([_()],w.prototype,"_dragOverStepId",2),E([_()],w.prototype,"_selectedStepId",2),E([_()],w.prototype,"_questions",2),E([C({attribute:!1})],w.prototype,"onCancel",2),E([C({attribute:!1})],w.prototype,"onSave",2),w=E([Ie("builder-widget")],w);class mt{constructor(e,t){this.signaturePads=e,this.savedSignatures=t}validateStep(e,t,n){if(n==="preview")return{isValid:!0,errors:{}};if(!e)return{isValid:!1,errors:{}};let s=!0;const r={};for(const o of e.elements)if(this.isQuestionElement(o)){const a=o;if(a.required){const d=this.validateQuestion(a,t[a.id]);d&&(s=!1,r[a.id]=d.message)}}return{isValid:s,errors:r}}validateQuestion(e,t){switch(e.type){case"checkbox":return this.validateCheckbox(e,t);case"signature":return this.validateSignature(e,t);case"file_upload":return this.validateFileUpload(e,t);default:return this.validateBasicField(e,t)}}validateCheckbox(e,t){if(e.options&&e.options.length>0){if(!Array.isArray(t)||t.length===0)return{questionId:e.id,message:`${e.label} is required.`}}else if(t!==!0)return{questionId:e.id,message:`${e.label} is required.`};return null}validateSignature(e,t){const n=this.signaturePads.get(e.id);return!n||n.isEmpty()?{questionId:e.id,message:`${e.label} is required.`}:this.savedSignatures.has(e.id)?null:{questionId:e.id,message:`Please save your ${e.label} before continuing.`}}validateFileUpload(e,t){return!t||t===null||t===void 0?{questionId:e.id,message:`${e.label} is required.`}:null}validateBasicField(e,t){return t==null||t===""?{questionId:e.id,message:`${e.label} is required.`}:null}isQuestionElement(e){return["text_input","textarea","select","number","radio","checkbox","date","file_upload","signature"].includes(e.type)}}class bt{getStorageKey(e){return`runner-form-data-${e||"default"}`}saveFormData(e,t,n,s,r,o){var c,u,h;const a=this.getStorageKey(e),d=o?{...o,currentStepId:(u=(c=o.steps)==null?void 0:c[n])==null?void 0:u.id,completedSteps:Array.from(r),updatedAt:new Date,steps:(h=o.steps)==null?void 0:h.map(f=>({...f,responses:f.responses||[]}))}:null,p={formData:t,timestamp:new Date().toISOString(),stepIndex:n,savedSignatures:Array.from(s),completedSteps:Array.from(r),instance:d};try{localStorage.setItem(a,JSON.stringify(p))}catch(f){console.warn("Failed to save form data to localStorage:",f)}}restoreFormData(e){const t=this.getStorageKey(e);try{const n=localStorage.getItem(t);if(!n)return null;const s=JSON.parse(n);return{formData:s.formData||{},stepIndex:s.stepIndex||0,savedSignatures:new Set(s.savedSignatures||[]),completedSteps:new Set(s.completedSteps||[]),savedInstance:s.instance||null}}catch(n){return console.warn("Failed to restore form data from localStorage:",n),null}}clearFormData(e,t="completed workflow"){const n=this.getStorageKey(e);try{localStorage.removeItem(n),console.log(`Cleared saved form data for ${t}`)}catch(s){console.warn("Failed to clear saved form data:",s)}}shouldRestoreData(e){return e==="default"}}/*!
2968
+ `,E([_()],w.prototype,"_templateData",2),E([_()],w.prototype,"_showStepModal",2),E([_()],w.prototype,"_stepFormData",2),E([_()],w.prototype,"_draggedStepId",2),E([_()],w.prototype,"_dragOverStepId",2),E([_()],w.prototype,"_selectedStepId",2),E([_()],w.prototype,"_questions",2),E([C({attribute:!1})],w.prototype,"onCancel",2),E([C({attribute:!1})],w.prototype,"onSave",2),w=E([Ue("builder-widget")],w);class mt{constructor(e,t){this.signaturePads=e,this.savedSignatures=t}validateStep(e,t,n){if(n==="preview")return{isValid:!0,errors:{}};if(!e)return{isValid:!1,errors:{}};let s=!0;const r={};for(const o of e.elements)if(this.isQuestionElement(o)){const a=o;if(a.required){const d=this.validateQuestion(a,t[a.id]);d&&(s=!1,r[a.id]=d.message)}}return{isValid:s,errors:r}}validateQuestion(e,t){switch(e.type){case"checkbox":return this.validateCheckbox(e,t);case"signature":return this.validateSignature(e,t);case"file_upload":return this.validateFileUpload(e,t);default:return this.validateBasicField(e,t)}}validateCheckbox(e,t){if(e.options&&e.options.length>0){if(!Array.isArray(t)||t.length===0)return{questionId:e.id,message:`${e.label} is required.`}}else if(t!==!0)return{questionId:e.id,message:`${e.label} is required.`};return null}validateSignature(e,t){const n=this.signaturePads.get(e.id);return!n||n.isEmpty()?{questionId:e.id,message:`${e.label} is required.`}:this.savedSignatures.has(e.id)?null:{questionId:e.id,message:`Please save your ${e.label} before continuing.`}}validateFileUpload(e,t){return!t||t===null||t===void 0?{questionId:e.id,message:`${e.label} is required.`}:null}validateBasicField(e,t){return t==null||t===""?{questionId:e.id,message:`${e.label} is required.`}:null}isQuestionElement(e){return["text_input","textarea","select","number","radio","checkbox","date","file_upload","signature"].includes(e.type)}}class bt{getStorageKey(e){return`runner-form-data-${e||"default"}`}saveFormData(e,t,n,s,r,o){var c,u,h;const a=this.getStorageKey(e),d=o?{...o,currentStepId:(u=(c=o.steps)==null?void 0:c[n])==null?void 0:u.id,completedSteps:Array.from(r),updatedAt:new Date,steps:(h=o.steps)==null?void 0:h.map(f=>({...f,responses:f.responses||[]}))}:null,p={formData:t,timestamp:new Date().toISOString(),stepIndex:n,savedSignatures:Array.from(s),completedSteps:Array.from(r),instance:d};try{localStorage.setItem(a,JSON.stringify(p))}catch(f){console.warn("Failed to save form data to localStorage:",f)}}restoreFormData(e){const t=this.getStorageKey(e);try{const n=localStorage.getItem(t);if(!n)return null;const s=JSON.parse(n);return{formData:s.formData||{},stepIndex:s.stepIndex||0,savedSignatures:new Set(s.savedSignatures||[]),completedSteps:new Set(s.completedSteps||[]),savedInstance:s.instance||null}}catch(n){return console.warn("Failed to restore form data from localStorage:",n),null}}clearFormData(e,t="completed workflow"){const n=this.getStorageKey(e);try{localStorage.removeItem(n),console.log(`Cleared saved form data for ${t}`)}catch(s){console.warn("Failed to clear saved form data:",s)}}shouldRestoreData(e){return e==="default"}}/*!
2969
2969
  * Signature Pad v5.0.10 | https://github.com/szimek/signature_pad
2970
2970
  * (c) 2025 Szymon Nowak | Released under the MIT license
2971
2971
  */class X{constructor(e,t,n,s){if(isNaN(e)||isNaN(t))throw new Error(`Point is invalid: (${e}, ${t})`);this.x=+e,this.y=+t,this.pressure=n||0,this.time=s||Date.now()}distanceTo(e){return Math.sqrt(Math.pow(this.x-e.x,2)+Math.pow(this.y-e.y,2))}equals(e){return this.x===e.x&&this.y===e.y&&this.pressure===e.pressure&&this.time===e.time}velocityFrom(e){return this.time!==e.time?this.distanceTo(e)/(this.time-e.time):0}}class ge{static fromPoints(e,t){const n=this.calculateControlPoints(e[0],e[1],e[2]).c2,s=this.calculateControlPoints(e[1],e[2],e[3]).c1;return new ge(e[1],n,s,e[2],t.start,t.end)}static calculateControlPoints(e,t,n){const s=e.x-t.x,r=e.y-t.y,o=t.x-n.x,a=t.y-n.y,d={x:(e.x+t.x)/2,y:(e.y+t.y)/2},p={x:(t.x+n.x)/2,y:(t.y+n.y)/2},c=Math.sqrt(s*s+r*r),u=Math.sqrt(o*o+a*a),h=d.x-p.x,f=d.y-p.y,b=c+u==0?0:u/(c+u),$={x:p.x+h*b,y:p.y+f*b},ie=t.x-$.x,ne=t.y-$.y;return{c1:new X(d.x+ie,d.y+ne),c2:new X(p.x+ie,p.y+ne)}}constructor(e,t,n,s,r,o){this.startPoint=e,this.control2=t,this.control1=n,this.endPoint=s,this.startWidth=r,this.endWidth=o}length(){let t=0,n,s;for(let r=0;r<=10;r+=1){const o=r/10,a=this.point(o,this.startPoint.x,this.control1.x,this.control2.x,this.endPoint.x),d=this.point(o,this.startPoint.y,this.control1.y,this.control2.y,this.endPoint.y);if(r>0){const p=a-n,c=d-s;t+=Math.sqrt(p*p+c*c)}n=a,s=d}return t}point(e,t,n,s,r){return t*(1-e)*(1-e)*(1-e)+3*n*(1-e)*(1-e)*e+3*s*(1-e)*e*e+r*e*e*e}}class vt{constructor(){try{this._et=new EventTarget}catch{this._et=document}}addEventListener(e,t,n){this._et.addEventListener(e,t,n)}dispatchEvent(e){return this._et.dispatchEvent(e)}removeEventListener(e,t,n){this._et.removeEventListener(e,t,n)}}function xt(i,e=250){let t=0,n=null,s,r,o;const a=()=>{t=Date.now(),n=null,s=i.apply(r,o),n||(r=null,o=[])};return function(...p){const c=Date.now(),u=e-(c-t);return r=this,o=p,u<=0||u>e?(n&&(clearTimeout(n),n=null),t=c,s=i.apply(r,o),n||(r=null,o=[])):n||(n=window.setTimeout(a,u)),s}}class Z extends vt{constructor(e,t={}){var n,s,r;super(),this.canvas=e,this._drawingStroke=!1,this._isEmpty=!0,this._lastPoints=[],this._data=[],this._lastVelocity=0,this._lastWidth=0,this.velocityFilterWeight=t.velocityFilterWeight||.7,this.minWidth=t.minWidth||.5,this.maxWidth=t.maxWidth||2.5,this.throttle=(n=t.throttle)!==null&&n!==void 0?n:16,this.minDistance=(s=t.minDistance)!==null&&s!==void 0?s:5,this.dotSize=t.dotSize||0,this.penColor=t.penColor||"black",this.backgroundColor=t.backgroundColor||"rgba(0,0,0,0)",this.compositeOperation=t.compositeOperation||"source-over",this.canvasContextOptions=(r=t.canvasContextOptions)!==null&&r!==void 0?r:{},this._strokeMoveUpdate=this.throttle?xt(Z.prototype._strokeUpdate,this.throttle):Z.prototype._strokeUpdate,this._handleMouseDown=this._handleMouseDown.bind(this),this._handleMouseMove=this._handleMouseMove.bind(this),this._handleMouseUp=this._handleMouseUp.bind(this),this._handleTouchStart=this._handleTouchStart.bind(this),this._handleTouchMove=this._handleTouchMove.bind(this),this._handleTouchEnd=this._handleTouchEnd.bind(this),this._handlePointerDown=this._handlePointerDown.bind(this),this._handlePointerMove=this._handlePointerMove.bind(this),this._handlePointerUp=this._handlePointerUp.bind(this),this._ctx=e.getContext("2d",this.canvasContextOptions),this.clear(),this.on()}clear(){const{_ctx:e,canvas:t}=this;e.fillStyle=this.backgroundColor,e.clearRect(0,0,t.width,t.height),e.fillRect(0,0,t.width,t.height),this._data=[],this._reset(this._getPointGroupOptions()),this._isEmpty=!0,this._strokePointerId=void 0}fromDataURL(e,t={}){return new Promise((n,s)=>{const r=new Image,o=t.ratio||window.devicePixelRatio||1,a=t.width||this.canvas.width/o,d=t.height||this.canvas.height/o,p=t.xOffset||0,c=t.yOffset||0;this._reset(this._getPointGroupOptions()),r.onload=()=>{this._ctx.drawImage(r,p,c,a,d),n()},r.onerror=u=>{s(u)},r.crossOrigin="anonymous",r.src=e,this._isEmpty=!1})}toDataURL(e="image/png",t){switch(e){case"image/svg+xml":return typeof t!="object"&&(t=void 0),`data:image/svg+xml;base64,${btoa(this.toSVG(t))}`;default:return typeof t!="number"&&(t=void 0),this.canvas.toDataURL(e,t)}}on(){this.canvas.style.touchAction="none",this.canvas.style.msTouchAction="none",this.canvas.style.userSelect="none";const e=/Macintosh/.test(navigator.userAgent)&&"ontouchstart"in document;window.PointerEvent&&!e?this._handlePointerEvents():(this._handleMouseEvents(),"ontouchstart"in window&&this._handleTouchEvents())}off(){this.canvas.style.touchAction="auto",this.canvas.style.msTouchAction="auto",this.canvas.style.userSelect="auto",this.canvas.removeEventListener("pointerdown",this._handlePointerDown),this.canvas.removeEventListener("mousedown",this._handleMouseDown),this.canvas.removeEventListener("touchstart",this._handleTouchStart),this._removeMoveUpEventListeners()}_getListenerFunctions(){var e;const t=window.document===this.canvas.ownerDocument?window:(e=this.canvas.ownerDocument.defaultView)!==null&&e!==void 0?e:this.canvas.ownerDocument;return{addEventListener:t.addEventListener.bind(t),removeEventListener:t.removeEventListener.bind(t)}}_removeMoveUpEventListeners(){const{removeEventListener:e}=this._getListenerFunctions();e("pointermove",this._handlePointerMove),e("pointerup",this._handlePointerUp),e("mousemove",this._handleMouseMove),e("mouseup",this._handleMouseUp),e("touchmove",this._handleTouchMove),e("touchend",this._handleTouchEnd)}isEmpty(){return this._isEmpty}fromData(e,{clear:t=!0}={}){t&&this.clear(),this._fromData(e,this._drawCurve.bind(this),this._drawDot.bind(this)),this._data=this._data.concat(e)}toData(){return this._data}_isLeftButtonPressed(e,t){return t?e.buttons===1:(e.buttons&1)===1}_pointerEventToSignatureEvent(e){return{event:e,type:e.type,x:e.clientX,y:e.clientY,pressure:"pressure"in e?e.pressure:0}}_touchEventToSignatureEvent(e){const t=e.changedTouches[0];return{event:e,type:e.type,x:t.clientX,y:t.clientY,pressure:t.force}}_handleMouseDown(e){!this._isLeftButtonPressed(e,!0)||this._drawingStroke||this._strokeBegin(this._pointerEventToSignatureEvent(e))}_handleMouseMove(e){if(!this._isLeftButtonPressed(e,!0)||!this._drawingStroke){this._strokeEnd(this._pointerEventToSignatureEvent(e),!1);return}this._strokeMoveUpdate(this._pointerEventToSignatureEvent(e))}_handleMouseUp(e){this._isLeftButtonPressed(e)||this._strokeEnd(this._pointerEventToSignatureEvent(e))}_handleTouchStart(e){e.targetTouches.length!==1||this._drawingStroke||(e.cancelable&&e.preventDefault(),this._strokeBegin(this._touchEventToSignatureEvent(e)))}_handleTouchMove(e){if(e.targetTouches.length===1){if(e.cancelable&&e.preventDefault(),!this._drawingStroke){this._strokeEnd(this._touchEventToSignatureEvent(e),!1);return}this._strokeMoveUpdate(this._touchEventToSignatureEvent(e))}}_handleTouchEnd(e){e.targetTouches.length===0&&(e.cancelable&&e.preventDefault(),this._strokeEnd(this._touchEventToSignatureEvent(e)))}_getPointerId(e){return e.persistentDeviceId||e.pointerId}_allowPointerId(e,t=!1){return typeof this._strokePointerId>"u"?t:this._getPointerId(e)===this._strokePointerId}_handlePointerDown(e){this._drawingStroke||!this._isLeftButtonPressed(e)||!this._allowPointerId(e,!0)||(this._strokePointerId=this._getPointerId(e),e.preventDefault(),this._strokeBegin(this._pointerEventToSignatureEvent(e)))}_handlePointerMove(e){if(this._allowPointerId(e)){if(!this._isLeftButtonPressed(e,!0)||!this._drawingStroke){this._strokeEnd(this._pointerEventToSignatureEvent(e),!1);return}e.preventDefault(),this._strokeMoveUpdate(this._pointerEventToSignatureEvent(e))}}_handlePointerUp(e){this._isLeftButtonPressed(e)||!this._allowPointerId(e)||(e.preventDefault(),this._strokeEnd(this._pointerEventToSignatureEvent(e)))}_getPointGroupOptions(e){return{penColor:e&&"penColor"in e?e.penColor:this.penColor,dotSize:e&&"dotSize"in e?e.dotSize:this.dotSize,minWidth:e&&"minWidth"in e?e.minWidth:this.minWidth,maxWidth:e&&"maxWidth"in e?e.maxWidth:this.maxWidth,velocityFilterWeight:e&&"velocityFilterWeight"in e?e.velocityFilterWeight:this.velocityFilterWeight,compositeOperation:e&&"compositeOperation"in e?e.compositeOperation:this.compositeOperation}}_strokeBegin(e){if(!this.dispatchEvent(new CustomEvent("beginStroke",{detail:e,cancelable:!0})))return;const{addEventListener:n}=this._getListenerFunctions();switch(e.event.type){case"mousedown":n("mousemove",this._handleMouseMove,{passive:!1}),n("mouseup",this._handleMouseUp,{passive:!1});break;case"touchstart":n("touchmove",this._handleTouchMove,{passive:!1}),n("touchend",this._handleTouchEnd,{passive:!1});break;case"pointerdown":n("pointermove",this._handlePointerMove,{passive:!1}),n("pointerup",this._handlePointerUp,{passive:!1});break}this._drawingStroke=!0;const s=this._getPointGroupOptions(),r=Object.assign(Object.assign({},s),{points:[]});this._data.push(r),this._reset(s),this._strokeUpdate(e)}_strokeUpdate(e){if(!this._drawingStroke)return;if(this._data.length===0){this._strokeBegin(e);return}this.dispatchEvent(new CustomEvent("beforeUpdateStroke",{detail:e}));const t=this._createPoint(e.x,e.y,e.pressure),n=this._data[this._data.length-1],s=n.points,r=s.length>0&&s[s.length-1],o=r?t.distanceTo(r)<=this.minDistance:!1,a=this._getPointGroupOptions(n);if(!r||!(r&&o)){const d=this._addPoint(t,a);r?d&&this._drawCurve(d,a):this._drawDot(t,a),s.push({time:t.time,x:t.x,y:t.y,pressure:t.pressure})}this.dispatchEvent(new CustomEvent("afterUpdateStroke",{detail:e}))}_strokeEnd(e,t=!0){this._removeMoveUpEventListeners(),this._drawingStroke&&(t&&this._strokeUpdate(e),this._drawingStroke=!1,this._strokePointerId=void 0,this.dispatchEvent(new CustomEvent("endStroke",{detail:e})))}_handlePointerEvents(){this._drawingStroke=!1,this.canvas.addEventListener("pointerdown",this._handlePointerDown,{passive:!1})}_handleMouseEvents(){this._drawingStroke=!1,this.canvas.addEventListener("mousedown",this._handleMouseDown,{passive:!1})}_handleTouchEvents(){this.canvas.addEventListener("touchstart",this._handleTouchStart,{passive:!1})}_reset(e){this._lastPoints=[],this._lastVelocity=0,this._lastWidth=(e.minWidth+e.maxWidth)/2,this._ctx.fillStyle=e.penColor,this._ctx.globalCompositeOperation=e.compositeOperation}_createPoint(e,t,n){const s=this.canvas.getBoundingClientRect();return new X(e-s.left,t-s.top,n,new Date().getTime())}_addPoint(e,t){const{_lastPoints:n}=this;if(n.push(e),n.length>2){n.length===3&&n.unshift(n[0]);const s=this._calculateCurveWidths(n[1],n[2],t),r=ge.fromPoints(n,s);return n.shift(),r}return null}_calculateCurveWidths(e,t,n){const s=n.velocityFilterWeight*t.velocityFrom(e)+(1-n.velocityFilterWeight)*this._lastVelocity,r=this._strokeWidth(s,n),o={end:r,start:this._lastWidth};return this._lastVelocity=s,this._lastWidth=r,o}_strokeWidth(e,t){return Math.max(t.maxWidth/(e+1),t.minWidth)}_drawCurveSegment(e,t,n){const s=this._ctx;s.moveTo(e,t),s.arc(e,t,n,0,2*Math.PI,!1),this._isEmpty=!1}_drawCurve(e,t){const n=this._ctx,s=e.endWidth-e.startWidth,r=Math.ceil(e.length())*2;n.beginPath(),n.fillStyle=t.penColor;for(let o=0;o<r;o+=1){const a=o/r,d=a*a,p=d*a,c=1-a,u=c*c,h=u*c;let f=h*e.startPoint.x;f+=3*u*a*e.control1.x,f+=3*c*d*e.control2.x,f+=p*e.endPoint.x;let b=h*e.startPoint.y;b+=3*u*a*e.control1.y,b+=3*c*d*e.control2.y,b+=p*e.endPoint.y;const $=Math.min(e.startWidth+p*s,t.maxWidth);this._drawCurveSegment(f,b,$)}n.closePath(),n.fill()}_drawDot(e,t){const n=this._ctx,s=t.dotSize>0?t.dotSize:(t.minWidth+t.maxWidth)/2;n.beginPath(),this._drawCurveSegment(e.x,e.y,s),n.closePath(),n.fillStyle=t.penColor,n.fill()}_fromData(e,t,n){for(const s of e){const{points:r}=s,o=this._getPointGroupOptions(s);if(r.length>1)for(let a=0;a<r.length;a+=1){const d=r[a],p=new X(d.x,d.y,d.pressure,d.time);a===0&&this._reset(o);const c=this._addPoint(p,o);c&&t(c,o)}else this._reset(o),n(r[0],o)}}toSVG({includeBackgroundColor:e=!1}={}){const t=this._data,n=Math.max(window.devicePixelRatio||1,1),s=0,r=0,o=this.canvas.width/n,a=this.canvas.height/n,d=document.createElementNS("http://www.w3.org/2000/svg","svg");if(d.setAttribute("xmlns","http://www.w3.org/2000/svg"),d.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink"),d.setAttribute("viewBox",`${s} ${r} ${o} ${a}`),d.setAttribute("width",o.toString()),d.setAttribute("height",a.toString()),e&&this.backgroundColor){const p=document.createElement("rect");p.setAttribute("width","100%"),p.setAttribute("height","100%"),p.setAttribute("fill",this.backgroundColor),d.appendChild(p)}return this._fromData(t,(p,{penColor:c})=>{const u=document.createElement("path");if(!isNaN(p.control1.x)&&!isNaN(p.control1.y)&&!isNaN(p.control2.x)&&!isNaN(p.control2.y)){const h=`M ${p.startPoint.x.toFixed(3)},${p.startPoint.y.toFixed(3)} C ${p.control1.x.toFixed(3)},${p.control1.y.toFixed(3)} ${p.control2.x.toFixed(3)},${p.control2.y.toFixed(3)} ${p.endPoint.x.toFixed(3)},${p.endPoint.y.toFixed(3)}`;u.setAttribute("d",h),u.setAttribute("stroke-width",(p.endWidth*2.25).toFixed(3)),u.setAttribute("stroke",c),u.setAttribute("fill","none"),u.setAttribute("stroke-linecap","round"),d.appendChild(u)}},(p,{penColor:c,dotSize:u,minWidth:h,maxWidth:f})=>{const b=document.createElement("circle"),$=u>0?u:(h+f)/2;b.setAttribute("r",$.toString()),b.setAttribute("cx",p.x.toString()),b.setAttribute("cy",p.y.toString()),b.setAttribute("fill",c),d.appendChild(b)}),d.outerHTML}}class _t{constructor(e){this.signaturePads=new Map,this.canvasElements=new Map,this.onSignatureChange=e}initializeSignaturePad(e,t){const n=t==null?void 0:t.getElementById(`signature-${e}`);if(!n)return null;this.clearSignaturePad(e),this.resizeCanvas(n);const s=new Z(n,{backgroundColor:"rgb(255, 255, 255)",penColor:"rgb(0, 0, 0)",minWidth:.5,maxWidth:2.5});return this.signaturePads.set(e,s),this.canvasElements.set(e,n),s.addEventListener("endStroke",()=>{this.handleSignatureChange(e)}),s}handleSignatureChange(e){var r;const t=this.signaturePads.get(e);if(!t)return;const n=!t.isEmpty(),s=n?t.toData():null;(r=this.onSignatureChange)==null||r.call(this,{questionId:e,hasSignature:n,signatureData:s})}clearSignature(e){const t=this.signaturePads.get(e);t&&(t.clear(),this.handleSignatureChange(e))}saveSignature(e){const t=this.signaturePads.get(e);if(!t||t.isEmpty())return null;const n=t.toSVG(),s=t.toDataURL();return{questionId:e,svgData:n,dataURL:s}}restoreSignature(e,t){const n=this.signaturePads.get(e);if(!n||!t)return!1;try{return n.clear(),n.fromData(t),!0}catch(s){return console.warn(`Failed to restore signature for ${e}:`,s),!1}}handleResize(){this.signaturePads.forEach((e,t)=>{const n=this.canvasElements.get(t);if(n){this.resizeCanvas(n);const s=e.toData();e.clear(),e.fromData(s)}})}resizeCanvas(e){const t=Math.max(window.devicePixelRatio||1,1),n=window.getComputedStyle(e),s=parseFloat(n.width),r=parseFloat(n.height);e.width=s*t,e.height=r*t;const o=e.getContext("2d");o&&o.scale(t,t)}clearSignaturePad(e){var t;this.signaturePads.has(e)&&((t=this.signaturePads.get(e))==null||t.off(),this.signaturePads.delete(e),this.canvasElements.delete(e))}getSignaturePad(e){return this.signaturePads.get(e)}hasSignaturePads(){return this.signaturePads.size>0}getAllSignaturePads(){return new Map(this.signaturePads)}destroy(){this.signaturePads.forEach(e=>{e.off()}),this.signaturePads.clear(),this.canvasElements.clear()}}class St{trackQuestionResponse(e,t,n){if(!e)return;e.responses||(e.responses=[]);const s=e.responses.findIndex(o=>o.elementId===t),r={elementId:t,value:n,answeredAt:new Date};s>=0?e.responses[s]=r:e.responses.push(r)}updateInstanceWithFormData(e,t){e!=null&&e.steps&&e.steps.forEach(n=>{n.responses||(n.responses=[]),n.elements.forEach(s=>{if(this.isQuestionElement(s.type)){const r=t[s.id];if(r!==void 0&&n.responses){let o=n.responses.find(a=>a.elementId===s.id);o?(o.value=r,o.answeredAt=new Date):(o={elementId:s.id,value:r,answeredAt:new Date},n.responses.push(o))}}})})}extractFormDataFromSteps(e){const t={};return e.forEach(n=>{n.responses&&n.responses.forEach(s=>{t[s.elementId]=s.value})}),t}hasChangedFromPrevious(e,t,n){if(!(n!=null&&n.steps))return!0;for(const s of n.steps)if(s.responses){const r=s.responses.find(o=>o.elementId===e);if(r)return r.value!==t}return!0}isQuestionElement(e){return["text_input","textarea","select","number","radio","checkbox","date","file_upload","signature"].includes(e)}}class yt{constructor(e,t){this.mode=e,this.currentUser=t}updateMode(e){this.mode=e}updateCurrentUser(e){this.currentUser=e}isStepAssignedToUser(e){if(!this.currentUser)return!1;const t=e.assignment;return!!(this.currentUser.targetId&&t.targetId&&this.currentUser.targetId===t.targetId||this.currentUser.email&&t.email&&this.currentUser.email===t.email)}getAssignedSteps(e){return e!=null&&e.steps?e.steps.filter(t=>this.isStepAssignedToUser(t)):[]}findNextAssignedStep(e,t){if(!(t!=null&&t.steps))return-1;if(this.mode==="preview"||this.mode==="admin"||this.mode==="view-only"||this.mode==="print")return e+1<t.steps.length?e+1:-1;for(let n=e+1;n<t.steps.length;n++){const s=t.steps[n];if(this.isStepAssignedToUser(s))return n}return-1}isLastAssignedStep(e,t){if(this.mode==="preview"||this.mode==="admin"||this.mode==="view-only"||this.mode==="print"){const n=t==null?void 0:t.steps;return e===((n==null?void 0:n.length)||0)-1}return this.findNextAssignedStep(e,t)===-1}canNavigateToStep(e,t,n,s,r,o){if((r||o)&&this.mode!=="admin"&&this.mode!=="view-only"&&this.mode!=="print")return{canNavigate:!1,newStepIndex:t,reason:"Navigation blocked: workflow submitted"};if(this.mode==="preview"||this.mode==="admin"||this.mode==="view-only"||this.mode==="print"){const p=n.steps;return!p||e<0||e>=p.length?{canNavigate:!1,newStepIndex:t,reason:"Invalid step index"}:{canNavigate:!0,newStepIndex:e}}const a=n.steps;if(!a||e<0||e>=a.length)return{canNavigate:!1,newStepIndex:t,reason:"Invalid step index"};const d=a[e];if(this.isStepAssignedToUser(d)){const p=s.has(d.id),c=this.isStepWithinAllowedRange(e,n,s);return p||c?{canNavigate:!0,newStepIndex:e}:{canNavigate:!1,newStepIndex:t,reason:"Step not accessible yet"}}else return{canNavigate:!0,newStepIndex:e}}isStepWithinAllowedRange(e,t,n){if(!(t!=null&&t.steps))return!1;const r=this.getAssignedSteps(t).map(d=>t.steps.findIndex(p=>p.id===d.id)).sort((d,p)=>d-p);let o=-1;for(const d of r){const p=t.steps[d];n.has(p.id)&&(o=d)}let a=-1;for(const d of r)if(d>o){a=d;break}return a!==-1?e<=a&&this.isStepAssignedToUser(t.steps[e]):this.isStepAssignedToUser(t.steps[e])}}const ee=class ee{constructor(){this.formData={},this.validationErrors={}}updateFormData(e){this.formData={...e}}mergeFormData(e){this.formData={...this.formData,...e}}setFormField(e,t){this.formData={...this.formData,[e]:t}}removeFormField(e){const t={...this.formData};delete t[e],this.formData=t}getFormData(){return{...this.formData}}getFormField(e){return this.formData[e]}hasFormField(e){return e in this.formData}setValidationErrors(e){this.validationErrors={...e}}getValidationErrors(){return{...this.validationErrors}}clearValidationError(e){if(this.validationErrors[e]){const t={...this.validationErrors};delete t[e],this.validationErrors=t}}hasValidationError(e){return!!this.validationErrors[e]}setValidationError(e,t){this.validationErrors={...this.validationErrors,[e]:t}}clearAllValidationErrors(){this.validationErrors={}}initializeFromResponses(e){const t={};e.forEach(n=>{n.responses&&n.responses.forEach(s=>{t[s.elementId]=s.value})}),this.formData=t}reset(){this.formData={},this.validationErrors={}}isQuestionElement(e){return ee.QUESTION_ELEMENT_TYPES.includes(e.type)}getStepFormData(e){var n;const t={};return(n=e.elements)==null||n.forEach(s=>{if(this.isQuestionElement(s)){const r=s,o=this.formData[r.id];o!==void 0&&(t[r.id]=o)}}),t}hasFormData(){return Object.keys(this.formData).length>0}getFormFieldIds(){return Object.keys(this.formData)}getValidationErrorCount(){return Object.keys(this.validationErrors).length}};ee.QUESTION_ELEMENT_TYPES=["text_input","textarea","select","number","radio","checkbox","date","file_upload","signature"];let fe=ee;const te=class te{constructor(e,t){this.formStateManager=e,this.responseTracker=t}handleFileUpload(e,t,n){var p,c,u,h,f;const s=t.target,r=(p=s.files)==null?void 0:p[0];if(!r){this.clearFile(e),(c=n.onRequestUpdate)==null||c.call(n);return}const o=this.validateFileSize(r);if(o){this.handleFileValidationError(e,o,s),(u=n.onRequestUpdate)==null||u.call(n);return}this.formStateManager.clearValidationError(e);const a=this.createFileInfo(r);this.formStateManager.setFormField(e,a);const d=this.hasFileChanged(e,a,n.savedInstance);d&&n.mode!=="preview"?this.executeFileUploadCallback(e,r,a,n):this.logSkippedCallback(e,n.mode,d),(h=n.onRequestUpdate)==null||h.call(n),n.mode!=="admin"&&((f=n.onFormDataSave)==null||f.call(n))}clearFile(e){this.formStateManager.setFormField(e,null),this.formStateManager.clearValidationError(e)}validateFileSize(e){return e.size>te.MAX_FILE_SIZE?`File size must be less than 5MB. Current size: ${(e.size/1024/1024).toFixed(2)}MB`:null}handleFileValidationError(e,t,n){this.formStateManager.setValidationError(e,t),this.formStateManager.setFormField(e,null),n.value=""}createFileInfo(e){return{name:e.name,size:e.size,type:e.type,lastModified:e.lastModified}}hasFileChanged(e,t,n){if(!(n!=null&&n.steps))return!0;for(const s of n.steps)if(s.responses){const r=s.responses.find(o=>o.elementId===e);if(r&&r.value&&typeof r.value=="object"){const o=r.value;return o.name!==t.name||o.size!==t.size||o.type!==t.type||o.lastModified!==t.lastModified}}return!0}executeFileUploadCallback(e,t,n,s){var r,o;console.log("File changed, calling callback for:",e),console.log("Callback function exists:",!!s.onFileUploaded),s.onFileUploaded&&s.onFileUploaded({instanceId:(r=s.instance)==null?void 0:r.id,stepId:(o=s.currentStep)==null?void 0:o.id,questionId:e,file:t,fileName:n.name,fileSize:n.size,fileType:n.type})}logSkippedCallback(e,t,n){t==="preview"?console.log("Preview mode: skipping file upload callback for:",e):n||console.log("File unchanged, skipping callback for:",e)}};te.MAX_FILE_SIZE=5*1024*1024;let me=te;class y{static _isInputDisabled(e){return(e.isSubmitted||e.userStepsSubmitted)&&e.mode!=="admin"||e.mode==="view-only"||e.mode==="print"||e.mode==="default"&&!e.handlers.isCurrentStepAssigned()}static _formatFileSize(e){if(e===0)return"0 Bytes";const t=1024,n=["Bytes","KB","MB","GB"],s=Math.floor(Math.log(e)/Math.log(t));return parseFloat((e/Math.pow(t,s)).toFixed(2))+" "+n[s]}static _extractFilenameFromUrl(e){try{return new URL(e).pathname.split("/").pop()||""||"Uploaded File"}catch{const t=e.split("/"),n=t[t.length-1];return n&&n.includes(".")?n:"Uploaded File"}}static _guessFileTypeFromUrl(e){var r;const n=(r=y._extractFilenameFromUrl(e).split(".").pop())==null?void 0:r.toLowerCase();return n?{pdf:"PDF Document",doc:"Word Document",docx:"Word Document",xls:"Excel Spreadsheet",xlsx:"Excel Spreadsheet",png:"PNG Image",jpg:"JPEG Image",jpeg:"JPEG Image",gif:"GIF Image",svg:"SVG Image",txt:"Text File",csv:"CSV File",zip:"ZIP Archive",mp4:"MP4 Video",mp3:"MP3 Audio"}[n]||`${n.toUpperCase()} File`:"Unknown"}static renderTextArea(e,t,n){return n.mode==="print"?l`<div class="print-response-value textarea-response">
@@ -3203,7 +3203,7 @@ Use **bold** and *italic* text.`;break}const n=this._templateData.steps.map(r=>r
3203
3203
  * @license
3204
3204
  * Copyright 2017 Google LLC
3205
3205
  * SPDX-License-Identifier: BSD-3-Clause
3206
- */class be extends $t{constructor(e){if(super(e),this.it=v,e.type!==wt.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===v||e==null)return this._t=void 0,this.it=e;if(e===I)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;const t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}}be.directiveName="unsafeHTML",be.resultType=1;const Le=kt(be);class k{static renderMarkdown(e){return e.replace(/^### (.*$)/gim,"<h3>$1</h3>").replace(/^## (.*$)/gim,"<h2>$1</h2>").replace(/^# (.*$)/gim,"<h1>$1</h1>").replace(/\*\*(.*?)\*\*/gim,"<strong>$1</strong>").replace(/\*(.*?)\*/gim,"<em>$1</em>").replace(/`(.*?)`/gim,"<code>$1</code>").replace(/^> (.*$)/gim,"<blockquote>$1</blockquote>").replace(/\n/gim,"<br>")}static renderText(e){return l`
3206
+ */class be extends $t{constructor(e){if(super(e),this.it=v,e.type!==wt.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===v||e==null)return this._t=void 0,this.it=e;if(e===U)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;const t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}}be.directiveName="unsafeHTML",be.resultType=1;const Le=kt(be);class k{static renderMarkdown(e){return e.replace(/^### (.*$)/gim,"<h3>$1</h3>").replace(/^## (.*$)/gim,"<h2>$1</h2>").replace(/^# (.*$)/gim,"<h1>$1</h1>").replace(/\*\*(.*?)\*\*/gim,"<strong>$1</strong>").replace(/\*(.*?)\*/gim,"<em>$1</em>").replace(/`(.*?)`/gim,"<code>$1</code>").replace(/^> (.*$)/gim,"<blockquote>$1</blockquote>").replace(/\n/gim,"<br>")}static renderText(e){return l`
3207
3207
  <div class="content-element text-content">
3208
3208
  <p>${e.content}</p>
3209
3209
  </div>
@@ -3461,7 +3461,7 @@ Use **bold** and *italic* text.`;break}const n=this._templateData.steps.map(r=>r
3461
3461
  </div>
3462
3462
  `:""}
3463
3463
  </div>
3464
- `}};m.styles=[Pe],m.QUESTION_ELEMENT_TYPES=["text_input","textarea","select","number","radio","checkbox","date","file_upload","signature"],m.CONTENT_ELEMENT_TYPES=["text","html","image","video","file","divider","markdown"],x([C({type:Object})],m.prototype,"instance",2),x([C({type:Object})],m.prototype,"workflow",2),x([C({type:String})],m.prototype,"mode",2),x([C({type:Boolean})],m.prototype,"isLoading",2),x([C({type:Object})],m.prototype,"currentUser",2),x([C({type:Function})],m.prototype,"onSignatureCaptured",2),x([C({type:Function})],m.prototype,"onFileUploaded",2),x([_()],m.prototype,"_currentStepIndex",2),x([_()],m.prototype,"_formData",2),x([_()],m.prototype,"_validationErrors",2),x([_()],m.prototype,"_internalCompletedSteps",2),x([_()],m.prototype,"_formRestorationComplete",2),x([_()],m.prototype,"_savedSignatures",2),x([_()],m.prototype,"_replacingSignatures",2),x([_()],m.prototype,"_savedInstance",2),x([_()],m.prototype,"_isSubmitted",2),x([_()],m.prototype,"_userStepsSubmitted",2),x([_()],m.prototype,"_justSaved",2),m=x([Ie("runner-widget")],m);function At(i,e={}){const{title:t=i.name||"Workflow Instance",includeStyles:n=!0,customCSS:s="",showTimestamps:r=!1}=e,o=new Date;if(!(i!=null&&i.steps)||i.steps.length===0)throw new Error("Instance must have at least one step to generate HTML");return{html:`<!DOCTYPE html>
3464
+ `}};m.styles=[Pe],m.QUESTION_ELEMENT_TYPES=["text_input","textarea","select","number","radio","checkbox","date","file_upload","signature"],m.CONTENT_ELEMENT_TYPES=["text","html","image","video","file","divider","markdown"],x([C({type:Object})],m.prototype,"instance",2),x([C({type:Object})],m.prototype,"workflow",2),x([C({type:String})],m.prototype,"mode",2),x([C({type:Boolean})],m.prototype,"isLoading",2),x([C({type:Object})],m.prototype,"currentUser",2),x([C({type:Function})],m.prototype,"onSignatureCaptured",2),x([C({type:Function})],m.prototype,"onFileUploaded",2),x([_()],m.prototype,"_currentStepIndex",2),x([_()],m.prototype,"_formData",2),x([_()],m.prototype,"_validationErrors",2),x([_()],m.prototype,"_internalCompletedSteps",2),x([_()],m.prototype,"_formRestorationComplete",2),x([_()],m.prototype,"_savedSignatures",2),x([_()],m.prototype,"_replacingSignatures",2),x([_()],m.prototype,"_savedInstance",2),x([_()],m.prototype,"_isSubmitted",2),x([_()],m.prototype,"_userStepsSubmitted",2),x([_()],m.prototype,"_justSaved",2),m=x([Ue("runner-widget")],m);function At(i,e={}){const{title:t=i.name||"Workflow Instance",includeStyles:n=!0,customCSS:s="",showTimestamps:r=!1}=e,o=new Date;if(!(i!=null&&i.steps)||i.steps.length===0)throw new Error("Instance must have at least one step to generate HTML");return{html:`<!DOCTYPE html>
3465
3465
  <html lang="en">
3466
3466
  <head>
3467
3467
  <meta charset="UTF-8">
@@ -3498,15 +3498,15 @@ Use **bold** and *italic* text.`;break}const n=this._templateData.steps.map(r=>r
3498
3498
  ${i.description?`<div class="print-step-description">${g(i.description)}</div>`:""}
3499
3499
  <hr class="print-question-separator" />
3500
3500
  </div>
3501
- `}function Tt(i,e){return Ht(i)?zt(i,e):It(i)}function zt(i,e){const t=Vt(i.id,e.responses),n=t==null?void 0:t.value,r=i.type==="checkbox"&&(!i.options||i.options.length===0)?"":`
3501
+ `}function Tt(i,e){return Ht(i)?zt(i,e):Ut(i)}function zt(i,e){const t=Vt(i.id,e.responses),n=t==null?void 0:t.value,r=i.type==="checkbox"&&(!i.options||i.options.length===0)?"":`
3502
3502
  <div class="print-question-title">
3503
3503
  ${g(i.label)}:
3504
3504
  </div>
3505
- `,o='<hr class="print-question-separator" />';switch(i.type){case"text_input":case"number":case"date":return r+Ut(i,n)+o;case"textarea":return r+Pt(i,n)+o;case"select":return r+Lt(i,n)+o;case"radio":return r+Nt(i,n)+o;case"checkbox":return r+Ot(i,n)+o;case"file_upload":return r+Rt(i,n)+o;case"signature":return r+Wt(i,n)+o;default:return r+`
3505
+ `,o='<hr class="print-question-separator" />';switch(i.type){case"text_input":case"number":case"date":return r+It(i,n)+o;case"textarea":return r+Pt(i,n)+o;case"select":return r+Lt(i,n)+o;case"radio":return r+Nt(i,n)+o;case"checkbox":return r+Ot(i,n)+o;case"file_upload":return r+Rt(i,n)+o;case"signature":return r+Wt(i,n)+o;default:return r+`
3506
3506
  <div class="unknown-element">
3507
3507
  <p>⚠️ Unknown question type: ${g(i.type)}</p>
3508
3508
  </div>
3509
- `+o}}function It(i){const e=i.type!=="divider"?'<hr class="print-question-separator" />':"";switch(i.type){case"text":return`
3509
+ `+o}}function Ut(i){const e=i.type!=="divider"?'<hr class="print-question-separator" />':"";switch(i.type){case"text":return`
3510
3510
  <div class="content-print">
3511
3511
  <div class="content-element">
3512
3512
  <div class="text-content">
@@ -3581,7 +3581,7 @@ Use **bold** and *italic* text.`;break}const n=this._templateData.steps.map(r=>r
3581
3581
  </div>
3582
3582
  ${e}
3583
3583
  </div>
3584
- `}}function Ut(i,e){const t=e!=null?g(String(e)):"";return`
3584
+ `}}function It(i,e){const t=e!=null?g(String(e)):"";return`
3585
3585
  <div class="print-response-value input-response">
3586
3586
  ${(i.type==="date"&&e?new Date(e).toLocaleDateString():t)||'<span class="print-no-response">No response</span>'}
3587
3587
  </div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drill-widgets",
3
- "version": "2.7.5",
3
+ "version": "2.7.6",
4
4
  "description": "Easily embed powerful workflow building and running capabilities into your web applications with Lit-based web components. Includes HTML export for server-side PDF generation.",
5
5
  "scripts": {
6
6
  "dev": "vite",