drill-widgets 2.7.14 → 2.7.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/drill-widgets.es.js +1538 -1069
- package/dist/drill-widgets.umd.js +984 -534
- package/dist/lib.d.ts +2 -0
- package/package.json +1 -1
|
@@ -2,21 +2,21 @@
|
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2019 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
-
*/var Oe;const M=globalThis,
|
|
5
|
+
*/var Oe;const M=globalThis,ne=M.ShadowRoot&&(M.ShadyCSS===void 0||M.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,oe=Symbol(),xe=new WeakMap;let _e=class{constructor(e,t,i){if(this._$cssResult$=!0,i!==oe)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(ne&&e===void 0){const i=t!==void 0&&t.length===1;i&&(e=xe.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&xe.set(t,e))}return e}toString(){return this.cssText}};const Re=s=>new _e(typeof s=="string"?s:s+"",void 0,oe),L=(s,...e)=>{const t=s.length===1?s[0]:e.reduce((i,r,n)=>i+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+s[n+1],s[0]);return new _e(t,s,oe)},He=(s,e)=>{if(ne)s.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const i=document.createElement("style"),r=M.litNonce;r!==void 0&&i.setAttribute("nonce",r),i.textContent=t.cssText,s.appendChild(i)}},ye=ne?s=>s:s=>s instanceof CSSStyleSheet?(e=>{let t="";for(const i of e.cssRules)t+=i.cssText;return Re(t)})(s):s;/**
|
|
6
6
|
* @license
|
|
7
7
|
* Copyright 2017 Google LLC
|
|
8
8
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
9
|
-
*/const{is:We,defineProperty:
|
|
9
|
+
*/const{is:We,defineProperty:je,getOwnPropertyDescriptor:Ve,getOwnPropertyNames:Be,getOwnPropertySymbols:Qe,getPrototypeOf:Ge}=Object,T=globalThis,we=T.trustedTypes,Ye=we?we.emptyScript:"",ae=T.reactiveElementPolyfillSupport,W=(s,e)=>s,K={toAttribute(s,e){switch(e){case Boolean:s=s?Ye:null;break;case Object:case Array:s=s==null?s:JSON.stringify(s)}return s},fromAttribute(s,e){let t=s;switch(e){case Boolean:t=s!==null;break;case Number:t=s===null?null:Number(s);break;case Object:case Array:try{t=JSON.parse(s)}catch{t=null}}return t}},de=(s,e)=>!We(s,e),Se={attribute:!0,type:String,converter:K,reflect:!1,useDefault:!1,hasChanged:de};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),T.litPropertyMetadata??(T.litPropertyMetadata=new WeakMap);let O=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??(this.l=[])).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=Se){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const i=Symbol(),r=this.getPropertyDescriptor(e,i,t);r!==void 0&&je(this.prototype,e,r)}}static getPropertyDescriptor(e,t,i){const{get:r,set:n}=Ve(this.prototype,e)??{get(){return this[t]},set(o){this[t]=o}};return{get:r,set(o){const a=r==null?void 0:r.call(this);n==null||n.call(this,o),this.requestUpdate(e,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Se}static _$Ei(){if(this.hasOwnProperty(W("elementProperties")))return;const e=Ge(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(W("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(W("properties"))){const t=this.properties,i=[...Be(t),...Qe(t)];for(const r of i)this.createProperty(r,t[r])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[i,r]of t)this.elementProperties.set(i,r)}this._$Eh=new Map;for(const[t,i]of this.elementProperties){const r=this._$Eu(t,i);r!==void 0&&this._$Eh.set(r,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const i=new Set(e.flat(1/0).reverse());for(const r of i)t.unshift(ye(r))}else e!==void 0&&t.push(ye(e));return t}static _$Eu(e,t){const i=t.attribute;return i===!1?void 0:typeof i=="string"?i:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var e;this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),(e=this.constructor.l)==null||e.forEach(t=>t(this))}addController(e){var t;(this._$EO??(this._$EO=new Set)).add(e),this.renderRoot!==void 0&&this.isConnected&&((t=e.hostConnected)==null||t.call(e))}removeController(e){var t;(t=this._$EO)==null||t.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const i of t.keys())this.hasOwnProperty(i)&&(e.set(i,this[i]),delete this[i]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return He(e,this.constructor.elementStyles),e}connectedCallback(){var e;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$EO)==null||e.forEach(t=>{var i;return(i=t.hostConnected)==null?void 0:i.call(t)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$EO)==null||e.forEach(t=>{var i;return(i=t.hostDisconnected)==null?void 0:i.call(t)})}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$ET(e,t){var n;const i=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,i);if(r!==void 0&&i.reflect===!0){const o=(((n=i.converter)==null?void 0:n.toAttribute)!==void 0?i.converter:K).toAttribute(t,i.type);this._$Em=e,o==null?this.removeAttribute(r):this.setAttribute(r,o),this._$Em=null}}_$AK(e,t){var n,o;const i=this.constructor,r=i._$Eh.get(e);if(r!==void 0&&this._$Em!==r){const a=i.getPropertyOptions(r),d=typeof a.converter=="function"?{fromAttribute:a.converter}:((n=a.converter)==null?void 0:n.fromAttribute)!==void 0?a.converter:K;this._$Em=r,this[r]=d.fromAttribute(t,a.type)??((o=this._$Ej)==null?void 0:o.get(r))??null,this._$Em=null}}requestUpdate(e,t,i){var r;if(e!==void 0){const n=this.constructor,o=this[e];if(i??(i=n.getPropertyOptions(e)),!((i.hasChanged??de)(o,t)||i.useDefault&&i.reflect&&o===((r=this._$Ej)==null?void 0:r.get(e))&&!this.hasAttribute(n._$Eu(e,i))))return;this.C(e,t,i)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:i,reflect:r,wrapped:n},o){i&&!(this._$Ej??(this._$Ej=new Map)).has(e)&&(this._$Ej.set(e,o??t??this[e]),n!==!0||o!==void 0)||(this._$AL.has(e)||(this.hasUpdated||i||(t=void 0),this._$AL.set(e,t)),r===!0&&this._$Em!==e&&(this._$Eq??(this._$Eq=new Set)).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var i;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[n,o]of this._$Ep)this[n]=o;this._$Ep=void 0}const r=this.constructor.elementProperties;if(r.size>0)for(const[n,o]of r){const{wrapped:a}=o,d=this[n];a!==!0||this._$AL.has(n)||d===void 0||this.C(n,void 0,o,d)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),(i=this._$EO)==null||i.forEach(r=>{var n;return(n=r.hostUpdate)==null?void 0:n.call(r)}),this.update(t)):this._$EM()}catch(r){throw e=!1,this._$EM(),r}e&&this._$AE(t)}willUpdate(e){}_$AE(e){var t;(t=this._$EO)==null||t.forEach(i=>{var r;return(r=i.hostUpdated)==null?void 0:r.call(i)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&(this._$Eq=this._$Eq.forEach(t=>this._$ET(t,this[t]))),this._$EM()}updated(e){}firstUpdated(e){}};O.elementStyles=[],O.shadowRootOptions={mode:"open"},O[W("elementProperties")]=new Map,O[W("finalized")]=new Map,ae==null||ae({ReactiveElement:O}),(T.reactiveElementVersions??(T.reactiveElementVersions=[])).push("2.1.0");/**
|
|
10
10
|
* @license
|
|
11
11
|
* Copyright 2017 Google LLC
|
|
12
12
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
13
|
-
*/const
|
|
14
|
-
\f\r]`,Q=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ce=/-->/g,
|
|
15
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),
|
|
13
|
+
*/const j=globalThis,J=j.trustedTypes,ke=J?J.createPolicy("lit-html",{createHTML:s=>s}):void 0,$e="$lit$",F=`lit$${Math.random().toFixed(9).slice(2)}$`,De="?"+F,qe=`<${De}>`,z=document,V=()=>z.createComment(""),B=s=>s===null||typeof s!="object"&&typeof s!="function",le=Array.isArray,Ke=s=>le(s)||typeof(s==null?void 0:s[Symbol.iterator])=="function",pe=`[
|
|
14
|
+
\f\r]`,Q=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ce=/-->/g,Ae=/>/g,I=RegExp(`>|${pe}(?:([^\\s"'>=/]+)(${pe}*=${pe}*(?:[^
|
|
15
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Ee=/'/g,Me=/"/g,Te=/^(?:script|style|textarea|title)$/i,Je=s=>(e,...t)=>({_$litType$:s,strings:e,values:t}),l=Je(1),P=Symbol.for("lit-noChange"),x=Symbol.for("lit-nothing"),Fe=new WeakMap,U=z.createTreeWalker(z,129);function ze(s,e){if(!le(s)||!s.hasOwnProperty("raw"))throw Error("invalid template strings array");return ke!==void 0?ke.createHTML(e):e}const Xe=(s,e)=>{const t=s.length-1,i=[];let r,n=e===2?"<svg>":e===3?"<math>":"",o=Q;for(let a=0;a<t;a++){const d=s[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=Ae:c[2]!==void 0?(Te.test(c[2])&&(r=RegExp("</"+c[2],"g")),o=I):c[3]!==void 0&&(o=I):o===I?c[0]===">"?(o=r??Q,u=-1):c[1]===void 0?u=-2:(u=o.lastIndex-c[2].length,p=c[1],o=c[3]===void 0?I:c[3]==='"'?Me:Ee):o===Me||o===Ee?o=I:o===Ce||o===Ae?o=Q:(o=I,r=void 0);const m=o===I&&s[a+1].startsWith("/>")?" ":"";n+=o===Q?d+qe:u>=0?(i.push(p),d.slice(0,u)+$e+d.slice(u)+F+m):d+F+(u===-2?a:m)}return[ze(s,n+(s[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),i]};class G{constructor({strings:e,_$litType$:t},i){let r;this.parts=[];let n=0,o=0;const a=e.length-1,d=this.parts,[p,c]=Xe(e,t);if(this.el=G.createElement(p,i),U.currentNode=this.el.content,t===2||t===3){const u=this.el.content.firstChild;u.replaceWith(...u.childNodes)}for(;(r=U.nextNode())!==null&&d.length<a;){if(r.nodeType===1){if(r.hasAttributes())for(const u of r.getAttributeNames())if(u.endsWith($e)){const h=c[o++],m=r.getAttribute(u).split(F),v=/([.?@])?(.*)/.exec(h);d.push({type:1,index:n,name:v[2],strings:m,ctor:v[1]==="."?et:v[1]==="?"?tt:v[1]==="@"?it:X}),r.removeAttribute(u)}else u.startsWith(F)&&(d.push({type:6,index:n}),r.removeAttribute(u));if(Te.test(r.tagName)){const u=r.textContent.split(F),h=u.length-1;if(h>0){r.textContent=J?J.emptyScript:"";for(let m=0;m<h;m++)r.append(u[m],V()),U.nextNode(),d.push({type:2,index:++n});r.append(u[h],V())}}}else if(r.nodeType===8)if(r.data===De)d.push({type:2,index:n});else{let u=-1;for(;(u=r.data.indexOf(F,u+1))!==-1;)d.push({type:7,index:n}),u+=F.length-1}n++}}static createElement(e,t){const i=z.createElement("template");return i.innerHTML=e,i}}function R(s,e,t=s,i){var o,a;if(e===P)return e;let r=i!==void 0?(o=t._$Co)==null?void 0:o[i]:t._$Cl;const n=B(e)?void 0:e._$litDirective$;return(r==null?void 0:r.constructor)!==n&&((a=r==null?void 0:r._$AO)==null||a.call(r,!1),n===void 0?r=void 0:(r=new n(s),r._$AT(s,t,i)),i!==void 0?(t._$Co??(t._$Co=[]))[i]=r:t._$Cl=r),r!==void 0&&(e=R(s,r._$AS(s,e.values),r,i)),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:i}=this._$AD,r=((e==null?void 0:e.creationScope)??z).importNode(t,!0);U.currentNode=r;let n=U.nextNode(),o=0,a=0,d=i[0];for(;d!==void 0;){if(o===d.index){let p;d.type===2?p=new Y(n,n.nextSibling,this,e):d.type===1?p=new d.ctor(n,d.name,d.strings,this,e):d.type===6&&(p=new st(n,this,e)),this._$AV.push(p),d=i[++a]}o!==(d==null?void 0:d.index)&&(n=U.nextNode(),o++)}return U.currentNode=z,r}p(e){let t=0;for(const i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(e,i,t),t+=i.strings.length-2):i._$AI(e[t])),t++}}class Y{get _$AU(){var e;return((e=this._$AM)==null?void 0:e._$AU)??this._$Cv}constructor(e,t,i,r){this.type=2,this._$AH=x,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=i,this.options=r,this._$Cv=(r==null?void 0:r.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=R(this,e,t),B(e)?e===x||e==null||e===""?(this._$AH!==x&&this._$AR(),this._$AH=x):e!==this._$AH&&e!==P&&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!==x&&B(this._$AH)?this._$AA.nextSibling.data=e:this.T(z.createTextNode(e)),this._$AH=e}$(e){var n;const{values:t,_$litType$:i}=e,r=typeof i=="number"?this._$AC(e):(i.el===void 0&&(i.el=G.createElement(ze(i.h,i.h[0]),this.options)),i);if(((n=this._$AH)==null?void 0:n._$AD)===r)this._$AH.p(t);else{const o=new Ze(r,this),a=o.u(this.options);o.p(t),this.T(a),this._$AH=o}}_$AC(e){let t=Fe.get(e.strings);return t===void 0&&Fe.set(e.strings,t=new G(e)),t}k(e){le(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let i,r=0;for(const n of e)r===t.length?t.push(i=new Y(this.O(V()),this.O(V()),this,this.options)):i=t[r],i._$AI(n),r++;r<t.length&&(this._$AR(i&&i._$AB.nextSibling,r),t.length=r)}_$AR(e=this._$AA.nextSibling,t){var i;for((i=this._$AP)==null?void 0:i.call(this,!1,!0,t);e&&e!==this._$AB;){const r=e.nextSibling;e.remove(),e=r}}setConnected(e){var t;this._$AM===void 0&&(this._$Cv=e,(t=this._$AP)==null||t.call(this,e))}}class X{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,i,r,n){this.type=1,this._$AH=x,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=n,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=x}_$AI(e,t=this,i,r){const n=this.strings;let o=!1;if(n===void 0)e=R(this,e,t,0),o=!B(e)||e!==this._$AH&&e!==P,o&&(this._$AH=e);else{const a=e;let d,p;for(e=n[0],d=0;d<n.length-1;d++)p=R(this,a[i+d],t,d),p===P&&(p=this._$AH[d]),o||(o=!B(p)||p!==this._$AH[d]),p===x?e=x:e!==x&&(e+=(p??"")+n[d+1]),this._$AH[d]=p}o&&!r&&this.j(e)}j(e){e===x?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class et extends X{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===x?void 0:e}}class tt extends X{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==x)}}class it extends X{constructor(e,t,i,r,n){super(e,t,i,r,n),this.type=5}_$AI(e,t=this){if((e=R(this,e,t,0)??x)===P)return;const i=this._$AH,r=e===x&&i!==x||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,n=e!==x&&(i===x||r);r&&this.element.removeEventListener(this.name,this,i),n&&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 st{constructor(e,t,i){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(e){R(this,e)}}const ce=j.litHtmlPolyfillSupport;ce==null||ce(G,Y),(j.litHtmlVersions??(j.litHtmlVersions=[])).push("3.3.0");const rt=(s,e,t)=>{const i=(t==null?void 0:t.renderBefore)??e;let r=i._$litPart$;if(r===void 0){const n=(t==null?void 0:t.renderBefore)??null;i._$litPart$=r=new Y(e.insertBefore(V(),n),n,void 0,t??{})}return r._$AI(s),r};/**
|
|
16
16
|
* @license
|
|
17
17
|
* Copyright 2017 Google LLC
|
|
18
18
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
19
|
-
*/const
|
|
19
|
+
*/const N=globalThis;let H=class extends O{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=rt(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 P}};H._$litElement$=!0,H.finalized=!0,(Oe=N.litElementHydrateSupport)==null||Oe.call(N,{LitElement:H});const ue=N.litElementPolyfillSupport;ue==null||ue({LitElement:H}),(N.litElementVersions??(N.litElementVersions=[])).push("4.2.0");/**
|
|
20
20
|
* @license
|
|
21
21
|
* Copyright 2017 Google LLC
|
|
22
22
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -24,19 +24,94 @@
|
|
|
24
24
|
* @license
|
|
25
25
|
* Copyright 2017 Google LLC
|
|
26
26
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
27
|
-
*/const
|
|
27
|
+
*/const nt={attribute:!0,type:String,converter:K,reflect:!1,hasChanged:de},ot=(s=nt,e,t)=>{const{kind:i,metadata:r}=t;let n=globalThis.litPropertyMetadata.get(r);if(n===void 0&&globalThis.litPropertyMetadata.set(r,n=new Map),i==="setter"&&((s=Object.create(s)).wrapped=!0),n.set(t.name,s),i==="accessor"){const{name:o}=t;return{set(a){const d=e.get.call(this);e.set.call(this,a),this.requestUpdate(o,d,s)},init(a){return a!==void 0&&this.C(o,void 0,s,a),a}}}if(i==="setter"){const{name:o}=t;return function(a){const d=this[o];e.call(this,a),this.requestUpdate(o,d,s)}}throw Error("Unsupported decorator location: "+i)};function A(s){return(e,t)=>typeof t=="object"?ot(s,e,t):((i,r,n)=>{const o=r.hasOwnProperty(n);return r.constructor.createProperty(n,i),o?Object.getOwnPropertyDescriptor(r,n):void 0})(s,e,t)}/**
|
|
28
28
|
* @license
|
|
29
29
|
* Copyright 2017 Google LLC
|
|
30
30
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
31
|
-
*/function
|
|
31
|
+
*/function f(s){return A({...s,state:!0,attribute:!1})}const w=[];for(let s=0;s<256;++s)w.push((s+256).toString(16).slice(1));function at(s,e=0){return(w[s[e+0]]+w[s[e+1]]+w[s[e+2]]+w[s[e+3]]+"-"+w[s[e+4]]+w[s[e+5]]+"-"+w[s[e+6]]+w[s[e+7]]+"-"+w[s[e+8]]+w[s[e+9]]+"-"+w[s[e+10]]+w[s[e+11]]+w[s[e+12]]+w[s[e+13]]+w[s[e+14]]+w[s[e+15]]).toLowerCase()}let he;const dt=new Uint8Array(16);function lt(){if(!he){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");he=crypto.getRandomValues.bind(crypto)}return he(dt)}const Pe={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function E(s,e,t){var r;if(Pe.randomUUID&&!s)return Pe.randomUUID();s=s||{};const i=s.random??((r=s.rng)==null?void 0:r.call(s))??lt();if(i.length<16)throw new Error("Random bytes length must be >= 16");return i[6]=i[6]&15|64,i[8]=i[8]&63|128,at(i)}const pt=L`
|
|
32
32
|
:host {
|
|
33
|
+
/* Color tokens (defaults) */
|
|
34
|
+
--bg: #f9fafb;
|
|
35
|
+
--card-bg: #ffffff;
|
|
36
|
+
--text: #111827;
|
|
37
|
+
--muted: #6b7280;
|
|
38
|
+
--border: #e5e7eb;
|
|
39
|
+
|
|
40
|
+
--header-bg: #f9fafb;
|
|
41
|
+
--header-border-color: var(--border);
|
|
42
|
+
--header-border-width: 1px;
|
|
43
|
+
|
|
44
|
+
--cancel-bg: #ffffff;
|
|
45
|
+
--cancel-text: #374151;
|
|
46
|
+
|
|
47
|
+
--accent: #0f766e;
|
|
48
|
+
--accent-hover: #0d9488;
|
|
49
|
+
|
|
50
|
+
--radius: 8px;
|
|
51
|
+
--shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
|
52
|
+
|
|
33
53
|
display: block;
|
|
34
54
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
|
35
|
-
background-color:
|
|
36
|
-
border-radius:
|
|
37
|
-
box-shadow:
|
|
55
|
+
background-color: var(--bg);
|
|
56
|
+
border-radius: var(--radius);
|
|
57
|
+
box-shadow: var(--shadow);
|
|
38
58
|
overflow: hidden;
|
|
39
59
|
min-height: 600px;
|
|
60
|
+
color: var(--text);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/* allow consumers to toggle dark theme on the host */
|
|
64
|
+
:host([theme="dark"]),
|
|
65
|
+
:host([data-theme="dark"]) {
|
|
66
|
+
--bg: #121212;
|
|
67
|
+
--card-bg: #161616;
|
|
68
|
+
--text: #f9fafb;
|
|
69
|
+
--muted: #94a3b8;
|
|
70
|
+
--border: #1f2937;
|
|
71
|
+
|
|
72
|
+
--header-bg: #222222;
|
|
73
|
+
--header-border-color: var(--border);
|
|
74
|
+
--header-border-width: 1px;
|
|
75
|
+
|
|
76
|
+
--cancel-bg: #0b1220;
|
|
77
|
+
--cancel-text: #ffffff;
|
|
78
|
+
|
|
79
|
+
--accent: #0f766e;
|
|
80
|
+
--accent-hover: #0d9488;
|
|
81
|
+
|
|
82
|
+
--shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/* also provide sensible defaults when not using shadow DOM via prefers-color-scheme */
|
|
86
|
+
@media (prefers-color-scheme: dark) {
|
|
87
|
+
:host {
|
|
88
|
+
--bg: #121212;
|
|
89
|
+
--card-bg: #161616;
|
|
90
|
+
--text: #f9fafb;
|
|
91
|
+
--muted: #94a3b8;
|
|
92
|
+
--border: #1f2937;
|
|
93
|
+
|
|
94
|
+
--header-bg: #222222;
|
|
95
|
+
--header-border-color: var(--border);
|
|
96
|
+
--header-border-width: 1px;
|
|
97
|
+
|
|
98
|
+
--cancel-bg: #0b1220;
|
|
99
|
+
--cancel-text: #ffffff;
|
|
100
|
+
|
|
101
|
+
--accent: #0f766e;
|
|
102
|
+
--accent-hover: #0d9488;
|
|
103
|
+
|
|
104
|
+
--shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.h2 {
|
|
109
|
+
background-color: var(--header-bg);
|
|
110
|
+
color: var(--text);
|
|
111
|
+
}
|
|
112
|
+
.section-header h2 {
|
|
113
|
+
background-color: var(--header-bg);
|
|
114
|
+
color: var(--text);
|
|
40
115
|
}
|
|
41
116
|
|
|
42
117
|
/* Header */
|
|
@@ -45,9 +120,10 @@
|
|
|
45
120
|
justify-content: space-between;
|
|
46
121
|
align-items: flex-end;
|
|
47
122
|
padding: 24px;
|
|
48
|
-
border-bottom:
|
|
49
|
-
background-color:
|
|
123
|
+
border-bottom: var(--header-border-width) solid var(--header-border-color);
|
|
124
|
+
background-color: var(--header-bg);
|
|
50
125
|
gap: 24px;
|
|
126
|
+
color: var(--text);
|
|
51
127
|
}
|
|
52
128
|
|
|
53
129
|
.header-inputs {
|
|
@@ -72,35 +148,126 @@
|
|
|
72
148
|
}
|
|
73
149
|
|
|
74
150
|
.cancel-button {
|
|
75
|
-
background-color:
|
|
76
|
-
color:
|
|
77
|
-
border: 1px solid
|
|
151
|
+
background-color: var(--cancel-bg);
|
|
152
|
+
color: var(--cancel-text);
|
|
153
|
+
border: 1px solid var(--border);
|
|
78
154
|
}
|
|
79
155
|
|
|
80
156
|
.cancel-button:hover {
|
|
81
|
-
background-color:
|
|
82
|
-
border-color:
|
|
157
|
+
background-color: rgba(0, 0, 0, 0.03);
|
|
158
|
+
border-color: var(--muted);
|
|
83
159
|
}
|
|
84
160
|
|
|
85
161
|
.save-button {
|
|
86
|
-
background-color:
|
|
87
|
-
color:
|
|
88
|
-
border: 1px solid
|
|
162
|
+
background-color: var(--accent);
|
|
163
|
+
color: var(--card-bg);
|
|
164
|
+
border: 1px solid var(--accent);
|
|
89
165
|
padding: 12px 24px;
|
|
90
166
|
font-weight: 600;
|
|
91
167
|
}
|
|
92
168
|
|
|
93
169
|
.save-button:hover {
|
|
94
|
-
background-color:
|
|
95
|
-
border-color:
|
|
170
|
+
background-color: var(--accent-hover);
|
|
171
|
+
border-color: var(--accent-hover);
|
|
96
172
|
}
|
|
97
173
|
|
|
98
174
|
/* Main Content */
|
|
99
175
|
.main-content {
|
|
100
176
|
padding: 0;
|
|
101
|
-
background-color:
|
|
177
|
+
background-color: var(--bg);
|
|
102
178
|
}
|
|
103
|
-
`,ct=
|
|
179
|
+
`,ct=L`
|
|
180
|
+
:host {
|
|
181
|
+
/* tokens - defaults (light) */
|
|
182
|
+
--form-label: #374151;
|
|
183
|
+
--form-label-size: 14px;
|
|
184
|
+
|
|
185
|
+
--input-bg: #ffffff;
|
|
186
|
+
--input-border: #d1d5db;
|
|
187
|
+
--input-border-focus: #3b82f6;
|
|
188
|
+
--input-focus-ring: rgba(59, 130, 246, 0.1);
|
|
189
|
+
--placeholder: #9ca3af;
|
|
190
|
+
--input-radius: 6px;
|
|
191
|
+
|
|
192
|
+
--content-columns-bg: #ffffff;
|
|
193
|
+
--content-columns-border: #e5e7eb;
|
|
194
|
+
--content-item-bg: #f9fafb;
|
|
195
|
+
|
|
196
|
+
--checkbox-label-color: #374151;
|
|
197
|
+
--checkbox-hover-bg: #f9fafb;
|
|
198
|
+
|
|
199
|
+
--single-checkbox-bg: #f0f9ff;
|
|
200
|
+
--single-checkbox-border: #bae6fd;
|
|
201
|
+
--single-checkbox-note: #0369a1;
|
|
202
|
+
|
|
203
|
+
--dropdown-bg: #ffffff;
|
|
204
|
+
--dropdown-border: #d1d5db;
|
|
205
|
+
--dropdown-item-hover: #f3f4f6;
|
|
206
|
+
--dropdown-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
|
207
|
+
|
|
208
|
+
--radius: 6px;
|
|
209
|
+
--shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/* dark theme (host opt-in) */
|
|
213
|
+
:host([theme="dark"]),
|
|
214
|
+
:host([data-theme="dark"]) {
|
|
215
|
+
--form-label: #95979c;
|
|
216
|
+
--input-bg: #0b1220;
|
|
217
|
+
--input-border: #1f2937;
|
|
218
|
+
--input-border-focus: #60a5fa;
|
|
219
|
+
--input-focus-ring: rgba(96, 165, 250, 0.08);
|
|
220
|
+
--placeholder: #94a3b8;
|
|
221
|
+
|
|
222
|
+
--content-columns-bg: #121212;
|
|
223
|
+
--content-columns-border: #1f2937;
|
|
224
|
+
--content-item-bg: #0b1220;
|
|
225
|
+
|
|
226
|
+
--checkbox-label-color: #dddddd;
|
|
227
|
+
--checkbox-hover-bg: #000000;
|
|
228
|
+
|
|
229
|
+
--single-checkbox-bg: #06202b;
|
|
230
|
+
--single-checkbox-border: rgba(186, 230, 253, 0.04);
|
|
231
|
+
--single-checkbox-note: #7fc3ff;
|
|
232
|
+
|
|
233
|
+
--dropdown-bg: #0f1724;
|
|
234
|
+
--dropdown-border: #374151;
|
|
235
|
+
--dropdown-item-hover: #06202b;
|
|
236
|
+
--dropdown-shadow: 0 4px 6px rgba(2, 6, 23, 0.6);
|
|
237
|
+
|
|
238
|
+
--shadow: 0 4px 6px rgba(2, 6, 23, 0.6);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/* respect system preference when not using shadow DOM */
|
|
242
|
+
@media (prefers-color-scheme: dark) {
|
|
243
|
+
:host {
|
|
244
|
+
--form-label: #95979c;
|
|
245
|
+
--input-bg: #0b1220;
|
|
246
|
+
--input-border: #1f2937;
|
|
247
|
+
--input-border-focus: #60a5fa;
|
|
248
|
+
--input-focus-ring: rgba(96, 165, 250, 0.08);
|
|
249
|
+
--placeholder: #94a3b8;
|
|
250
|
+
|
|
251
|
+
--content-columns-bg: #121212;
|
|
252
|
+
--content-columns-border: #1f2937;
|
|
253
|
+
--content-item-bg: #0b1220;
|
|
254
|
+
|
|
255
|
+
--checkbox-label-color: #dddddd;
|
|
256
|
+
--checkbox-hover-bg: #000000;
|
|
257
|
+
|
|
258
|
+
--single-checkbox-bg: #06202b;
|
|
259
|
+
--single-checkbox-border: rgba(186, 230, 253, 0.04);
|
|
260
|
+
--single-checkbox-note: #7fc3ff;
|
|
261
|
+
|
|
262
|
+
--dropdown-bg: #0f1724;
|
|
263
|
+
--dropdown-border: #374151;
|
|
264
|
+
--dropdown-item-hover: #06202b;
|
|
265
|
+
--dropdown-shadow: 0 4px 6px rgba(2, 6, 23, 0.6);
|
|
266
|
+
|
|
267
|
+
--shadow: 0 4px 6px rgba(2, 6, 23, 0.6);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
104
271
|
.form-group {
|
|
105
272
|
display: flex;
|
|
106
273
|
flex-direction: column;
|
|
@@ -109,40 +276,43 @@
|
|
|
109
276
|
|
|
110
277
|
.form-group label {
|
|
111
278
|
font-weight: 500;
|
|
112
|
-
color:
|
|
279
|
+
color: var(--form-label);
|
|
113
280
|
margin-bottom: 8px;
|
|
114
|
-
font-size:
|
|
281
|
+
font-size: var(--form-label-size);
|
|
115
282
|
}
|
|
116
283
|
|
|
117
284
|
.form-group input,
|
|
118
285
|
.form-group textarea {
|
|
119
286
|
padding: 12px;
|
|
120
|
-
border: 1px solid
|
|
121
|
-
border-radius:
|
|
287
|
+
border: 1px solid var(--input-border);
|
|
288
|
+
border-radius: var(--input-radius);
|
|
122
289
|
font-size: 14px;
|
|
123
290
|
transition: border-color 0.2s ease;
|
|
291
|
+
background: var(--input-bg);
|
|
292
|
+
color: inherit;
|
|
124
293
|
}
|
|
125
294
|
|
|
126
295
|
.form-group input:focus,
|
|
127
296
|
.form-group textarea:focus {
|
|
128
297
|
outline: none;
|
|
129
|
-
border-color:
|
|
130
|
-
box-shadow: 0 0 0 3px
|
|
298
|
+
border-color: var(--input-border-focus);
|
|
299
|
+
box-shadow: 0 0 0 3px var(--input-focus-ring);
|
|
300
|
+
background: var(--input-bg);
|
|
131
301
|
}
|
|
132
302
|
|
|
133
303
|
.form-group input::placeholder,
|
|
134
304
|
.form-group textarea::placeholder {
|
|
135
|
-
color:
|
|
305
|
+
color: var(--placeholder);
|
|
136
306
|
}
|
|
137
307
|
|
|
138
308
|
/* Two Column Layout */
|
|
139
309
|
.content-columns {
|
|
140
|
-
background-color:
|
|
310
|
+
background-color: var(--content-columns-bg);
|
|
141
311
|
display: grid;
|
|
142
312
|
grid-template-columns: 2fr 3fr;
|
|
143
313
|
min-height: 500px;
|
|
144
314
|
gap: 1px;
|
|
145
|
-
border: 1px solid
|
|
315
|
+
border: 1px solid var(--content-columns-border);
|
|
146
316
|
overflow: hidden;
|
|
147
317
|
}
|
|
148
318
|
|
|
@@ -163,15 +333,15 @@
|
|
|
163
333
|
align-items: center;
|
|
164
334
|
gap: 8px;
|
|
165
335
|
font-size: 14px;
|
|
166
|
-
color:
|
|
336
|
+
color: var(--checkbox-label-color);
|
|
167
337
|
cursor: pointer;
|
|
168
338
|
padding: 8px;
|
|
169
|
-
border-radius:
|
|
339
|
+
border-radius: var(--radius);
|
|
170
340
|
transition: background-color 0.2s ease;
|
|
171
341
|
}
|
|
172
342
|
|
|
173
343
|
.checkbox-type-label:hover {
|
|
174
|
-
background-color:
|
|
344
|
+
background-color: var(--checkbox-hover-bg);
|
|
175
345
|
}
|
|
176
346
|
|
|
177
347
|
.checkbox-type-label input[type="radio"] {
|
|
@@ -180,8 +350,8 @@
|
|
|
180
350
|
}
|
|
181
351
|
|
|
182
352
|
.single-checkbox-info {
|
|
183
|
-
background-color:
|
|
184
|
-
border: 1px solid
|
|
353
|
+
background-color: var(--single-checkbox-bg);
|
|
354
|
+
border: 1px solid var(--single-checkbox-border);
|
|
185
355
|
border-radius: 6px;
|
|
186
356
|
padding: 12px;
|
|
187
357
|
margin-top: 8px;
|
|
@@ -190,7 +360,7 @@
|
|
|
190
360
|
.single-checkbox-info .config-note {
|
|
191
361
|
margin: 0;
|
|
192
362
|
font-size: 14px;
|
|
193
|
-
color:
|
|
363
|
+
color: var(--single-checkbox-note);
|
|
194
364
|
font-style: italic;
|
|
195
365
|
}
|
|
196
366
|
|
|
@@ -210,10 +380,10 @@
|
|
|
210
380
|
position: absolute;
|
|
211
381
|
top: 100%;
|
|
212
382
|
right: 0;
|
|
213
|
-
background:
|
|
214
|
-
border: 1px solid
|
|
383
|
+
background: var(--dropdown-bg);
|
|
384
|
+
border: 1px solid var(--dropdown-border);
|
|
215
385
|
border-radius: 6px;
|
|
216
|
-
box-shadow:
|
|
386
|
+
box-shadow: var(--dropdown-shadow);
|
|
217
387
|
z-index: 1000;
|
|
218
388
|
min-width: 120px;
|
|
219
389
|
display: none;
|
|
@@ -228,7 +398,8 @@
|
|
|
228
398
|
width: 100%;
|
|
229
399
|
padding: 8px 12px;
|
|
230
400
|
border: none;
|
|
231
|
-
background:
|
|
401
|
+
background: var(--dropdown-bg);
|
|
402
|
+
color: inherit;
|
|
232
403
|
text-align: left;
|
|
233
404
|
font-size: 14px;
|
|
234
405
|
cursor: pointer;
|
|
@@ -236,15 +407,15 @@
|
|
|
236
407
|
}
|
|
237
408
|
|
|
238
409
|
.content-options button:hover {
|
|
239
|
-
background-color:
|
|
410
|
+
background-color: var(--dropdown-item-hover);
|
|
240
411
|
}
|
|
241
412
|
|
|
242
413
|
.content-item {
|
|
243
|
-
border: 1px solid
|
|
414
|
+
border: 1px solid var(--content-columns-border);
|
|
244
415
|
border-radius: 6px;
|
|
245
416
|
padding: 16px;
|
|
246
417
|
margin-bottom: 12px;
|
|
247
|
-
background:
|
|
418
|
+
background: var(--content-item-bg);
|
|
248
419
|
}
|
|
249
420
|
|
|
250
421
|
.content-header {
|
|
@@ -258,7 +429,7 @@
|
|
|
258
429
|
margin: 0;
|
|
259
430
|
font-size: 16px;
|
|
260
431
|
font-weight: 600;
|
|
261
|
-
color:
|
|
432
|
+
color: var(--form-label);
|
|
262
433
|
}
|
|
263
434
|
|
|
264
435
|
.content-header-controls {
|
|
@@ -269,10 +440,11 @@
|
|
|
269
440
|
|
|
270
441
|
.content-type-select {
|
|
271
442
|
padding: 4px 8px;
|
|
272
|
-
border: 1px solid
|
|
443
|
+
border: 1px solid var(--input-border);
|
|
273
444
|
border-radius: 4px;
|
|
274
445
|
font-size: 12px;
|
|
275
|
-
background:
|
|
446
|
+
background: var(--dropdown-bg);
|
|
447
|
+
color: inherit;
|
|
276
448
|
}
|
|
277
449
|
|
|
278
450
|
.content-config-section {
|
|
@@ -283,23 +455,107 @@
|
|
|
283
455
|
width: 100%;
|
|
284
456
|
min-height: 80px;
|
|
285
457
|
padding: 8px;
|
|
286
|
-
border: 1px solid
|
|
458
|
+
border: 1px solid var(--input-border);
|
|
287
459
|
border-radius: 4px;
|
|
288
460
|
font-size: 14px;
|
|
289
461
|
font-family: inherit;
|
|
290
462
|
resize: vertical;
|
|
463
|
+
background: var(--input-bg);
|
|
464
|
+
color: inherit;
|
|
465
|
+
scrollbar-color: var(--input-border) transparent;
|
|
291
466
|
}
|
|
292
467
|
|
|
293
468
|
.config-textarea:focus {
|
|
294
469
|
outline: none;
|
|
295
|
-
border-color:
|
|
296
|
-
box-shadow: 0 0 0 3px
|
|
470
|
+
border-color: var(--input-border-focus);
|
|
471
|
+
box-shadow: 0 0 0 3px var(--input-focus-ring);
|
|
472
|
+
}
|
|
473
|
+
`,ut=L`
|
|
474
|
+
/* Theme tokens (defaults) */
|
|
475
|
+
:host {
|
|
476
|
+
--section-bg: #ffffff;
|
|
477
|
+
--section-text: #111827;
|
|
478
|
+
--section-muted: #6b7280;
|
|
479
|
+
--section-border: #e5e7eb;
|
|
480
|
+
|
|
481
|
+
--section-header-bg: #ffffff;
|
|
482
|
+
--section-header-text: #111827;
|
|
483
|
+
|
|
484
|
+
--primary: #3b82f6;
|
|
485
|
+
--primary-contrast: #ffffff;
|
|
486
|
+
--primary-focus-ring: rgba(59, 130, 246, 0.08);
|
|
487
|
+
|
|
488
|
+
--danger: #ef4444;
|
|
489
|
+
--danger-bg: #fee2e2;
|
|
490
|
+
|
|
491
|
+
--muted-bg: #f9fafb;
|
|
492
|
+
--muted-alt-bg: #f8fafc;
|
|
493
|
+
|
|
494
|
+
--card-bg: #ffffff;
|
|
495
|
+
|
|
496
|
+
--radius-md: 6px;
|
|
497
|
+
--radius-sm: 4px;
|
|
498
|
+
|
|
499
|
+
--shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
/* Dark theme support on the host */
|
|
503
|
+
:host([theme="dark"]),
|
|
504
|
+
:host([data-theme="dark"]) {
|
|
505
|
+
--section-bg: #0b1220;
|
|
506
|
+
--section-text: #f8fafc;
|
|
507
|
+
--section-muted: #94a3b8;
|
|
508
|
+
--section-border: #1f2937;
|
|
509
|
+
|
|
510
|
+
--section-header-bg: #0f1724;
|
|
511
|
+
--section-header-text: #f8fafc;
|
|
512
|
+
|
|
513
|
+
--primary: #60a5fa;
|
|
514
|
+
--primary-contrast: #0b1220;
|
|
515
|
+
--primary-focus-ring: rgba(96, 165, 250, 0.08);
|
|
516
|
+
|
|
517
|
+
--danger: #f87171;
|
|
518
|
+
--danger-bg: #3b0b0b;
|
|
519
|
+
|
|
520
|
+
--muted-bg: transparent;
|
|
521
|
+
--muted-alt-bg: transparent;
|
|
522
|
+
|
|
523
|
+
--card-bg: #0b1220;
|
|
524
|
+
|
|
525
|
+
--shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.6);
|
|
297
526
|
}
|
|
298
|
-
|
|
527
|
+
|
|
528
|
+
/* Also respect system preference when not in shadow DOM */
|
|
529
|
+
@media (prefers-color-scheme: dark) {
|
|
530
|
+
:host {
|
|
531
|
+
--section-bg: #0b1220;
|
|
532
|
+
--section-text: #f8fafc;
|
|
533
|
+
--section-muted: #94a3b8;
|
|
534
|
+
--section-border: #1f2937;
|
|
535
|
+
|
|
536
|
+
--section-header-bg: #0f1724;
|
|
537
|
+
--section-header-text: #f8fafc;
|
|
538
|
+
|
|
539
|
+
--primary: #60a5fa;
|
|
540
|
+
--primary-contrast: #0b1220;
|
|
541
|
+
--primary-focus-ring: rgba(96, 165, 250, 0.08);
|
|
542
|
+
|
|
543
|
+
--danger: #f87171;
|
|
544
|
+
--danger-bg: #3b0b0b;
|
|
545
|
+
|
|
546
|
+
--muted-bg: transparent;
|
|
547
|
+
--muted-alt-bg: transparent;
|
|
548
|
+
|
|
549
|
+
--card-bg: #0b1220;
|
|
550
|
+
|
|
551
|
+
--shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.6);
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
|
|
299
555
|
/* Steps and Questions Sections */
|
|
300
556
|
.section {
|
|
301
557
|
padding: 16px;
|
|
302
|
-
background-color:
|
|
558
|
+
background-color: var(--section-bg);
|
|
303
559
|
}
|
|
304
560
|
|
|
305
561
|
.section-header {
|
|
@@ -313,15 +569,15 @@
|
|
|
313
569
|
margin: 0;
|
|
314
570
|
font-size: 18px;
|
|
315
571
|
font-weight: 600;
|
|
316
|
-
color:
|
|
572
|
+
color: var(--section-header-text);
|
|
317
573
|
}
|
|
318
574
|
|
|
319
575
|
.add-button {
|
|
320
|
-
background-color:
|
|
321
|
-
color:
|
|
322
|
-
border: 1px solid
|
|
576
|
+
background-color: var(--muted-bg); /* Gray background to match sections */
|
|
577
|
+
color: var(--primary);
|
|
578
|
+
border: 1px solid var(--primary);
|
|
323
579
|
padding: 6px 12px;
|
|
324
|
-
border-radius:
|
|
580
|
+
border-radius: var(--radius-md);
|
|
325
581
|
font-size: 14px;
|
|
326
582
|
font-weight: 500;
|
|
327
583
|
cursor: pointer;
|
|
@@ -332,7 +588,7 @@
|
|
|
332
588
|
}
|
|
333
589
|
|
|
334
590
|
.add-button:hover {
|
|
335
|
-
background-color:
|
|
591
|
+
background-color: var(--muted-alt-bg); /* Slightly darker gray on hover */
|
|
336
592
|
}
|
|
337
593
|
|
|
338
594
|
.add-button::before {
|
|
@@ -355,26 +611,26 @@
|
|
|
355
611
|
margin: 0 0 8px 0;
|
|
356
612
|
font-size: 16px;
|
|
357
613
|
font-weight: 600;
|
|
358
|
-
color:
|
|
614
|
+
color: var(--section-muted); /* Gray text color */
|
|
359
615
|
}
|
|
360
616
|
|
|
361
617
|
.empty-state p {
|
|
362
618
|
margin: 0 0 24px 0;
|
|
363
|
-
color:
|
|
619
|
+
color: var(--section-muted);
|
|
364
620
|
font-size: 14px;
|
|
365
621
|
line-height: 1.5;
|
|
366
622
|
}
|
|
367
623
|
|
|
368
624
|
.empty-state .add-button {
|
|
369
|
-
background-color:
|
|
370
|
-
color:
|
|
371
|
-
border: 1px solid
|
|
625
|
+
background-color: var(--muted-bg); /* Lighter gray to match background */
|
|
626
|
+
color: var(--primary); /* Blue text to match header buttons */
|
|
627
|
+
border: 1px solid var(--primary); /* Blue border to match header buttons */
|
|
372
628
|
padding: 8px 16px;
|
|
373
629
|
margin: 0 auto; /* Center the button horizontally */
|
|
374
630
|
}
|
|
375
631
|
|
|
376
632
|
.empty-state .add-button:hover {
|
|
377
|
-
background-color:
|
|
633
|
+
background-color: var(--muted-alt-bg); /* Slightly darker gray on hover */
|
|
378
634
|
}
|
|
379
635
|
|
|
380
636
|
/* Steps for Questions Section */
|
|
@@ -386,24 +642,24 @@
|
|
|
386
642
|
.steps-empty-state h3 {
|
|
387
643
|
text-align: center; /* Center the heading */
|
|
388
644
|
margin-bottom: 4px;
|
|
389
|
-
color:
|
|
645
|
+
color: var(--section-muted); /* Gray text color */
|
|
390
646
|
}
|
|
391
647
|
|
|
392
648
|
.steps-empty-state p {
|
|
393
649
|
text-align: center; /* Center the text */
|
|
394
650
|
margin-bottom: 16px;
|
|
395
|
-
color:
|
|
651
|
+
color: var(--section-muted);
|
|
396
652
|
}
|
|
397
653
|
|
|
398
654
|
.steps-empty-state .add-button {
|
|
399
|
-
background-color:
|
|
400
|
-
color:
|
|
401
|
-
border: 1px solid
|
|
655
|
+
background-color: var(--muted-bg); /* Lighter gray to match background */
|
|
656
|
+
color: var(--primary); /* Blue text to match header buttons */
|
|
657
|
+
border: 1px solid var(--primary); /* Blue border to match header buttons */
|
|
402
658
|
margin: 0 auto; /* Center the button horizontally */
|
|
403
659
|
}
|
|
404
660
|
|
|
405
661
|
.steps-empty-state .add-button:hover {
|
|
406
|
-
background-color:
|
|
662
|
+
background-color: var(--muted-alt-bg); /* Slightly darker gray on hover */
|
|
407
663
|
}
|
|
408
664
|
|
|
409
665
|
/* Disabled States */
|
|
@@ -427,12 +683,13 @@
|
|
|
427
683
|
|
|
428
684
|
.question-item {
|
|
429
685
|
padding: 16px;
|
|
430
|
-
border: 1px solid
|
|
686
|
+
border: 1px solid var(--section-border);
|
|
431
687
|
border-radius: 8px;
|
|
432
|
-
background-color:
|
|
688
|
+
background-color: var(--card-bg);
|
|
433
689
|
display: flex;
|
|
434
690
|
flex-direction: column;
|
|
435
691
|
gap: 8px;
|
|
692
|
+
box-shadow: var(--shadow-sm);
|
|
436
693
|
}
|
|
437
694
|
|
|
438
695
|
.question-header {
|
|
@@ -447,7 +704,7 @@
|
|
|
447
704
|
margin: 0;
|
|
448
705
|
font-size: 16px;
|
|
449
706
|
font-weight: 600;
|
|
450
|
-
color:
|
|
707
|
+
color: var(--section-text);
|
|
451
708
|
flex: 1;
|
|
452
709
|
}
|
|
453
710
|
|
|
@@ -459,52 +716,54 @@
|
|
|
459
716
|
|
|
460
717
|
.question-type-select {
|
|
461
718
|
padding: 6px 10px;
|
|
462
|
-
border: 1px solid
|
|
463
|
-
border-radius:
|
|
464
|
-
background-color:
|
|
719
|
+
border: 1px solid var(--section-border);
|
|
720
|
+
border-radius: var(--radius-md);
|
|
721
|
+
background-color: var(--card-bg);
|
|
465
722
|
font-size: 13px;
|
|
466
|
-
color:
|
|
723
|
+
color: var(--section-text);
|
|
467
724
|
min-width: 140px;
|
|
468
725
|
}
|
|
469
726
|
|
|
470
727
|
.question-type-select:focus {
|
|
471
728
|
outline: none;
|
|
472
|
-
border-color:
|
|
473
|
-
box-shadow: 0 0 0 3px
|
|
729
|
+
border-color: var(--primary);
|
|
730
|
+
box-shadow: 0 0 0 3px var(--primary-focus-ring);
|
|
474
731
|
}
|
|
475
732
|
|
|
476
733
|
.delete-question-button {
|
|
477
734
|
background: none;
|
|
478
735
|
border: none;
|
|
479
|
-
color:
|
|
736
|
+
color: var(--danger);
|
|
480
737
|
font-size: 16px;
|
|
481
738
|
cursor: pointer;
|
|
482
739
|
padding: 4px;
|
|
483
740
|
border-radius: 4px;
|
|
484
741
|
transition: all 0.2s ease;
|
|
742
|
+
line-height: 1;
|
|
485
743
|
}
|
|
486
744
|
|
|
487
745
|
.delete-question-button:hover {
|
|
488
|
-
background-color:
|
|
746
|
+
background-color: var(--danger-bg);
|
|
489
747
|
}
|
|
490
748
|
|
|
491
749
|
.question-label-input {
|
|
492
750
|
padding: 12px;
|
|
493
|
-
border: 1px solid
|
|
751
|
+
border: 1px solid var(--section-border);
|
|
494
752
|
border-radius: 6px;
|
|
495
753
|
font-size: 14px;
|
|
496
|
-
background-color:
|
|
754
|
+
background-color: var(--card-bg);
|
|
497
755
|
transition: border-color 0.2s ease;
|
|
756
|
+
color: var(--section-text);
|
|
498
757
|
}
|
|
499
758
|
|
|
500
759
|
.question-label-input:focus {
|
|
501
760
|
outline: none;
|
|
502
|
-
border-color:
|
|
503
|
-
box-shadow: 0 0 0 3px
|
|
761
|
+
border-color: var(--primary);
|
|
762
|
+
box-shadow: 0 0 0 3px var(--primary-focus-ring);
|
|
504
763
|
}
|
|
505
764
|
|
|
506
765
|
.question-label-input::placeholder {
|
|
507
|
-
color:
|
|
766
|
+
color: var(--section-muted);
|
|
508
767
|
}
|
|
509
768
|
|
|
510
769
|
.question-required-label {
|
|
@@ -512,7 +771,7 @@
|
|
|
512
771
|
align-items: center;
|
|
513
772
|
gap: 8px;
|
|
514
773
|
font-size: 14px;
|
|
515
|
-
color:
|
|
774
|
+
color: var(--section-text);
|
|
516
775
|
cursor: pointer;
|
|
517
776
|
}
|
|
518
777
|
|
|
@@ -522,9 +781,9 @@
|
|
|
522
781
|
}
|
|
523
782
|
|
|
524
783
|
.add-question-button {
|
|
525
|
-
background-color:
|
|
526
|
-
color:
|
|
527
|
-
border: 1px solid
|
|
784
|
+
background-color: var(--muted-bg);
|
|
785
|
+
color: var(--primary);
|
|
786
|
+
border: 1px solid var(--primary);
|
|
528
787
|
padding: 8px 16px;
|
|
529
788
|
border-radius: 6px;
|
|
530
789
|
font-size: 14px;
|
|
@@ -539,7 +798,7 @@
|
|
|
539
798
|
}
|
|
540
799
|
|
|
541
800
|
.add-question-button:hover {
|
|
542
|
-
background-color:
|
|
801
|
+
background-color: var(--muted-alt-bg);
|
|
543
802
|
}
|
|
544
803
|
|
|
545
804
|
.add-question-button::before {
|
|
@@ -553,7 +812,7 @@
|
|
|
553
812
|
.question-config-section {
|
|
554
813
|
margin-top: 8px;
|
|
555
814
|
padding-top: 8px;
|
|
556
|
-
border-top: 1px solid
|
|
815
|
+
border-top: 1px solid var(--section-border);
|
|
557
816
|
}
|
|
558
817
|
|
|
559
818
|
.options-label,
|
|
@@ -561,7 +820,7 @@
|
|
|
561
820
|
display: block;
|
|
562
821
|
font-size: 13px;
|
|
563
822
|
font-weight: 500;
|
|
564
|
-
color:
|
|
823
|
+
color: var(--section-text);
|
|
565
824
|
margin-bottom: 8px;
|
|
566
825
|
}
|
|
567
826
|
|
|
@@ -580,22 +839,23 @@
|
|
|
580
839
|
.option-input {
|
|
581
840
|
flex: 1;
|
|
582
841
|
padding: 8px 10px;
|
|
583
|
-
border: 1px solid
|
|
842
|
+
border: 1px solid var(--section-border);
|
|
584
843
|
border-radius: 4px;
|
|
585
844
|
font-size: 13px;
|
|
586
|
-
background-color:
|
|
845
|
+
background-color: var(--card-bg);
|
|
846
|
+
color: var(--section-text);
|
|
587
847
|
}
|
|
588
848
|
|
|
589
849
|
.option-input:focus {
|
|
590
850
|
outline: none;
|
|
591
|
-
border-color:
|
|
592
|
-
box-shadow: 0 0 0 2px
|
|
851
|
+
border-color: var(--primary);
|
|
852
|
+
box-shadow: 0 0 0 2px var(--primary-focus-ring);
|
|
593
853
|
}
|
|
594
854
|
|
|
595
855
|
.remove-option-button {
|
|
596
856
|
background: none;
|
|
597
857
|
border: none;
|
|
598
|
-
color:
|
|
858
|
+
color: var(--danger);
|
|
599
859
|
font-size: 16px;
|
|
600
860
|
cursor: pointer;
|
|
601
861
|
padding: 4px 6px;
|
|
@@ -605,13 +865,13 @@
|
|
|
605
865
|
}
|
|
606
866
|
|
|
607
867
|
.remove-option-button:hover {
|
|
608
|
-
background-color:
|
|
868
|
+
background-color: var(--danger-bg);
|
|
609
869
|
}
|
|
610
870
|
|
|
611
871
|
.add-option-button {
|
|
612
872
|
background: none;
|
|
613
|
-
border: 1px dashed
|
|
614
|
-
color:
|
|
873
|
+
border: 1px dashed var(--section-border);
|
|
874
|
+
color: var(--section-muted);
|
|
615
875
|
padding: 8px 12px;
|
|
616
876
|
border-radius: 4px;
|
|
617
877
|
font-size: 13px;
|
|
@@ -621,38 +881,135 @@
|
|
|
621
881
|
}
|
|
622
882
|
|
|
623
883
|
.add-option-button:hover {
|
|
624
|
-
border-color:
|
|
625
|
-
color:
|
|
626
|
-
background-color:
|
|
884
|
+
border-color: var(--primary);
|
|
885
|
+
color: var(--primary);
|
|
886
|
+
background-color: var(--muted-alt-bg);
|
|
627
887
|
}
|
|
628
888
|
|
|
629
889
|
.config-input {
|
|
630
890
|
width: 100%;
|
|
631
891
|
padding: 8px 10px;
|
|
632
|
-
border: 1px solid
|
|
892
|
+
border: 1px solid var(--section-border);
|
|
633
893
|
border-radius: 4px;
|
|
634
894
|
font-size: 13px;
|
|
635
|
-
background-color:
|
|
895
|
+
background-color: var(--card-bg);
|
|
636
896
|
margin-top: 4px;
|
|
897
|
+
color: var(--section-text);
|
|
637
898
|
}
|
|
638
899
|
|
|
639
900
|
.config-input:focus {
|
|
640
901
|
outline: none;
|
|
641
|
-
border-color:
|
|
642
|
-
box-shadow: 0 0 0 2px
|
|
902
|
+
border-color: var(--primary);
|
|
903
|
+
box-shadow: 0 0 0 2px var(--primary-focus-ring);
|
|
643
904
|
}
|
|
644
905
|
|
|
645
906
|
.config-note {
|
|
646
907
|
margin: 0;
|
|
647
908
|
font-size: 13px;
|
|
648
|
-
color:
|
|
909
|
+
color: var(--section-muted);
|
|
649
910
|
font-style: italic;
|
|
650
911
|
padding: 8px 12px;
|
|
651
|
-
background-color:
|
|
912
|
+
background-color: var(--muted-alt-bg);
|
|
652
913
|
border-radius: 4px;
|
|
653
|
-
border-left: 3px solid
|
|
914
|
+
border-left: 3px solid var(--section-border);
|
|
654
915
|
}
|
|
655
|
-
`,
|
|
916
|
+
`,Ue=L`
|
|
917
|
+
/* Theme tokens (defaults) */
|
|
918
|
+
:host {
|
|
919
|
+
--bg: #f8fafc;
|
|
920
|
+
|
|
921
|
+
--panel-bg: #ffffff;
|
|
922
|
+
--card-bg: #ffffff;
|
|
923
|
+
--text: #111827;
|
|
924
|
+
--muted: #6b7280;
|
|
925
|
+
--muted-weak: #9ca3af;
|
|
926
|
+
--muted-surface: #f3f4f6;
|
|
927
|
+
--muted-border: #d1d5db
|
|
928
|
+
--border: #e5e7eb;
|
|
929
|
+
|
|
930
|
+
--primary: #3b82f6;
|
|
931
|
+
--primary-600: #2563eb;
|
|
932
|
+
--primary-600-border: #1d4ed8;
|
|
933
|
+
--primary-100-bg: #eff6ff;
|
|
934
|
+
--primary-badge-bg: #e0e7ff;
|
|
935
|
+
--primary-badge-text: #3730a3;
|
|
936
|
+
|
|
937
|
+
--danger: #ef4444;
|
|
938
|
+
--danger-100-bg: #fef2f2;
|
|
939
|
+
|
|
940
|
+
--success: #22c55e;
|
|
941
|
+
|
|
942
|
+
--shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
|
|
943
|
+
--shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
|
|
944
|
+
--shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
|
|
945
|
+
|
|
946
|
+
--radius-md: 6px;
|
|
947
|
+
--radius-lg: 12px;
|
|
948
|
+
|
|
949
|
+
--overlay-bg: rgba(0, 0, 0, 0.4);
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
/* Dark theme on host */
|
|
953
|
+
:host([theme="dark"]),
|
|
954
|
+
:host([data-theme="dark"]) {
|
|
955
|
+
--bg: #0b1220;
|
|
956
|
+
--panel-bg: #0f1724;
|
|
957
|
+
--card-bg: #0b1220;
|
|
958
|
+
--text: #f8fafc;
|
|
959
|
+
--muted: #94a3b8;
|
|
960
|
+
--muted-weak: #374151;
|
|
961
|
+
--muted-surface: #06202b;
|
|
962
|
+
--border: #1f2937;
|
|
963
|
+
|
|
964
|
+
--primary: #60a5fa;
|
|
965
|
+
--primary-600: #3b82f6;
|
|
966
|
+
--primary-100-bg: #0b2a4a;
|
|
967
|
+
--primary-badge-bg: #0b1b3b;
|
|
968
|
+
--primary-badge-text: #cfe7ff;
|
|
969
|
+
|
|
970
|
+
--danger: #f87171;
|
|
971
|
+
--danger-100-bg: rgba(248, 113, 113, 0.08);
|
|
972
|
+
|
|
973
|
+
--success: #22c55e;
|
|
974
|
+
|
|
975
|
+
--shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.6);
|
|
976
|
+
--shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.6);
|
|
977
|
+
--shadow-md: 0 2px 8px rgba(2, 6, 23, 0.6);
|
|
978
|
+
|
|
979
|
+
--overlay-bg: rgba(0, 0, 0, 0.6);
|
|
980
|
+
}
|
|
981
|
+
|
|
982
|
+
/* Respect system preference (non-shadow DOM usage) */
|
|
983
|
+
@media (prefers-color-scheme: dark) {
|
|
984
|
+
:host {
|
|
985
|
+
--bg: #0b1220;
|
|
986
|
+
--panel-bg: #0f1724;
|
|
987
|
+
--card-bg: #0b1220;
|
|
988
|
+
--text: #f8fafc;
|
|
989
|
+
--muted: #94a3b8;
|
|
990
|
+
--muted-weak: #374151;
|
|
991
|
+
--muted-surface: #06202b;
|
|
992
|
+
--border: #1f2937;
|
|
993
|
+
|
|
994
|
+
--primary: #60a5fa;
|
|
995
|
+
--primary-600: #3b82f6;
|
|
996
|
+
--primary-100-bg: #0b2a4a;
|
|
997
|
+
--primary-badge-bg: #0b1b3b;
|
|
998
|
+
--primary-badge-text: #cfe7ff;
|
|
999
|
+
|
|
1000
|
+
--danger: #f87171;
|
|
1001
|
+
--danger-100-bg: rgba(248, 113, 113, 0.08);
|
|
1002
|
+
|
|
1003
|
+
--success: #22c55e;
|
|
1004
|
+
|
|
1005
|
+
--shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.6);
|
|
1006
|
+
--shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.6);
|
|
1007
|
+
--shadow-md: 0 2px 8px rgba(2, 6, 23, 0.6);
|
|
1008
|
+
|
|
1009
|
+
--overlay-bg: rgba(0, 0, 0, 0.6);
|
|
1010
|
+
}
|
|
1011
|
+
}
|
|
1012
|
+
|
|
656
1013
|
/* Builder Step Styles */
|
|
657
1014
|
.steps-list {
|
|
658
1015
|
display: flex;
|
|
@@ -664,26 +1021,26 @@
|
|
|
664
1021
|
display: flex;
|
|
665
1022
|
align-items: center;
|
|
666
1023
|
padding: 12px;
|
|
667
|
-
border: 1px solid
|
|
668
|
-
border-radius:
|
|
669
|
-
background-color:
|
|
1024
|
+
border: 1px solid var(--border);
|
|
1025
|
+
border-radius: var(--radius-md);
|
|
1026
|
+
background-color: var(--card-bg);
|
|
670
1027
|
cursor: pointer;
|
|
671
1028
|
transition: all 0.2s ease;
|
|
672
1029
|
gap: 12px;
|
|
673
1030
|
}
|
|
674
1031
|
|
|
675
1032
|
.step-item:hover {
|
|
676
|
-
border-color:
|
|
677
|
-
background-color:
|
|
1033
|
+
border-color: var(--muted-border);
|
|
1034
|
+
background-color: var(--muted-surface);
|
|
678
1035
|
}
|
|
679
1036
|
|
|
680
1037
|
.step-item.selected {
|
|
681
|
-
border-color:
|
|
682
|
-
background-color:
|
|
1038
|
+
border-color: var(--primary);
|
|
1039
|
+
background-color: var(--primary-100-bg);
|
|
683
1040
|
}
|
|
684
1041
|
|
|
685
1042
|
.step-handle {
|
|
686
|
-
color:
|
|
1043
|
+
color: var(--muted);
|
|
687
1044
|
font-size: 14px;
|
|
688
1045
|
cursor: grab;
|
|
689
1046
|
user-select: none;
|
|
@@ -702,7 +1059,7 @@
|
|
|
702
1059
|
|
|
703
1060
|
.step-content strong {
|
|
704
1061
|
font-weight: 600;
|
|
705
|
-
color:
|
|
1062
|
+
color: var(--text);
|
|
706
1063
|
font-size: 14px;
|
|
707
1064
|
}
|
|
708
1065
|
|
|
@@ -715,7 +1072,7 @@
|
|
|
715
1072
|
.step-menu {
|
|
716
1073
|
background: none;
|
|
717
1074
|
border: none;
|
|
718
|
-
color:
|
|
1075
|
+
color: var(--muted-weak);
|
|
719
1076
|
font-size: 16px;
|
|
720
1077
|
cursor: pointer;
|
|
721
1078
|
padding: 4px;
|
|
@@ -724,8 +1081,8 @@
|
|
|
724
1081
|
}
|
|
725
1082
|
|
|
726
1083
|
.step-menu:hover {
|
|
727
|
-
background-color:
|
|
728
|
-
color:
|
|
1084
|
+
background-color: var(--muted-surface);
|
|
1085
|
+
color: var(--muted);
|
|
729
1086
|
}
|
|
730
1087
|
|
|
731
1088
|
.step-menu-container {
|
|
@@ -736,12 +1093,10 @@
|
|
|
736
1093
|
position: absolute;
|
|
737
1094
|
top: calc(100% + 4px);
|
|
738
1095
|
right: 0;
|
|
739
|
-
background:
|
|
740
|
-
border: 1px solid
|
|
741
|
-
border-radius:
|
|
742
|
-
box-shadow:
|
|
743
|
-
0 4px 6px -1px rgba(0, 0, 0, 0.1),
|
|
744
|
-
0 2px 4px -1px rgba(0, 0, 0, 0.06);
|
|
1096
|
+
background: var(--panel-bg);
|
|
1097
|
+
border: 1px solid var(--border);
|
|
1098
|
+
border-radius: var(--radius-lg);
|
|
1099
|
+
box-shadow: var(--shadow-md);
|
|
745
1100
|
min-width: 160px;
|
|
746
1101
|
z-index: 100;
|
|
747
1102
|
overflow: hidden;
|
|
@@ -758,21 +1113,21 @@
|
|
|
758
1113
|
text-align: left;
|
|
759
1114
|
cursor: pointer;
|
|
760
1115
|
font-size: 14px;
|
|
761
|
-
color:
|
|
1116
|
+
color: var(--text);
|
|
762
1117
|
transition: background 0.2s;
|
|
763
1118
|
font-family: inherit;
|
|
764
1119
|
}
|
|
765
1120
|
|
|
766
1121
|
.step-menu-item:hover {
|
|
767
|
-
background:
|
|
1122
|
+
background: var(--muted-surface);
|
|
768
1123
|
}
|
|
769
1124
|
|
|
770
1125
|
.step-menu-item.danger {
|
|
771
|
-
color:
|
|
1126
|
+
color: var(--danger);
|
|
772
1127
|
}
|
|
773
1128
|
|
|
774
1129
|
.step-menu-item.danger:hover {
|
|
775
|
-
background:
|
|
1130
|
+
background: var(--danger-100-bg);
|
|
776
1131
|
}
|
|
777
1132
|
|
|
778
1133
|
.step-menu-icon {
|
|
@@ -780,12 +1135,13 @@
|
|
|
780
1135
|
width: 20px;
|
|
781
1136
|
text-align: center;
|
|
782
1137
|
}
|
|
1138
|
+
|
|
783
1139
|
.runner-layout {
|
|
784
1140
|
display: flex;
|
|
785
1141
|
width: 100%;
|
|
786
1142
|
min-height: 100vh;
|
|
787
1143
|
box-sizing: border-box;
|
|
788
|
-
background:
|
|
1144
|
+
background: var(--bg);
|
|
789
1145
|
gap: 32px;
|
|
790
1146
|
overflow: hidden;
|
|
791
1147
|
position: relative;
|
|
@@ -798,7 +1154,7 @@
|
|
|
798
1154
|
left: 0;
|
|
799
1155
|
right: 0;
|
|
800
1156
|
bottom: 0;
|
|
801
|
-
background:
|
|
1157
|
+
background: var(--overlay-bg);
|
|
802
1158
|
display: flex;
|
|
803
1159
|
align-items: flex-start;
|
|
804
1160
|
justify-content: center;
|
|
@@ -808,12 +1164,10 @@
|
|
|
808
1164
|
}
|
|
809
1165
|
|
|
810
1166
|
.runner-loading-box {
|
|
811
|
-
background:
|
|
1167
|
+
background: var(--panel-bg);
|
|
812
1168
|
border-radius: 8px;
|
|
813
1169
|
padding: 24px 48px;
|
|
814
|
-
box-shadow:
|
|
815
|
-
0 1px 3px 0 rgba(0, 0, 0, 0.1),
|
|
816
|
-
0 1px 2px -1px rgba(0, 0, 0, 0.1);
|
|
1170
|
+
box-shadow: var(--shadow-sm);
|
|
817
1171
|
display: flex;
|
|
818
1172
|
flex-direction: row;
|
|
819
1173
|
align-items: center;
|
|
@@ -825,14 +1179,14 @@
|
|
|
825
1179
|
.runner-loading-spinner {
|
|
826
1180
|
width: 48px;
|
|
827
1181
|
height: 48px;
|
|
828
|
-
border: 4px solid
|
|
829
|
-
border-top: 4px solid
|
|
1182
|
+
border: 4px solid var(--border);
|
|
1183
|
+
border-top: 4px solid var(--primary);
|
|
830
1184
|
border-radius: 50%;
|
|
831
1185
|
animation: runner-spin 1s linear infinite;
|
|
832
1186
|
}
|
|
833
1187
|
|
|
834
1188
|
.runner-loading-text {
|
|
835
|
-
color:
|
|
1189
|
+
color: var(--muted);
|
|
836
1190
|
font-size: 16px;
|
|
837
1191
|
font-weight: 500;
|
|
838
1192
|
text-align: center;
|
|
@@ -850,8 +1204,8 @@
|
|
|
850
1204
|
.runner-sidebar {
|
|
851
1205
|
width: 380px;
|
|
852
1206
|
min-width: 320px;
|
|
853
|
-
background:
|
|
854
|
-
border-right: 1px solid
|
|
1207
|
+
background: var(--bg);
|
|
1208
|
+
border-right: 1px solid var(--border);
|
|
855
1209
|
padding: 40px 32px 40px 32px;
|
|
856
1210
|
display: flex;
|
|
857
1211
|
flex-direction: column;
|
|
@@ -862,7 +1216,7 @@
|
|
|
862
1216
|
.runner-sidebar-header {
|
|
863
1217
|
font-size: 1.15rem;
|
|
864
1218
|
font-weight: 700;
|
|
865
|
-
color:
|
|
1219
|
+
color: var(--text);
|
|
866
1220
|
margin-bottom: 24px;
|
|
867
1221
|
letter-spacing: 0.01em;
|
|
868
1222
|
text-align: left;
|
|
@@ -883,8 +1237,8 @@
|
|
|
883
1237
|
justify-content: space-between;
|
|
884
1238
|
padding: 18px 18px 18px 20px;
|
|
885
1239
|
border-radius: 12px;
|
|
886
|
-
background:
|
|
887
|
-
box-shadow:
|
|
1240
|
+
background: var(--card-bg);
|
|
1241
|
+
box-shadow: var(--shadow-xs);
|
|
888
1242
|
margin-bottom: 0;
|
|
889
1243
|
cursor: pointer;
|
|
890
1244
|
border: 2px solid transparent;
|
|
@@ -893,26 +1247,30 @@
|
|
|
893
1247
|
box-shadow 0.2s;
|
|
894
1248
|
gap: 12px;
|
|
895
1249
|
}
|
|
1250
|
+
|
|
896
1251
|
.runner-step-item.active {
|
|
897
|
-
border: 2px solid
|
|
898
|
-
background:
|
|
1252
|
+
border: 2px solid var(--primary);
|
|
1253
|
+
background: var(--card-bg);
|
|
899
1254
|
box-shadow: 0 2px 8px rgba(59, 130, 246, 0.08);
|
|
900
1255
|
}
|
|
1256
|
+
|
|
901
1257
|
.runner-step-title {
|
|
902
1258
|
font-weight: 500;
|
|
903
|
-
color:
|
|
1259
|
+
color: var(--text);
|
|
904
1260
|
font-size: 0.97rem;
|
|
905
1261
|
flex: 1;
|
|
906
1262
|
min-width: 0;
|
|
907
1263
|
line-height: 1.4;
|
|
908
1264
|
}
|
|
1265
|
+
|
|
909
1266
|
.runner-step-item.active .runner-step-title {
|
|
910
1267
|
font-weight: 700;
|
|
911
1268
|
font-size: 1.07rem;
|
|
912
1269
|
}
|
|
1270
|
+
|
|
913
1271
|
.runner-step-badge {
|
|
914
|
-
background:
|
|
915
|
-
color:
|
|
1272
|
+
background: var(--primary-badge-bg);
|
|
1273
|
+
color: var(--primary-badge-text);
|
|
916
1274
|
font-size: 12px;
|
|
917
1275
|
font-weight: 600;
|
|
918
1276
|
border-radius: 6px;
|
|
@@ -927,7 +1285,7 @@
|
|
|
927
1285
|
flex: 1;
|
|
928
1286
|
width: 100%;
|
|
929
1287
|
padding: 56px 64px 56px 64px;
|
|
930
|
-
background:
|
|
1288
|
+
background: var(--bg);
|
|
931
1289
|
min-width: 0;
|
|
932
1290
|
display: flex;
|
|
933
1291
|
flex-direction: column;
|
|
@@ -947,17 +1305,18 @@
|
|
|
947
1305
|
.runner-step-header h2.runner-step-title {
|
|
948
1306
|
font-size: 1.5rem;
|
|
949
1307
|
font-weight: 700;
|
|
950
|
-
color:
|
|
1308
|
+
color: var(--text);
|
|
951
1309
|
}
|
|
952
1310
|
|
|
953
1311
|
.runner-step-divider {
|
|
954
1312
|
border: none;
|
|
955
|
-
border-top: 1px solid
|
|
956
|
-
margin: 20px 0
|
|
1313
|
+
border-top: 1px solid var(--border);
|
|
1314
|
+
margin: 20px 0;
|
|
957
1315
|
width: 100%;
|
|
958
1316
|
}
|
|
1317
|
+
|
|
959
1318
|
.runner-step-desc {
|
|
960
|
-
color:
|
|
1319
|
+
color: var(--muted);
|
|
961
1320
|
font-size: 1rem;
|
|
962
1321
|
margin: 0;
|
|
963
1322
|
}
|
|
@@ -974,8 +1333,9 @@
|
|
|
974
1333
|
margin-top: 24px;
|
|
975
1334
|
padding-right: 0;
|
|
976
1335
|
}
|
|
1336
|
+
|
|
977
1337
|
.next-button {
|
|
978
|
-
background:
|
|
1338
|
+
background: var(--primary);
|
|
979
1339
|
color: #fff;
|
|
980
1340
|
border: none;
|
|
981
1341
|
border-radius: 6px;
|
|
@@ -989,16 +1349,17 @@
|
|
|
989
1349
|
box-sizing: border-box;
|
|
990
1350
|
align-self: flex-end;
|
|
991
1351
|
}
|
|
1352
|
+
|
|
992
1353
|
.next-button:hover {
|
|
993
|
-
background:
|
|
1354
|
+
background: var(--primary-600);
|
|
994
1355
|
}
|
|
995
1356
|
|
|
996
1357
|
:global(body) {
|
|
997
|
-
background:
|
|
1358
|
+
background: var(--bg);
|
|
998
1359
|
}
|
|
999
1360
|
|
|
1000
1361
|
.runner-card {
|
|
1001
|
-
background:
|
|
1362
|
+
background: var(--card-bg);
|
|
1002
1363
|
border-radius: 12px;
|
|
1003
1364
|
padding: 24px 24px 20px 24px;
|
|
1004
1365
|
margin-bottom: 0;
|
|
@@ -1010,20 +1371,20 @@
|
|
|
1010
1371
|
font-size: 1rem;
|
|
1011
1372
|
font-weight: 600;
|
|
1012
1373
|
margin-bottom: 8px;
|
|
1013
|
-
color:
|
|
1374
|
+
color: var(--text);
|
|
1014
1375
|
display: flex;
|
|
1015
1376
|
align-items: center;
|
|
1016
1377
|
}
|
|
1017
1378
|
|
|
1018
1379
|
.runner-question-required {
|
|
1019
|
-
color:
|
|
1380
|
+
color: var(--danger);
|
|
1020
1381
|
font-size: 1.1em;
|
|
1021
1382
|
margin-left: 4px;
|
|
1022
1383
|
}
|
|
1023
1384
|
|
|
1024
1385
|
.runner-question-divider {
|
|
1025
1386
|
border: none;
|
|
1026
|
-
border-top: 1.5px solid
|
|
1387
|
+
border-top: 1.5px solid var(--border);
|
|
1027
1388
|
margin: 12px 0 20px 0;
|
|
1028
1389
|
}
|
|
1029
1390
|
|
|
@@ -1036,11 +1397,11 @@
|
|
|
1036
1397
|
.runner-card select {
|
|
1037
1398
|
width: 100%;
|
|
1038
1399
|
padding: 12px 16px;
|
|
1039
|
-
border: 1px solid
|
|
1400
|
+
border: 1px solid var(--border);
|
|
1040
1401
|
border-radius: 12px;
|
|
1041
1402
|
font-size: 14px;
|
|
1042
|
-
background-color:
|
|
1043
|
-
color:
|
|
1403
|
+
background-color: var(--bg);
|
|
1404
|
+
color: var(--text);
|
|
1044
1405
|
transition: all 0.2s ease;
|
|
1045
1406
|
box-sizing: border-box;
|
|
1046
1407
|
}
|
|
@@ -1052,16 +1413,14 @@
|
|
|
1052
1413
|
.runner-card textarea:focus,
|
|
1053
1414
|
.runner-card select:focus {
|
|
1054
1415
|
outline: none;
|
|
1055
|
-
border-color:
|
|
1056
|
-
background-color:
|
|
1416
|
+
border-color: var(--primary);
|
|
1417
|
+
background-color: var(--card-bg);
|
|
1057
1418
|
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
|
|
1058
1419
|
}
|
|
1059
1420
|
|
|
1060
|
-
.runner-card input
|
|
1061
|
-
.runner-card input[type="email"]::placeholder,
|
|
1062
|
-
.runner-card input[type="number"]::placeholder,
|
|
1421
|
+
.runner-card input::placeholder,
|
|
1063
1422
|
.runner-card textarea::placeholder {
|
|
1064
|
-
color:
|
|
1423
|
+
color: var(--muted-weak);
|
|
1065
1424
|
}
|
|
1066
1425
|
|
|
1067
1426
|
.runner-card textarea {
|
|
@@ -1077,7 +1436,7 @@
|
|
|
1077
1436
|
}
|
|
1078
1437
|
|
|
1079
1438
|
.runner-card select.placeholder {
|
|
1080
|
-
color:
|
|
1439
|
+
color: var(--muted-weak);
|
|
1081
1440
|
}
|
|
1082
1441
|
|
|
1083
1442
|
/* Radio group styling */
|
|
@@ -1085,7 +1444,7 @@
|
|
|
1085
1444
|
display: flex;
|
|
1086
1445
|
flex-direction: column;
|
|
1087
1446
|
gap: 8px;
|
|
1088
|
-
background-color:
|
|
1447
|
+
background-color: var(--card-bg);
|
|
1089
1448
|
padding: 16px;
|
|
1090
1449
|
}
|
|
1091
1450
|
|
|
@@ -1107,18 +1466,18 @@
|
|
|
1107
1466
|
margin-right: 12px;
|
|
1108
1467
|
width: 18px;
|
|
1109
1468
|
height: 18px;
|
|
1110
|
-
accent-color:
|
|
1469
|
+
accent-color: var(--primary);
|
|
1111
1470
|
cursor: pointer;
|
|
1112
1471
|
}
|
|
1113
1472
|
|
|
1114
1473
|
.radio-option input[type="radio"]:checked + .radio-label {
|
|
1115
1474
|
font-weight: 600;
|
|
1116
|
-
color:
|
|
1475
|
+
color: var(--text);
|
|
1117
1476
|
}
|
|
1118
1477
|
|
|
1119
1478
|
.radio-label {
|
|
1120
1479
|
font-size: 16px;
|
|
1121
|
-
color:
|
|
1480
|
+
color: var(--muted-weak);
|
|
1122
1481
|
cursor: pointer;
|
|
1123
1482
|
flex: 1;
|
|
1124
1483
|
}
|
|
@@ -1129,12 +1488,12 @@
|
|
|
1129
1488
|
box-shadow: none;
|
|
1130
1489
|
}
|
|
1131
1490
|
|
|
1132
|
-
/* Checkbox group styling */
|
|
1491
|
+
/* Checkbox group styling (reuse tokens) */
|
|
1133
1492
|
.checkbox-group {
|
|
1134
1493
|
display: flex;
|
|
1135
1494
|
flex-direction: column;
|
|
1136
1495
|
gap: 8px;
|
|
1137
|
-
background-color:
|
|
1496
|
+
background-color: var(--card-bg);
|
|
1138
1497
|
padding: 16px;
|
|
1139
1498
|
}
|
|
1140
1499
|
|
|
@@ -1147,7 +1506,7 @@
|
|
|
1147
1506
|
background-color: transparent;
|
|
1148
1507
|
transition: all 0.2s ease;
|
|
1149
1508
|
}
|
|
1150
|
-
|
|
1509
|
+
|
|
1151
1510
|
.checkbox-option:hover {
|
|
1152
1511
|
background-color: transparent;
|
|
1153
1512
|
}
|
|
@@ -1156,18 +1515,18 @@
|
|
|
1156
1515
|
margin-right: 12px;
|
|
1157
1516
|
width: 18px;
|
|
1158
1517
|
height: 18px;
|
|
1159
|
-
accent-color:
|
|
1518
|
+
accent-color: var(--primary);
|
|
1160
1519
|
cursor: pointer;
|
|
1161
1520
|
}
|
|
1162
1521
|
|
|
1163
1522
|
.checkbox-option input[type="checkbox"]:checked + .checkbox-label {
|
|
1164
1523
|
font-weight: 600;
|
|
1165
|
-
color:
|
|
1524
|
+
color: var(--text);
|
|
1166
1525
|
}
|
|
1167
1526
|
|
|
1168
1527
|
.checkbox-label {
|
|
1169
1528
|
font-size: 16px;
|
|
1170
|
-
color:
|
|
1529
|
+
color: var(--muted);
|
|
1171
1530
|
cursor: pointer;
|
|
1172
1531
|
flex: 1;
|
|
1173
1532
|
}
|
|
@@ -1178,7 +1537,10 @@
|
|
|
1178
1537
|
box-shadow: none;
|
|
1179
1538
|
}
|
|
1180
1539
|
|
|
1181
|
-
/*
|
|
1540
|
+
/* Signature, file upload, error, print, mobile, etc. */
|
|
1541
|
+
|
|
1542
|
+
|
|
1543
|
+
/* Single checkbox styling */
|
|
1182
1544
|
.checkbox-single {
|
|
1183
1545
|
display: flex;
|
|
1184
1546
|
align-items: center;
|
|
@@ -1198,13 +1560,13 @@
|
|
|
1198
1560
|
margin-right: 12px;
|
|
1199
1561
|
width: 18px;
|
|
1200
1562
|
height: 18px;
|
|
1201
|
-
accent-color:
|
|
1563
|
+
accent-color: var(--primary);
|
|
1202
1564
|
cursor: pointer;
|
|
1203
1565
|
}
|
|
1204
1566
|
|
|
1205
1567
|
.checkbox-single input[type="checkbox"]:checked + .checkbox-label {
|
|
1206
1568
|
font-weight: 600;
|
|
1207
|
-
color:
|
|
1569
|
+
color: var(--text);
|
|
1208
1570
|
}
|
|
1209
1571
|
|
|
1210
1572
|
.checkbox-single:has(input[type="checkbox"]:checked) {
|
|
@@ -1213,7 +1575,6 @@
|
|
|
1213
1575
|
box-shadow: none;
|
|
1214
1576
|
}
|
|
1215
1577
|
|
|
1216
|
-
/* Signature styling */
|
|
1217
1578
|
.signature-container {
|
|
1218
1579
|
display: flex;
|
|
1219
1580
|
flex-direction: column;
|
|
@@ -1223,9 +1584,9 @@
|
|
|
1223
1584
|
.signature-canvas {
|
|
1224
1585
|
width: 100%;
|
|
1225
1586
|
height: 200px;
|
|
1226
|
-
border: 1px solid
|
|
1587
|
+
border: 1px solid var(--border);
|
|
1227
1588
|
border-radius: 8px;
|
|
1228
|
-
background-color:
|
|
1589
|
+
background-color: var(--card-bg);
|
|
1229
1590
|
cursor: crosshair;
|
|
1230
1591
|
max-width: 700px;
|
|
1231
1592
|
}
|
|
@@ -1236,9 +1597,9 @@
|
|
|
1236
1597
|
}
|
|
1237
1598
|
|
|
1238
1599
|
.signature-clear-btn {
|
|
1239
|
-
background:
|
|
1240
|
-
color:
|
|
1241
|
-
border: 1px solid
|
|
1600
|
+
background: var(--muted-surface);
|
|
1601
|
+
color: var(--muted-weak);
|
|
1602
|
+
border: 1px solid var(--primary-600);
|
|
1242
1603
|
border-radius: 6px;
|
|
1243
1604
|
padding: 8px 16px;
|
|
1244
1605
|
font-size: 14px;
|
|
@@ -1248,14 +1609,15 @@
|
|
|
1248
1609
|
}
|
|
1249
1610
|
|
|
1250
1611
|
.signature-clear-btn:hover {
|
|
1251
|
-
background:
|
|
1252
|
-
border-color:
|
|
1612
|
+
background: var(--muted-weak);
|
|
1613
|
+
border-color: var(--muted-weak);
|
|
1253
1614
|
}
|
|
1254
1615
|
|
|
1255
|
-
.signature-save-btn
|
|
1256
|
-
|
|
1616
|
+
.signature-save-btn,
|
|
1617
|
+
.signature-replace-btn {
|
|
1618
|
+
background: var(--primary);
|
|
1257
1619
|
color: white;
|
|
1258
|
-
border: 1px solid
|
|
1620
|
+
border: 1px solid var(--primary-600, var(--primary-600));
|
|
1259
1621
|
border-radius: 6px;
|
|
1260
1622
|
padding: 8px 16px;
|
|
1261
1623
|
font-size: 14px;
|
|
@@ -1264,41 +1626,14 @@
|
|
|
1264
1626
|
transition: all 0.2s ease;
|
|
1265
1627
|
}
|
|
1266
1628
|
|
|
1267
|
-
.signature-save-btn:hover
|
|
1268
|
-
background: #2563eb;
|
|
1269
|
-
border-color: #1d4ed8;
|
|
1270
|
-
}
|
|
1271
|
-
|
|
1272
|
-
.signature-saved {
|
|
1273
|
-
color: #059669;
|
|
1274
|
-
font-size: 14px;
|
|
1275
|
-
font-weight: 500;
|
|
1276
|
-
display: flex;
|
|
1277
|
-
align-items: center;
|
|
1278
|
-
gap: 4px;
|
|
1279
|
-
}
|
|
1280
|
-
|
|
1281
|
-
.signature-replace-btn {
|
|
1282
|
-
background: #3b82f6;
|
|
1283
|
-
color: white;
|
|
1284
|
-
border: none;
|
|
1285
|
-
padding: 8px 16px;
|
|
1286
|
-
border-radius: 4px;
|
|
1287
|
-
cursor: pointer;
|
|
1288
|
-
font-size: 0.875rem;
|
|
1289
|
-
font-weight: 500;
|
|
1290
|
-
transition: background-color 0.2s ease;
|
|
1291
|
-
display: inline-flex;
|
|
1292
|
-
align-items: center;
|
|
1293
|
-
gap: 6px;
|
|
1294
|
-
}
|
|
1295
|
-
|
|
1629
|
+
.signature-save-btn:hover,
|
|
1296
1630
|
.signature-replace-btn:hover {
|
|
1297
|
-
background:
|
|
1631
|
+
background: var(--primary-600),
|
|
1632
|
+
border-color: var(--primary-600-border);
|
|
1298
1633
|
}
|
|
1299
1634
|
|
|
1300
1635
|
.signature-cancel-btn {
|
|
1301
|
-
background:
|
|
1636
|
+
background: var(--muted);
|
|
1302
1637
|
color: white;
|
|
1303
1638
|
border: none;
|
|
1304
1639
|
padding: 8px 16px;
|
|
@@ -1310,42 +1645,31 @@
|
|
|
1310
1645
|
}
|
|
1311
1646
|
|
|
1312
1647
|
.signature-cancel-btn:hover {
|
|
1313
|
-
background:
|
|
1314
|
-
}
|
|
1315
|
-
|
|
1316
|
-
/* File Upload Styles */
|
|
1317
|
-
.file-upload-container {
|
|
1318
|
-
display: flex;
|
|
1319
|
-
flex-direction: column;
|
|
1320
|
-
gap: 12px;
|
|
1321
|
-
}
|
|
1322
|
-
|
|
1323
|
-
.file-input {
|
|
1324
|
-
display: none;
|
|
1648
|
+
background: var(--muted-weak);
|
|
1325
1649
|
}
|
|
1326
1650
|
|
|
1327
1651
|
.file-placeholder {
|
|
1328
|
-
background:
|
|
1652
|
+
background: var(--muted-weak);
|
|
1329
1653
|
border: 2px dashed #d1d5db;
|
|
1330
1654
|
border-radius: 8px;
|
|
1331
1655
|
padding: 24px;
|
|
1332
1656
|
text-align: center;
|
|
1333
|
-
color:
|
|
1657
|
+
color: var(--muted);
|
|
1334
1658
|
cursor: pointer;
|
|
1335
1659
|
transition: all 0.2s ease;
|
|
1336
1660
|
}
|
|
1337
1661
|
|
|
1338
1662
|
.file-placeholder:hover {
|
|
1339
|
-
border-color:
|
|
1340
|
-
background:
|
|
1341
|
-
color:
|
|
1663
|
+
border-color: var(--primary);
|
|
1664
|
+
background: var(--primary-100-bg);
|
|
1665
|
+
color: var(--primary);
|
|
1342
1666
|
}
|
|
1343
1667
|
|
|
1344
1668
|
.file-info {
|
|
1345
1669
|
display: flex;
|
|
1346
1670
|
align-items: center;
|
|
1347
1671
|
gap: 12px;
|
|
1348
|
-
background:
|
|
1672
|
+
background: var(--primary-100-bg);
|
|
1349
1673
|
border: 1px solid #bae6fd;
|
|
1350
1674
|
border-radius: 8px;
|
|
1351
1675
|
padding: 12px 16px;
|
|
@@ -1353,17 +1677,15 @@
|
|
|
1353
1677
|
|
|
1354
1678
|
.file-name {
|
|
1355
1679
|
font-weight: 500;
|
|
1356
|
-
color:
|
|
1680
|
+
color: var(--primary);
|
|
1357
1681
|
flex: 1;
|
|
1358
1682
|
}
|
|
1359
|
-
|
|
1360
1683
|
.file-size {
|
|
1361
|
-
color:
|
|
1684
|
+
color:var(--primary);
|
|
1362
1685
|
font-size: 0.875rem;
|
|
1363
1686
|
}
|
|
1364
|
-
|
|
1365
1687
|
.file-remove-btn {
|
|
1366
|
-
background:
|
|
1688
|
+
background: var(--danger);
|
|
1367
1689
|
color: white;
|
|
1368
1690
|
border: none;
|
|
1369
1691
|
border-radius: 6px;
|
|
@@ -1374,13 +1696,8 @@
|
|
|
1374
1696
|
transition: background-color 0.2s ease;
|
|
1375
1697
|
}
|
|
1376
1698
|
|
|
1377
|
-
.file-remove-btn:hover {
|
|
1378
|
-
background: #b91c1c;
|
|
1379
|
-
}
|
|
1380
|
-
|
|
1381
|
-
/* Error message styling */
|
|
1382
1699
|
.error-message {
|
|
1383
|
-
color:
|
|
1700
|
+
color: var(--danger);
|
|
1384
1701
|
font-size: 0.875rem;
|
|
1385
1702
|
margin-top: 8px;
|
|
1386
1703
|
margin-bottom: 0;
|
|
@@ -1390,19 +1707,19 @@
|
|
|
1390
1707
|
.question.error input,
|
|
1391
1708
|
.question.error textarea,
|
|
1392
1709
|
.question.error select {
|
|
1393
|
-
border-color:
|
|
1394
|
-
background-color:
|
|
1710
|
+
border-color: var(--danger);
|
|
1711
|
+
background-color: var(--danger-100-bg);
|
|
1395
1712
|
}
|
|
1396
1713
|
|
|
1397
1714
|
.question.error input:focus,
|
|
1398
1715
|
.question.error textarea:focus,
|
|
1399
1716
|
.question.error select:focus {
|
|
1400
|
-
border-color:
|
|
1401
|
-
background-color:
|
|
1717
|
+
border-color: var(--danger);
|
|
1718
|
+
background-color: var(--card-bg);
|
|
1402
1719
|
box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
|
|
1403
1720
|
}
|
|
1404
1721
|
|
|
1405
|
-
/*
|
|
1722
|
+
/* Many remaining structural styles reuse variables above for print/mobile */
|
|
1406
1723
|
.content-element {
|
|
1407
1724
|
margin-bottom: 16px;
|
|
1408
1725
|
}
|
|
@@ -1410,35 +1727,35 @@
|
|
|
1410
1727
|
.text-content p {
|
|
1411
1728
|
font-size: 1rem;
|
|
1412
1729
|
line-height: 1.6;
|
|
1413
|
-
color:
|
|
1730
|
+
color: var(--muted-weak);
|
|
1414
1731
|
margin: 0;
|
|
1415
1732
|
}
|
|
1416
1733
|
|
|
1417
1734
|
.markdown-content {
|
|
1418
1735
|
font-size: 1rem;
|
|
1419
1736
|
line-height: 1.6;
|
|
1420
|
-
color:
|
|
1737
|
+
color: var(--muted-weak);
|
|
1421
1738
|
}
|
|
1422
1739
|
|
|
1423
1740
|
.markdown-content h1 {
|
|
1424
1741
|
font-size: 1.5rem;
|
|
1425
1742
|
font-weight: 700;
|
|
1426
1743
|
margin: 24px 0 16px 0;
|
|
1427
|
-
color:
|
|
1744
|
+
color: var(--text);
|
|
1428
1745
|
}
|
|
1429
1746
|
|
|
1430
1747
|
.markdown-content h2 {
|
|
1431
1748
|
font-size: 1.25rem;
|
|
1432
1749
|
font-weight: 600;
|
|
1433
1750
|
margin: 20px 0 12px 0;
|
|
1434
|
-
color:
|
|
1751
|
+
color: var(--text);
|
|
1435
1752
|
}
|
|
1436
1753
|
|
|
1437
1754
|
.markdown-content h3 {
|
|
1438
1755
|
font-size: 1.125rem;
|
|
1439
1756
|
font-weight: 600;
|
|
1440
1757
|
margin: 16px 0 8px 0;
|
|
1441
|
-
color:
|
|
1758
|
+
color: var(--text);
|
|
1442
1759
|
}
|
|
1443
1760
|
|
|
1444
1761
|
.markdown-content strong {
|
|
@@ -1450,7 +1767,7 @@
|
|
|
1450
1767
|
}
|
|
1451
1768
|
|
|
1452
1769
|
.markdown-content code {
|
|
1453
|
-
background:
|
|
1770
|
+
background: var(--muted-surface);
|
|
1454
1771
|
padding: 2px 6px;
|
|
1455
1772
|
border-radius: 4px;
|
|
1456
1773
|
font-family: "Courier New", monospace;
|
|
@@ -1458,13 +1775,13 @@
|
|
|
1458
1775
|
}
|
|
1459
1776
|
|
|
1460
1777
|
.markdown-content blockquote {
|
|
1461
|
-
background:
|
|
1462
|
-
border-left: 4px solid
|
|
1778
|
+
background: var(--bg);
|
|
1779
|
+
border-left: 4px solid var(--primary);
|
|
1463
1780
|
padding: 12px 16px;
|
|
1464
1781
|
margin: 16px 0;
|
|
1465
1782
|
border-radius: 0 4px 4px 0;
|
|
1466
1783
|
font-style: italic;
|
|
1467
|
-
color:
|
|
1784
|
+
color: var(--muted);
|
|
1468
1785
|
}
|
|
1469
1786
|
|
|
1470
1787
|
.markdown-content ul {
|
|
@@ -1481,6 +1798,24 @@
|
|
|
1481
1798
|
margin: 4px 0;
|
|
1482
1799
|
}
|
|
1483
1800
|
|
|
1801
|
+
.divider-content .content-divider {
|
|
1802
|
+
border-top: 2px solid var(--border);
|
|
1803
|
+
}
|
|
1804
|
+
|
|
1805
|
+
.markdown-content ul {
|
|
1806
|
+
margin: 12px 0;
|
|
1807
|
+
padding-left: 24px;
|
|
1808
|
+
}
|
|
1809
|
+
|
|
1810
|
+
.markdown-content ol {
|
|
1811
|
+
margin: 12px 0;
|
|
1812
|
+
padding-left: 24px;
|
|
1813
|
+
}
|
|
1814
|
+
|
|
1815
|
+
.markdown-content li {
|
|
1816
|
+
margin: 4px 0;
|
|
1817
|
+
}
|
|
1818
|
+
|
|
1484
1819
|
.divider-content {
|
|
1485
1820
|
text-align: center;
|
|
1486
1821
|
margin: 24px 0;
|
|
@@ -1528,14 +1863,15 @@
|
|
|
1528
1863
|
}
|
|
1529
1864
|
|
|
1530
1865
|
.unknown-element {
|
|
1531
|
-
background:
|
|
1866
|
+
background: var(--danger-100-bg);
|
|
1532
1867
|
border: 1px solid #fecaca;
|
|
1533
1868
|
border-radius: 8px;
|
|
1534
1869
|
padding: 16px;
|
|
1535
|
-
color:
|
|
1870
|
+
color: var(--danger);
|
|
1536
1871
|
text-align: center;
|
|
1537
1872
|
}
|
|
1538
1873
|
|
|
1874
|
+
|
|
1539
1875
|
.unknown-element p {
|
|
1540
1876
|
margin: 0;
|
|
1541
1877
|
font-weight: 500;
|
|
@@ -1557,7 +1893,7 @@
|
|
|
1557
1893
|
.submission-success-icon {
|
|
1558
1894
|
width: 48px;
|
|
1559
1895
|
height: 48px;
|
|
1560
|
-
color:
|
|
1896
|
+
color: var(--success);
|
|
1561
1897
|
margin-bottom: 32px;
|
|
1562
1898
|
display: flex;
|
|
1563
1899
|
align-items: center;
|
|
@@ -1948,8 +2284,8 @@
|
|
|
1948
2284
|
}
|
|
1949
2285
|
|
|
1950
2286
|
.runner-mobile-step-tab:hover:not(:disabled):not(.active) {
|
|
1951
|
-
background:
|
|
1952
|
-
border-color:
|
|
2287
|
+
background: var(--bg);
|
|
2288
|
+
border-color: var(--border);
|
|
1953
2289
|
}
|
|
1954
2290
|
|
|
1955
2291
|
.runner-mobile-step-tab:focus {
|
|
@@ -1957,13 +2293,13 @@
|
|
|
1957
2293
|
}
|
|
1958
2294
|
|
|
1959
2295
|
.runner-mobile-step-tab:focus:not(.active) {
|
|
1960
|
-
outline: 2px solid
|
|
2296
|
+
outline: 2px solid var(--primary);
|
|
1961
2297
|
outline-offset: 2px;
|
|
1962
2298
|
}
|
|
1963
2299
|
|
|
1964
2300
|
.runner-mobile-step-tab.active {
|
|
1965
|
-
background:
|
|
1966
|
-
border-color:
|
|
2301
|
+
background: var(--primary) !important;
|
|
2302
|
+
border-color: var(--primary) !important;
|
|
1967
2303
|
color: #fff !important;
|
|
1968
2304
|
}
|
|
1969
2305
|
|
|
@@ -2006,9 +2342,9 @@
|
|
|
2006
2342
|
|
|
2007
2343
|
/* Enhance mobile tab styling for completed/active states */
|
|
2008
2344
|
.runner-mobile-step-tab.completed:not(.active) {
|
|
2009
|
-
background:
|
|
2010
|
-
border-color:
|
|
2011
|
-
color:
|
|
2345
|
+
background: var(--success);
|
|
2346
|
+
border-color: var(--success);
|
|
2347
|
+
color: var(--text);
|
|
2012
2348
|
}
|
|
2013
2349
|
|
|
2014
2350
|
.runner-mobile-step-tab.completed .runner-mobile-step-badge {
|
|
@@ -2407,6 +2743,10 @@
|
|
|
2407
2743
|
.print-response-value.checkbox-response div {
|
|
2408
2744
|
margin: 2px 0;
|
|
2409
2745
|
line-height: 1.4;
|
|
2746
|
+
|
|
2747
|
+
|
|
2748
|
+
|
|
2749
|
+
|
|
2410
2750
|
}
|
|
2411
2751
|
|
|
2412
2752
|
.step-edit-btn {
|
|
@@ -2433,18 +2773,109 @@
|
|
|
2433
2773
|
width: 16px;
|
|
2434
2774
|
height: 16px;
|
|
2435
2775
|
}
|
|
2436
|
-
|
|
2776
|
+
|
|
2777
|
+
.assignment-name-fields {
|
|
2778
|
+
display: flex;
|
|
2779
|
+
gap: 8px;
|
|
2780
|
+
margin-top: 8px;
|
|
2781
|
+
}
|
|
2782
|
+
|
|
2783
|
+
.assignment-name-input {
|
|
2784
|
+
flex: 1;
|
|
2785
|
+
padding: 8px 12px;
|
|
2786
|
+
border: 1px solid #d1d5db;
|
|
2787
|
+
border-radius: 6px;
|
|
2788
|
+
font-size: 14px;
|
|
2789
|
+
}
|
|
2790
|
+
|
|
2791
|
+
.assignment-name-input:focus {
|
|
2792
|
+
outline: none;
|
|
2793
|
+
border-color: #3b82f6;
|
|
2794
|
+
box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
|
|
2795
|
+
}
|
|
2796
|
+
`,ht=L`
|
|
2797
|
+
/* Theme variables (defaults) */
|
|
2798
|
+
:host {
|
|
2799
|
+
--modal-overlay-bg: rgba(0, 0, 0, 0.5);
|
|
2800
|
+
--modal-backdrop-blur: 2px;
|
|
2801
|
+
|
|
2802
|
+
--modal-bg: #ffffff;
|
|
2803
|
+
--modal-text: #111827;
|
|
2804
|
+
--muted-text: #6b7280;
|
|
2805
|
+
--muted-alt: #9ca3af;
|
|
2806
|
+
--border-color: #e5e7eb;
|
|
2807
|
+
|
|
2808
|
+
--primary: #3b82f6;
|
|
2809
|
+
--primary-focus-ring: rgba(59, 130, 246, 0.1);
|
|
2810
|
+
|
|
2811
|
+
--card-border: #e5e7eb;
|
|
2812
|
+
--card-hover-bg: #f0f9ff;
|
|
2813
|
+
--card-selected-bg: #eff6ff;
|
|
2814
|
+
|
|
2815
|
+
--close-color: #9ca3af;
|
|
2816
|
+
|
|
2817
|
+
--footer-bg: transparent;
|
|
2818
|
+
--save-bg: #111827;
|
|
2819
|
+
--save-hover: #1f2937;
|
|
2820
|
+
--cancel-bg: #ffffff;
|
|
2821
|
+
|
|
2822
|
+
--scrollbar-track: #f1f5f9;
|
|
2823
|
+
--scrollbar-thumb: #cbd5e1;
|
|
2824
|
+
--scrollbar-thumb-hover: #94a3b8;
|
|
2825
|
+
|
|
2826
|
+
--modal-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
|
|
2827
|
+
|
|
2828
|
+
--radius-lg: 12px;
|
|
2829
|
+
--radius-md: 8px;
|
|
2830
|
+
|
|
2831
|
+
--anim-fade: 0.2s;
|
|
2832
|
+
--anim-slide: 0.3s;
|
|
2833
|
+
}
|
|
2834
|
+
|
|
2835
|
+
/* Dark mode (host attribute or data attribute) */
|
|
2836
|
+
:host([theme="dark"]),
|
|
2837
|
+
:host([data-theme="dark"]) {
|
|
2838
|
+
--modal-overlay-bg: rgba(0, 0, 0, 0.7);
|
|
2839
|
+
--modal-backdrop-blur: 4px;
|
|
2840
|
+
|
|
2841
|
+
--modal-bg: #0b1220;
|
|
2842
|
+
--modal-text: #f8fafc;
|
|
2843
|
+
--muted-text: #94a3b8;
|
|
2844
|
+
--muted-alt: #9aa4b2;
|
|
2845
|
+
--border-color: #1f2937;
|
|
2846
|
+
|
|
2847
|
+
--primary: #60a5fa;
|
|
2848
|
+
--primary-focus-ring: rgba(96, 165, 250, 0.12);
|
|
2849
|
+
|
|
2850
|
+
--card-border: #111827;
|
|
2851
|
+
--card-hover-bg: #06202b;
|
|
2852
|
+
--card-selected-bg: #0b2a4a;
|
|
2853
|
+
|
|
2854
|
+
--close-color: #94a3b8;
|
|
2855
|
+
|
|
2856
|
+
--footer-bg: transparent;
|
|
2857
|
+
--save-bg: #111827;
|
|
2858
|
+
--save-hover: #0b1220;
|
|
2859
|
+
--cancel-bg: #0b1220;
|
|
2860
|
+
|
|
2861
|
+
--scrollbar-track: #031024;
|
|
2862
|
+
--scrollbar-thumb: #1f2937;
|
|
2863
|
+
--scrollbar-thumb-hover: #374151;
|
|
2864
|
+
|
|
2865
|
+
--modal-shadow: 0 20px 25px -5px rgba(2, 6, 23, 0.6);
|
|
2866
|
+
}
|
|
2867
|
+
|
|
2437
2868
|
/* Modal Overlay */
|
|
2438
2869
|
.modal-overlay {
|
|
2439
2870
|
position: fixed;
|
|
2440
2871
|
inset: 0;
|
|
2441
|
-
background:
|
|
2442
|
-
backdrop-filter: blur(
|
|
2872
|
+
background: var(--modal-overlay-bg);
|
|
2873
|
+
backdrop-filter: blur(var(--modal-backdrop-blur));
|
|
2443
2874
|
display: flex;
|
|
2444
2875
|
align-items: center;
|
|
2445
2876
|
justify-content: center;
|
|
2446
2877
|
z-index: 1000;
|
|
2447
|
-
animation: fadeIn
|
|
2878
|
+
animation: fadeIn var(--anim-fade) ease-out;
|
|
2448
2879
|
}
|
|
2449
2880
|
|
|
2450
2881
|
@keyframes fadeIn {
|
|
@@ -2458,16 +2889,17 @@
|
|
|
2458
2889
|
|
|
2459
2890
|
/* Modal Container */
|
|
2460
2891
|
.modal-content {
|
|
2461
|
-
background:
|
|
2462
|
-
|
|
2463
|
-
|
|
2892
|
+
background: var(--modal-bg);
|
|
2893
|
+
color: var(--modal-text);
|
|
2894
|
+
border-radius: var(--radius-lg);
|
|
2895
|
+
box-shadow: var(--modal-shadow);
|
|
2464
2896
|
width: 90%;
|
|
2465
2897
|
max-width: 750px;
|
|
2466
2898
|
max-height: 90vh;
|
|
2467
2899
|
display: flex;
|
|
2468
2900
|
flex-direction: column;
|
|
2469
2901
|
overflow: hidden;
|
|
2470
|
-
animation: slideUp
|
|
2902
|
+
animation: slideUp var(--anim-slide) ease-out;
|
|
2471
2903
|
}
|
|
2472
2904
|
|
|
2473
2905
|
@keyframes slideUp {
|
|
@@ -2487,14 +2919,14 @@
|
|
|
2487
2919
|
align-items: center;
|
|
2488
2920
|
justify-content: space-between;
|
|
2489
2921
|
padding: 24px 32px;
|
|
2490
|
-
border-bottom: 1px solid
|
|
2922
|
+
border-bottom: 1px solid var(--border-color);
|
|
2491
2923
|
}
|
|
2492
2924
|
|
|
2493
2925
|
.modal-header h2 {
|
|
2494
2926
|
margin: 0;
|
|
2495
2927
|
font-size: 20px;
|
|
2496
2928
|
font-weight: 600;
|
|
2497
|
-
color:
|
|
2929
|
+
color: var(--modal-text);
|
|
2498
2930
|
}
|
|
2499
2931
|
|
|
2500
2932
|
.modal-close {
|
|
@@ -2508,15 +2940,15 @@
|
|
|
2508
2940
|
border: none;
|
|
2509
2941
|
border-radius: 6px;
|
|
2510
2942
|
font-size: 20px;
|
|
2511
|
-
color:
|
|
2943
|
+
color: var(--close-color);
|
|
2512
2944
|
cursor: pointer;
|
|
2513
2945
|
transition: all 0.2s;
|
|
2514
2946
|
line-height: 1;
|
|
2515
2947
|
}
|
|
2516
2948
|
|
|
2517
2949
|
.modal-close:hover {
|
|
2518
|
-
background:
|
|
2519
|
-
color:
|
|
2950
|
+
background: var(--card-hover-bg);
|
|
2951
|
+
color: var(--muted-text);
|
|
2520
2952
|
}
|
|
2521
2953
|
|
|
2522
2954
|
/* Modal Body */
|
|
@@ -2541,7 +2973,7 @@
|
|
|
2541
2973
|
|
|
2542
2974
|
.modal-body label {
|
|
2543
2975
|
font-weight: 600;
|
|
2544
|
-
color:
|
|
2976
|
+
color: var(--modal-text);
|
|
2545
2977
|
font-size: 14px;
|
|
2546
2978
|
}
|
|
2547
2979
|
|
|
@@ -2552,33 +2984,33 @@
|
|
|
2552
2984
|
.assignment-select {
|
|
2553
2985
|
width: 100%;
|
|
2554
2986
|
padding: 12px 16px;
|
|
2555
|
-
border: 1px solid
|
|
2556
|
-
border-radius:
|
|
2987
|
+
border: 1px solid var(--border-color);
|
|
2988
|
+
border-radius: var(--radius-md);
|
|
2557
2989
|
font-size: 15px;
|
|
2558
2990
|
font-family: inherit;
|
|
2559
|
-
background:
|
|
2560
|
-
color:
|
|
2991
|
+
background: var(--modal-bg);
|
|
2992
|
+
color: var(--modal-text);
|
|
2561
2993
|
transition: all 0.2s;
|
|
2562
2994
|
box-sizing: border-box;
|
|
2563
2995
|
}
|
|
2564
2996
|
|
|
2565
2997
|
.modal-body input::placeholder,
|
|
2566
2998
|
.modal-body textarea::placeholder {
|
|
2567
|
-
color:
|
|
2999
|
+
color: var(--muted-alt);
|
|
2568
3000
|
}
|
|
2569
3001
|
|
|
2570
3002
|
.modal-body input:hover,
|
|
2571
3003
|
.modal-body textarea:hover,
|
|
2572
3004
|
.assignment-select:hover {
|
|
2573
|
-
border-color:
|
|
3005
|
+
border-color: var(--muted-alt);
|
|
2574
3006
|
}
|
|
2575
3007
|
|
|
2576
3008
|
.modal-body input:focus,
|
|
2577
3009
|
.modal-body textarea:focus,
|
|
2578
3010
|
.assignment-select:focus {
|
|
2579
3011
|
outline: none;
|
|
2580
|
-
border-color:
|
|
2581
|
-
box-shadow: 0 0 0 3px
|
|
3012
|
+
border-color: var(--primary);
|
|
3013
|
+
box-shadow: 0 0 0 3px var(--primary-focus-ring);
|
|
2582
3014
|
}
|
|
2583
3015
|
|
|
2584
3016
|
.modal-body textarea {
|
|
@@ -2601,7 +3033,7 @@
|
|
|
2601
3033
|
|
|
2602
3034
|
.assignment-section > label {
|
|
2603
3035
|
font-weight: 600;
|
|
2604
|
-
color:
|
|
3036
|
+
color: var(--modal-text);
|
|
2605
3037
|
font-size: 14px;
|
|
2606
3038
|
}
|
|
2607
3039
|
|
|
@@ -2616,22 +3048,23 @@
|
|
|
2616
3048
|
flex-direction: column;
|
|
2617
3049
|
flex: 1;
|
|
2618
3050
|
padding: 16px;
|
|
2619
|
-
border: 2px solid
|
|
2620
|
-
border-radius:
|
|
3051
|
+
border: 2px solid var(--card-border);
|
|
3052
|
+
border-radius: var(--radius-md);
|
|
2621
3053
|
cursor: pointer;
|
|
2622
3054
|
transition: all 0.2s;
|
|
2623
3055
|
position: relative;
|
|
2624
3056
|
min-height: 80px;
|
|
3057
|
+
background: transparent;
|
|
2625
3058
|
}
|
|
2626
3059
|
|
|
2627
3060
|
.assignment-card:hover {
|
|
2628
|
-
border-color:
|
|
2629
|
-
background:
|
|
3061
|
+
border-color: var(--primary);
|
|
3062
|
+
background: var(--card-hover-bg);
|
|
2630
3063
|
}
|
|
2631
3064
|
|
|
2632
3065
|
.assignment-card.selected {
|
|
2633
|
-
border-color:
|
|
2634
|
-
background:
|
|
3066
|
+
border-color: var(--primary);
|
|
3067
|
+
background: var(--card-selected-bg);
|
|
2635
3068
|
}
|
|
2636
3069
|
|
|
2637
3070
|
/* Custom Radio in Cards */
|
|
@@ -2641,14 +3074,14 @@
|
|
|
2641
3074
|
left: 16px;
|
|
2642
3075
|
width: 20px;
|
|
2643
3076
|
height: 20px;
|
|
2644
|
-
border: 2px solid
|
|
3077
|
+
border: 2px solid var(--border-color);
|
|
2645
3078
|
border-radius: 50%;
|
|
2646
3079
|
transition: all 0.2s;
|
|
2647
3080
|
}
|
|
2648
3081
|
|
|
2649
3082
|
.assignment-card.selected .assignment-card-radio {
|
|
2650
|
-
border-color:
|
|
2651
|
-
background:
|
|
3083
|
+
border-color: var(--primary);
|
|
3084
|
+
background: var(--modal-bg);
|
|
2652
3085
|
}
|
|
2653
3086
|
|
|
2654
3087
|
.assignment-card.selected .assignment-card-radio::after {
|
|
@@ -2660,7 +3093,7 @@
|
|
|
2660
3093
|
width: 10px;
|
|
2661
3094
|
height: 10px;
|
|
2662
3095
|
border-radius: 50%;
|
|
2663
|
-
background:
|
|
3096
|
+
background: var(--primary);
|
|
2664
3097
|
}
|
|
2665
3098
|
|
|
2666
3099
|
.assignment-card-content {
|
|
@@ -2672,12 +3105,12 @@
|
|
|
2672
3105
|
|
|
2673
3106
|
.assignment-card-title {
|
|
2674
3107
|
font-weight: 600;
|
|
2675
|
-
color:
|
|
3108
|
+
color: var(--modal-text);
|
|
2676
3109
|
font-size: 14px;
|
|
2677
3110
|
}
|
|
2678
3111
|
|
|
2679
3112
|
.assignment-card-description {
|
|
2680
|
-
color:
|
|
3113
|
+
color: var(--muted-text);
|
|
2681
3114
|
font-size: 13px;
|
|
2682
3115
|
line-height: 1.4;
|
|
2683
3116
|
}
|
|
@@ -2699,7 +3132,7 @@
|
|
|
2699
3132
|
}
|
|
2700
3133
|
|
|
2701
3134
|
.assignment-radio-option:hover {
|
|
2702
|
-
background:
|
|
3135
|
+
background: var(--card-hover-bg);
|
|
2703
3136
|
}
|
|
2704
3137
|
|
|
2705
3138
|
.assignment-radio-option input[type="radio"] {
|
|
@@ -2708,7 +3141,7 @@
|
|
|
2708
3141
|
width: 18px;
|
|
2709
3142
|
height: 18px;
|
|
2710
3143
|
cursor: pointer;
|
|
2711
|
-
accent-color:
|
|
3144
|
+
accent-color: var(--primary);
|
|
2712
3145
|
}
|
|
2713
3146
|
|
|
2714
3147
|
.assignment-radio-label {
|
|
@@ -2721,13 +3154,13 @@
|
|
|
2721
3154
|
|
|
2722
3155
|
.assignment-radio-title {
|
|
2723
3156
|
font-weight: 500;
|
|
2724
|
-
color:
|
|
3157
|
+
color: var(--modal-text);
|
|
2725
3158
|
font-size: 14px;
|
|
2726
3159
|
line-height: 1.3;
|
|
2727
3160
|
}
|
|
2728
3161
|
|
|
2729
3162
|
.assignment-radio-description {
|
|
2730
|
-
color:
|
|
3163
|
+
color: var(--muted-text);
|
|
2731
3164
|
font-size: 13px;
|
|
2732
3165
|
line-height: 1.4;
|
|
2733
3166
|
}
|
|
@@ -2738,13 +3171,14 @@
|
|
|
2738
3171
|
justify-content: flex-end;
|
|
2739
3172
|
gap: 12px;
|
|
2740
3173
|
padding: 20px 32px;
|
|
2741
|
-
border-top: 1px solid
|
|
3174
|
+
border-top: 1px solid var(--border-color);
|
|
3175
|
+
background: var(--footer-bg);
|
|
2742
3176
|
}
|
|
2743
3177
|
|
|
2744
3178
|
.modal-footer button {
|
|
2745
3179
|
padding: 10px 24px;
|
|
2746
3180
|
border: none;
|
|
2747
|
-
border-radius:
|
|
3181
|
+
border-radius: var(--radius-md);
|
|
2748
3182
|
font-size: 14px;
|
|
2749
3183
|
font-weight: 500;
|
|
2750
3184
|
font-family: inherit;
|
|
@@ -2753,27 +3187,27 @@
|
|
|
2753
3187
|
}
|
|
2754
3188
|
|
|
2755
3189
|
.modal-footer .cancel-button {
|
|
2756
|
-
background:
|
|
2757
|
-
color:
|
|
2758
|
-
border: 1px solid
|
|
3190
|
+
background: var(--cancel-bg);
|
|
3191
|
+
color: var(--modal-text);
|
|
3192
|
+
border: 1px solid var(--border-color) !important;
|
|
2759
3193
|
}
|
|
2760
3194
|
|
|
2761
3195
|
.modal-footer .cancel-button:hover {
|
|
2762
|
-
background:
|
|
2763
|
-
border-color:
|
|
3196
|
+
background: var(--card-hover-bg);
|
|
3197
|
+
border-color: var(--muted-alt) !important;
|
|
2764
3198
|
}
|
|
2765
3199
|
|
|
2766
3200
|
.modal-footer .save-button {
|
|
2767
|
-
background:
|
|
3201
|
+
background: var(--save-bg);
|
|
2768
3202
|
color: white;
|
|
2769
3203
|
}
|
|
2770
3204
|
|
|
2771
3205
|
.modal-footer .save-button:hover {
|
|
2772
|
-
background:
|
|
3206
|
+
background: var(--save-hover);
|
|
2773
3207
|
}
|
|
2774
3208
|
|
|
2775
3209
|
.modal-footer .save-button:disabled {
|
|
2776
|
-
background:
|
|
3210
|
+
background: var(--muted-alt);
|
|
2777
3211
|
cursor: not-allowed;
|
|
2778
3212
|
opacity: 0.6;
|
|
2779
3213
|
}
|
|
@@ -2784,17 +3218,17 @@
|
|
|
2784
3218
|
}
|
|
2785
3219
|
|
|
2786
3220
|
.modal-body::-webkit-scrollbar-track {
|
|
2787
|
-
background:
|
|
3221
|
+
background: var(--scrollbar-track);
|
|
2788
3222
|
border-radius: 4px;
|
|
2789
3223
|
}
|
|
2790
3224
|
|
|
2791
3225
|
.modal-body::-webkit-scrollbar-thumb {
|
|
2792
|
-
background:
|
|
3226
|
+
background: var(--scrollbar-thumb);
|
|
2793
3227
|
border-radius: 4px;
|
|
2794
3228
|
}
|
|
2795
3229
|
|
|
2796
3230
|
.modal-body::-webkit-scrollbar-thumb:hover {
|
|
2797
|
-
background:
|
|
3231
|
+
background: var(--scrollbar-thumb-hover);
|
|
2798
3232
|
}
|
|
2799
3233
|
|
|
2800
3234
|
/* Responsive */
|
|
@@ -2814,22 +3248,22 @@
|
|
|
2814
3248
|
flex-direction: column;
|
|
2815
3249
|
}
|
|
2816
3250
|
}
|
|
2817
|
-
`;var gt=Object.defineProperty,mt=Object.getOwnPropertyDescriptor,S=(s,e,t,i)=>{for(var
|
|
3251
|
+
`;var gt=Object.defineProperty,mt=Object.getOwnPropertyDescriptor,S=(s,e,t,i)=>{for(var r=i>1?void 0:i?mt(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&>(e,t,r),r};let _=class extends H{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=[],this._editingStepId=null,this._stepAssignmentCategory="individual",this._stepAssignmentType="subject",this._stepAssignmentTarget="",this._stepAssignmentFirstName="",this._stepAssignmentLastName="",this._openMenuStepId=null}connectedCallback(){super.connectedCallback(),this.workflow?(this._templateData={...this.workflow},this.workflow.steps&&this.workflow.steps.length>0&&(this._selectedStepId=this.workflow.steps[0].id),console.log("Builder loaded with existing workflow:",this.workflow.name)):this._templateData=this._getDefaultWorkflowData(),this._clickOutsideHandler=()=>this._closeStepMenu(),document.addEventListener("click",this._clickOutsideHandler)}disconnectedCallback(){super.disconnectedCallback(),this._clickOutsideHandler&&document.removeEventListener("click",this._clickOutsideHandler)}updated(s){s.has("workflow")&&this.workflow&&(this._templateData={...this.workflow},this.workflow.steps&&this.workflow.steps.length>0&&(this._selectedStepId=this.workflow.steps[0].id),console.log("Workflow property changed, reloading template data"))}_getDefaultWorkflowData(){const s={id:E(),title:"Step 1",description:"",order:1,assignment:{category:"individual",type:"subject"},elements:[],status:"pending"};return{id:E(),name:"",description:"",steps:[s]}}_handleTitleChange(s){const e=s.target;this._templateData={...this._templateData,name:e.value}}_handleDescriptionChange(s){const e=s.target;this._templateData={...this._templateData,description:e.value}}_handleCancel(){var s;console.log("🚫 Builder Widget: Cancel button clicked"),(s=this.onCancel)==null||s.call(this)}_handleSave(){var s,e,t;if((s=this._templateData.name)!=null&&s.trim()){const i={id:this._templateData.id||E(),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(i,null,2)),this.workflow?(console.log("Calling onWorkflowUpdated callback"),(e=this.onWorkflowUpdated)==null||e.call(this,i)):(console.log("Calling onWorkflowCreated callback"),(t=this.onWorkflowCreated)==null||t.call(this,i))}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._editingStepId=null,this._stepFormData={title:"",description:""},this._stepAssignmentCategory="individual",this._stepAssignmentType="subject",this._stepAssignmentTarget="",this._stepAssignmentFirstName="",this._stepAssignmentLastName=""}_handleStepFormInput(s){const e=s.target,{name:t,value:i}=e;this._stepFormData={...this._stepFormData,[t]:i}}_toggleStepMenu(s,e){s.stopPropagation(),this._openMenuStepId=this._openMenuStepId===e?null:e}_closeStepMenu(){this._openMenuStepId=null}_editStep(s){var t;const e=(t=this._templateData.steps)==null?void 0:t.find(i=>i.id===s);if(e){if(this._editingStepId=s,this._stepFormData={title:e.title,description:e.description},this._stepAssignmentCategory=e.assignment.category,this._stepAssignmentType=e.assignment.type,this._stepAssignmentTarget=e.assignment.email||e.assignment.targetId||"",this._stepAssignmentType==="specific_user"){const r=(e.assignment.targetName||"").split(" ");this._stepAssignmentFirstName=r[0]||"",this._stepAssignmentLastName=r.slice(1).join(" ")||""}else this._stepAssignmentFirstName="",this._stepAssignmentLastName="";this._showStepModal=!0,this._closeStepMenu(),console.log("Editing step:",s)}}_duplicateStep(s){var r,n;const e=(r=this._templateData.steps)==null?void 0:r.find(o=>o.id===s);if(!e)return;const t=this._templateData.steps||[],i={...e,id:E(),title:`${e.title} (Copy)`,order:t.length+1,elements:((n=e.elements)==null?void 0:n.map(o=>({...o,id:E()})))||[]};this._templateData={...this._templateData,steps:[...t,i]},this._closeStepMenu(),console.log("Step duplicated:",s)}_deleteStep(s){const e=(this._templateData.steps||[]).filter(t=>t.id!==s);e.forEach((t,i)=>{t.order=i+1}),this._templateData={...this._templateData,steps:e},this._selectedStepId===s&&(this._selectedStepId=e.length>0?e[0].id:null),this._closeStepMenu(),console.log("Step deleted:",s)}_createStep(){var t,i;if(!((t=this._stepFormData.title)!=null&&t.trim())){console.log("⚠️ Step title is required");return}const s=this._templateData.steps||[],e={category:this._stepAssignmentCategory,type:this._stepAssignmentType};if(this._stepAssignmentType==="specific_user"&&this._stepAssignmentTarget?(e.email=this._stepAssignmentTarget,this._stepAssignmentFirstName||this._stepAssignmentLastName?e.targetName=`${this._stepAssignmentFirstName} ${this._stepAssignmentLastName}`.trim():e.targetName=this._stepAssignmentTarget):this._stepAssignmentType==="instance_role_assignee_select"&&this._stepAssignmentTarget&&(e.targetId=this._stepAssignmentTarget),this._editingStepId){const r=s.map(n=>{var o;return n.id===this._editingStepId?{...n,title:this._stepFormData.title.trim(),description:((o=this._stepFormData.description)==null?void 0:o.trim())||"",assignment:e}:n});this._templateData={...this._templateData,steps:r},console.log("✅ Step updated:",this._editingStepId)}else{const r={id:E(),title:this._stepFormData.title.trim(),description:((i=this._stepFormData.description)==null?void 0:i.trim())||"",order:s.length+1,assignment:e,elements:[],status:"pending"};this._templateData={...this._templateData,steps:[...s,r]},this._selectedStepId=r.id,console.log("✅ Step created and selected:",r)}this._closeStepModal()}_selectStep(s){this._selectedStepId=s,console.log("🎯 Step selected:",s)}_getSelectedStep(){return!this._selectedStepId||!this._templateData.steps?null:this._templateData.steps.find(s=>s.id===this._selectedStepId)||null}_handleDragStart(s,e){this._draggedStepId=e,s.dataTransfer&&(s.dataTransfer.effectAllowed="move",s.dataTransfer.setData("text/plain",e)),console.log("🔄 Drag started for step:",e)}_handleDragEnd(s){this._draggedStepId=null,this._dragOverStepId=null,console.log("🔄 Drag ended")}_handleDragOver(s,e){s.preventDefault(),s.dataTransfer&&(s.dataTransfer.dropEffect="move"),this._dragOverStepId!==e&&(this._dragOverStepId=e)}_handleDragLeave(s){const e=s.relatedTarget;s.currentTarget.contains(e)||(this._dragOverStepId=null)}_handleDrop(s,e){if(s.preventDefault(),!this._draggedStepId||this._draggedStepId===e){this._draggedStepId=null,this._dragOverStepId=null;return}const t=this._templateData.steps||[],i=t.findIndex(a=>a.id===this._draggedStepId),r=t.findIndex(a=>a.id===e);if(i===-1||r===-1){console.error("Could not find step indices for reordering");return}console.log("🔄 Before reorder:",t.map((a,d)=>`${d+1}: ${a.title}`));const n=[...t],[o]=n.splice(i,1);n.splice(r,0,o),n.forEach((a,d)=>{a.order=d+1}),console.log("🔄 After reorder:",n.map((a,d)=>`${d+1}: ${a.title}`)),this._templateData={...this._templateData,steps:n},console.log("📝 Template updated with new step order"),this._draggedStepId=null,this._dragOverStepId=null}_addQuestion(s="text_input"){var i,r;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(s)){let n={id:E(),type:s,order:(((i=e.elements)==null?void 0:i.length)||0)+1};switch(s){case"text":n.content="Enter your text content here...";break;case"html":n.content="<p>Enter your HTML content here...</p>";break;case"divider":n.content="",n.caption="Section Divider";break;case"markdown":n.content=`## Enter your markdown content here...
|
|
2818
3252
|
|
|
2819
|
-
Use **bold** and *italic* text.`;break}const o=this._templateData.steps.map(a=>a.id===this._selectedStepId?{...a,elements:[...a.elements||[],
|
|
3253
|
+
Use **bold** and *italic* text.`;break}const o=this._templateData.steps.map(a=>a.id===this._selectedStepId?{...a,elements:[...a.elements||[],n]}:a);this._templateData={...this._templateData,steps:o},console.log("✅ Content element added to step:",this._selectedStepId)}else{const n={id:E(),type:s,label:this._getQuestionTypeDisplayName(s),order:(((r=e.elements)==null?void 0:r.length)||0)+1,required:!1};["select","radio","checkbox"].includes(s)&&(n.options=["Option 1","Option 2"]);const o=this._templateData.steps.map(a=>a.id===this._selectedStepId?{...a,elements:[...a.elements||[],n]}:a);this._templateData={...this._templateData,steps:o},console.log("✅ Question added to step:",this._selectedStepId)}}_addContentElement(s){var r;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:E(),type:s,order:(((r=e.elements)==null?void 0:r.length)||0)+1};switch(s){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...
|
|
2820
3254
|
|
|
2821
|
-
Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(
|
|
3255
|
+
Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(n=>n.id===this._selectedStepId?{...n,elements:[...n.elements||[],t]}:n);this._templateData={...this._templateData,steps:i},console.log("✅ Content element added to step:",this._selectedStepId)}_updateQuestion(s,e){var i;if(!this._selectedStepId)return;const t=(i=this._templateData.steps)==null?void 0:i.map(r=>{var n;return r.id===this._selectedStepId?{...r,elements:((n=r.elements)==null?void 0:n.map(o=>o.id===s?{...o,...e}:o))||[]}:r});this._templateData={...this._templateData,steps:t}}_updateContentElement(s,e){var i;if(!this._selectedStepId)return;const t=(i=this._templateData.steps)==null?void 0:i.map(r=>{var n;return r.id===this._selectedStepId?{...r,elements:((n=r.elements)==null?void 0:n.map(o=>o.id===s?{...o,...e}:o))||[]}:r});this._templateData={...this._templateData,steps:t}}_deleteQuestion(s){var t;if(!this._selectedStepId)return;const e=(t=this._templateData.steps)==null?void 0:t.map(i=>{var r;return i.id===this._selectedStepId?{...i,elements:((r=i.elements)==null?void 0:r.filter(n=>n.id!==s))||[]}:i});this._templateData={...this._templateData,steps:e},console.log("🗑️ Question deleted:",s)}_renderQuestionTypeSpecificFields(s){switch(s.type){case"select":case"radio":return l`
|
|
2822
3256
|
<div class="question-options-section">
|
|
2823
3257
|
<label class="options-label">Options:</label>
|
|
2824
3258
|
<div class="options-list">
|
|
2825
|
-
${(s.options||[]).map((e,t)=>
|
|
3259
|
+
${(s.options||[]).map((e,t)=>l`
|
|
2826
3260
|
<div class="option-item">
|
|
2827
3261
|
<input
|
|
2828
3262
|
type="text"
|
|
2829
3263
|
class="option-input"
|
|
2830
3264
|
placeholder="Option ${t+1}"
|
|
2831
3265
|
.value=${e}
|
|
2832
|
-
@input=${i=>{const
|
|
3266
|
+
@input=${i=>{const r=i.target,n=[...s.options||[]];n[t]=r.value,this._updateQuestion(s.id,{options:n})}}
|
|
2833
3267
|
/>
|
|
2834
3268
|
<button
|
|
2835
3269
|
class="remove-option-button"
|
|
@@ -2863,7 +3297,7 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
2863
3297
|
</button>
|
|
2864
3298
|
</div>
|
|
2865
3299
|
</div>
|
|
2866
|
-
`;case"checkbox":return
|
|
3300
|
+
`;case"checkbox":return l`
|
|
2867
3301
|
<div class="question-checkbox-config">
|
|
2868
3302
|
<div class="checkbox-type-selection">
|
|
2869
3303
|
<label class="checkbox-type-label">
|
|
@@ -2888,18 +3322,18 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
2888
3322
|
</label>
|
|
2889
3323
|
</div>
|
|
2890
3324
|
|
|
2891
|
-
${s.options&&s.options.length>0?
|
|
3325
|
+
${s.options&&s.options.length>0?l`
|
|
2892
3326
|
<div class="question-options-section">
|
|
2893
3327
|
<label class="options-label">Checkbox Options:</label>
|
|
2894
3328
|
<div class="options-list">
|
|
2895
|
-
${(s.options||[]).map((e,t)=>
|
|
3329
|
+
${(s.options||[]).map((e,t)=>l`
|
|
2896
3330
|
<div class="option-item">
|
|
2897
3331
|
<input
|
|
2898
3332
|
type="text"
|
|
2899
3333
|
class="option-input"
|
|
2900
3334
|
placeholder="Option ${t+1}"
|
|
2901
3335
|
.value=${e}
|
|
2902
|
-
@input=${i=>{const
|
|
3336
|
+
@input=${i=>{const r=i.target,n=[...s.options||[]];n[t]=r.value,this._updateQuestion(s.id,{options:n})}}
|
|
2903
3337
|
/>
|
|
2904
3338
|
<button
|
|
2905
3339
|
class="remove-option-button"
|
|
@@ -2947,7 +3381,7 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
2947
3381
|
</button>
|
|
2948
3382
|
</div>
|
|
2949
3383
|
</div>
|
|
2950
|
-
`:
|
|
3384
|
+
`:l`
|
|
2951
3385
|
<div class="single-checkbox-info">
|
|
2952
3386
|
<p class="config-note">
|
|
2953
3387
|
Single checkbox - users can check/uncheck for Yes/No response
|
|
@@ -2955,7 +3389,7 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
2955
3389
|
</div>
|
|
2956
3390
|
`}
|
|
2957
3391
|
</div>
|
|
2958
|
-
`;case"textarea":return
|
|
3392
|
+
`;case"textarea":return l`
|
|
2959
3393
|
<div class="question-config-section">
|
|
2960
3394
|
<label class="config-label">
|
|
2961
3395
|
Placeholder:
|
|
@@ -2968,7 +3402,7 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
2968
3402
|
/>
|
|
2969
3403
|
</label>
|
|
2970
3404
|
</div>
|
|
2971
|
-
`;case"text_input":return
|
|
3405
|
+
`;case"text_input":return l`
|
|
2972
3406
|
<div class="question-config-section">
|
|
2973
3407
|
<label class="config-label">
|
|
2974
3408
|
Placeholder:
|
|
@@ -2981,7 +3415,7 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
2981
3415
|
/>
|
|
2982
3416
|
</label>
|
|
2983
3417
|
</div>
|
|
2984
|
-
`;case"number":return
|
|
3418
|
+
`;case"number":return l`
|
|
2985
3419
|
<div class="question-config-section">
|
|
2986
3420
|
<label class="config-label">
|
|
2987
3421
|
Placeholder:
|
|
@@ -2994,19 +3428,19 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
2994
3428
|
/>
|
|
2995
3429
|
</label>
|
|
2996
3430
|
</div>
|
|
2997
|
-
`;case"file_upload":return
|
|
3431
|
+
`;case"file_upload":return l`
|
|
2998
3432
|
<div class="question-config-section">
|
|
2999
3433
|
<p class="config-note">File upload field - users can upload files</p>
|
|
3000
3434
|
</div>
|
|
3001
|
-
`;case"signature":return
|
|
3435
|
+
`;case"signature":return l`
|
|
3002
3436
|
<div class="question-config-section">
|
|
3003
3437
|
<p class="config-note">Digital signature pad - users can sign with mouse/touch</p>
|
|
3004
3438
|
</div>
|
|
3005
|
-
`;case"date":return
|
|
3439
|
+
`;case"date":return l`
|
|
3006
3440
|
<div class="question-config-section">
|
|
3007
3441
|
<p class="config-note">Date picker field</p>
|
|
3008
3442
|
</div>
|
|
3009
|
-
`;default:return
|
|
3443
|
+
`;default:return l``}}_renderContentTypeSpecificFields(s){switch(s.type){case"text":return l`
|
|
3010
3444
|
<div class="content-config-section">
|
|
3011
3445
|
<label class="config-label">
|
|
3012
3446
|
Text Content:
|
|
@@ -3018,7 +3452,7 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
3018
3452
|
></textarea>
|
|
3019
3453
|
</label>
|
|
3020
3454
|
</div>
|
|
3021
|
-
`;case"html":return
|
|
3455
|
+
`;case"html":return l`
|
|
3022
3456
|
<div class="content-config-section">
|
|
3023
3457
|
<label class="config-label">
|
|
3024
3458
|
HTML Content:
|
|
@@ -3030,7 +3464,7 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
3030
3464
|
></textarea>
|
|
3031
3465
|
</label>
|
|
3032
3466
|
</div>
|
|
3033
|
-
`;case"image":return
|
|
3467
|
+
`;case"image":return l`
|
|
3034
3468
|
<div class="content-config-section">
|
|
3035
3469
|
<label class="config-label">
|
|
3036
3470
|
Image URL:
|
|
@@ -3063,7 +3497,7 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
3063
3497
|
/>
|
|
3064
3498
|
</label>
|
|
3065
3499
|
</div>
|
|
3066
|
-
`;case"video":return
|
|
3500
|
+
`;case"video":return l`
|
|
3067
3501
|
<div class="content-config-section">
|
|
3068
3502
|
<label class="config-label">
|
|
3069
3503
|
Video URL:
|
|
@@ -3086,7 +3520,7 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
3086
3520
|
/>
|
|
3087
3521
|
</label>
|
|
3088
3522
|
</div>
|
|
3089
|
-
`;case"file":return
|
|
3523
|
+
`;case"file":return l`
|
|
3090
3524
|
<div class="content-config-section">
|
|
3091
3525
|
<label class="config-label">
|
|
3092
3526
|
File URL:
|
|
@@ -3109,7 +3543,7 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
3109
3543
|
/>
|
|
3110
3544
|
</label>
|
|
3111
3545
|
</div>
|
|
3112
|
-
`;case"divider":return
|
|
3546
|
+
`;case"divider":return l`
|
|
3113
3547
|
<div class="content-config-section">
|
|
3114
3548
|
<label class="config-label">
|
|
3115
3549
|
Caption:
|
|
@@ -3122,7 +3556,7 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
3122
3556
|
/>
|
|
3123
3557
|
</label>
|
|
3124
3558
|
</div>
|
|
3125
|
-
`;case"markdown":return
|
|
3559
|
+
`;case"markdown":return l`
|
|
3126
3560
|
<div class="content-config-section">
|
|
3127
3561
|
<label class="config-label">
|
|
3128
3562
|
Markdown Content:
|
|
@@ -3134,7 +3568,7 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
3134
3568
|
></textarea>
|
|
3135
3569
|
</label>
|
|
3136
3570
|
</div>
|
|
3137
|
-
`;default:return
|
|
3571
|
+
`;default:return l``}}_getQuestionTypeDisplayName(s){switch(s){case"text_input":return"Text Input";case"textarea":return"Long Text";case"select":return"Select";case"radio":return"Radio";case"checkbox":return"Checkbox";case"number":return"Number";case"date":return"Date";case"file_upload":return"File Upload";case"signature":return"Signature";default:return"Question"}}_getContentTypeDisplayName(s){switch(s){case"text":return"Text";case"html":return"HTML";case"image":return"Image";case"video":return"Video";case"file":return"File";case"divider":return"Divider";case"markdown":return"Markdown";default:return"Content"}}_getCheckboxTypeDisplayName(s){return s.options&&s.options.length>0?"Checkbox Group":"Single Checkbox"}_hasSteps(){const s=!!(this._templateData.steps&&this._templateData.steps.length>0);return s&&!this._selectedStepId&&this._templateData.steps&&(this._selectedStepId=this._templateData.steps[0].id,console.log("🎯 Auto-selected first step:",this._templateData.steps[0].title)),!s&&this._selectedStepId&&(this._selectedStepId=null),s}_getAssignmentDisplayText(s){switch(s.category){case"individual":switch(s.type){case"subject":return"Assigned to: Subject";case"creator":return"Assigned to: Creator";case"instance_assignee_select":return"Assigned to: To be selected";case"specific_user":return s.email?`Assigned to: ${s.email}`:"Assigned to: Specific user";default:return"Assigned to: Individual"}case"role":switch(s.type){case"instance_role_assignee_select":return s.targetId?`Assigned to: ${s.targetId} role`:"Assigned to: Role";default:return"Assigned to: Role"}default:return"Assignment not configured"}}render(){var e;const s=this._getSelectedStep();return l`
|
|
3138
3572
|
<div class="header">
|
|
3139
3573
|
<div class="header-inputs">
|
|
3140
3574
|
<div class="form-group">
|
|
@@ -3164,7 +3598,7 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
3164
3598
|
</div>
|
|
3165
3599
|
|
|
3166
3600
|
<div class="main-content">
|
|
3167
|
-
${this._showStepModal?
|
|
3601
|
+
${this._showStepModal?l`
|
|
3168
3602
|
<div class="modal-overlay" @click=${this._closeStepModal}>
|
|
3169
3603
|
<div class="modal-content" @click=${t=>t.stopPropagation()}>
|
|
3170
3604
|
<div class="modal-header">
|
|
@@ -3225,7 +3659,7 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
3225
3659
|
</div>
|
|
3226
3660
|
</div>
|
|
3227
3661
|
|
|
3228
|
-
${this._stepAssignmentCategory==="individual"?
|
|
3662
|
+
${this._stepAssignmentCategory==="individual"?l`
|
|
3229
3663
|
<div class="assignment-radio-group">
|
|
3230
3664
|
<label class="assignment-radio-option">
|
|
3231
3665
|
<input
|
|
@@ -3296,7 +3730,23 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
3296
3730
|
</label>
|
|
3297
3731
|
</div>
|
|
3298
3732
|
|
|
3299
|
-
${this._stepAssignmentType==="specific_user"?
|
|
3733
|
+
${this._stepAssignmentType==="specific_user"?l`
|
|
3734
|
+
<div class="assignment-name-fields">
|
|
3735
|
+
<input
|
|
3736
|
+
type="text"
|
|
3737
|
+
class="assignment-name-input"
|
|
3738
|
+
placeholder="First name"
|
|
3739
|
+
.value=${this._stepAssignmentFirstName}
|
|
3740
|
+
@input=${t=>{const i=t.target;this._stepAssignmentFirstName=i.value}}
|
|
3741
|
+
/>
|
|
3742
|
+
<input
|
|
3743
|
+
type="text"
|
|
3744
|
+
class="assignment-name-input"
|
|
3745
|
+
placeholder="Last name"
|
|
3746
|
+
.value=${this._stepAssignmentLastName}
|
|
3747
|
+
@input=${t=>{const i=t.target;this._stepAssignmentLastName=i.value}}
|
|
3748
|
+
/>
|
|
3749
|
+
</div>
|
|
3300
3750
|
<input
|
|
3301
3751
|
type="email"
|
|
3302
3752
|
class="assignment-select"
|
|
@@ -3305,7 +3755,7 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
3305
3755
|
@input=${t=>{const i=t.target;this._stepAssignmentTarget=i.value}}
|
|
3306
3756
|
/>
|
|
3307
3757
|
`:""}
|
|
3308
|
-
`:
|
|
3758
|
+
`:l`
|
|
3309
3759
|
<div class="assignment-radio-group">
|
|
3310
3760
|
<label class="assignment-radio-option">
|
|
3311
3761
|
<input
|
|
@@ -3349,11 +3799,11 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
3349
3799
|
<div class="section">
|
|
3350
3800
|
<div class="section-header">
|
|
3351
3801
|
<h2>Steps</h2>
|
|
3352
|
-
<button class="add-button" @click=${this._addStep}>Add</button>
|
|
3802
|
+
<button class="add-button" @click=${this._addStep}>Add step</button>
|
|
3353
3803
|
</div>
|
|
3354
3804
|
|
|
3355
3805
|
<div class="steps-list">
|
|
3356
|
-
${((e=this._templateData.steps)==null?void 0:e.map(t=>
|
|
3806
|
+
${((e=this._templateData.steps)==null?void 0:e.map(t=>l`
|
|
3357
3807
|
<div
|
|
3358
3808
|
class="step-item ${this._selectedStepId===t.id?"selected":""} ${this._dragOverStepId===t.id?"drag-over":""}"
|
|
3359
3809
|
@click=${()=>this._selectStep(t.id)}
|
|
@@ -3419,7 +3869,7 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
3419
3869
|
>
|
|
3420
3870
|
⋯
|
|
3421
3871
|
</button>
|
|
3422
|
-
${this._openMenuStepId===t.id?
|
|
3872
|
+
${this._openMenuStepId===t.id?l`
|
|
3423
3873
|
<div class="step-menu-dropdown">
|
|
3424
3874
|
<button
|
|
3425
3875
|
class="step-menu-item"
|
|
@@ -3508,24 +3958,23 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
3508
3958
|
<!-- Questions Section -->
|
|
3509
3959
|
<div class="section">
|
|
3510
3960
|
<div class="section-header">
|
|
3511
|
-
<h2>
|
|
3512
|
-
<button class="add-button" @click=${()=>this._addQuestion()}>Add</button>
|
|
3961
|
+
<h2>Blocks</h2>
|
|
3962
|
+
<button class="add-button" @click=${()=>this._addQuestion()}>Add block</button>
|
|
3513
3963
|
</div>
|
|
3514
3964
|
|
|
3515
|
-
${s&&s.elements&&s.elements.length>0?
|
|
3965
|
+
${s&&s.elements&&s.elements.length>0?l`
|
|
3516
3966
|
<div class="elements-list">
|
|
3517
|
-
${s.elements.map(t=>{const i="label"in t&&"required"in t,
|
|
3967
|
+
${s.elements.map(t=>{const i="label"in t&&"required"in t,r="content"in t;if(i){const n=t;return l`
|
|
3518
3968
|
<div class="question-item">
|
|
3519
3969
|
<div class="question-header">
|
|
3520
3970
|
<h3 class="question-title">
|
|
3521
|
-
${
|
|
3971
|
+
${n.label||(n.type==="checkbox"?this._getCheckboxTypeDisplayName(n):this._getQuestionTypeDisplayName(n.type))}
|
|
3522
3972
|
</h3>
|
|
3523
3973
|
<div class="question-header-controls">
|
|
3524
3974
|
<select
|
|
3525
3975
|
class="question-type-select"
|
|
3526
|
-
.value=${
|
|
3527
|
-
|
|
3528
|
-
@change=${o=>{const l=o.target.value;if(["text","html","divider","markdown"].includes(l)){this._addQuestion(l),this._deleteQuestion(r.id);return}const c={type:l};["select","radio","checkbox"].includes(l)&&!r.options&&(c.options=["Option 1","Option 2"]);const u=this._getQuestionTypeDisplayName(r.type);(!r.label||r.label===u)&&(c.label=this._getQuestionTypeDisplayName(l)),this._updateQuestion(r.id,c)}}
|
|
3976
|
+
.value=${n.type||"text_input"}
|
|
3977
|
+
@change=${o=>{const d=o.target.value;if(["text","html","divider","markdown"].includes(d)){this._addQuestion(d),this._deleteQuestion(n.id);return}const c={type:d};["select","radio","checkbox"].includes(d)&&!n.options&&(c.options=["Option 1","Option 2"]);const u=this._getQuestionTypeDisplayName(n.type);(!n.label||n.label===u)&&(c.label=this._getQuestionTypeDisplayName(d)),this._updateQuestion(n.id,c)}}
|
|
3529
3978
|
>
|
|
3530
3979
|
<optgroup label="Questions">
|
|
3531
3980
|
<option value="text_input">Text Input (short)</option>
|
|
@@ -3547,8 +3996,8 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
3547
3996
|
</select>
|
|
3548
3997
|
<button
|
|
3549
3998
|
class="delete-question-button"
|
|
3550
|
-
@click=${()=>this._deleteQuestion(
|
|
3551
|
-
title="Delete question"
|
|
3999
|
+
@click=${()=>this._deleteQuestion(n.id)}
|
|
4000
|
+
title="Delete question block"
|
|
3552
4001
|
>
|
|
3553
4002
|
<svg
|
|
3554
4003
|
xmlns="http://www.w3.org/2000/svg"
|
|
@@ -3576,33 +4025,32 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
3576
4025
|
type="text"
|
|
3577
4026
|
class="question-label-input"
|
|
3578
4027
|
placeholder="Question label"
|
|
3579
|
-
.value=${
|
|
3580
|
-
@input=${o=>{const a=o.target;this._updateQuestion(
|
|
4028
|
+
.value=${n.label||""}
|
|
4029
|
+
@input=${o=>{const a=o.target;this._updateQuestion(n.id,{label:a.value})}}
|
|
3581
4030
|
/>
|
|
3582
4031
|
|
|
3583
|
-
${this._renderQuestionTypeSpecificFields(
|
|
4032
|
+
${this._renderQuestionTypeSpecificFields(n)}
|
|
3584
4033
|
|
|
3585
4034
|
<label class="question-required-label">
|
|
3586
4035
|
<input
|
|
3587
4036
|
type="checkbox"
|
|
3588
|
-
.checked=${
|
|
3589
|
-
@change=${o=>{const a=o.target;this._updateQuestion(
|
|
4037
|
+
.checked=${n.required||!1}
|
|
4038
|
+
@change=${o=>{const a=o.target;this._updateQuestion(n.id,{required:a.checked})}}
|
|
3590
4039
|
/>
|
|
3591
4040
|
Required
|
|
3592
4041
|
</label>
|
|
3593
4042
|
</div>
|
|
3594
|
-
`}else if(
|
|
4043
|
+
`}else if(r){const n=t;return l`
|
|
3595
4044
|
<div class="question-item">
|
|
3596
4045
|
<div class="question-header">
|
|
3597
4046
|
<h3 class="question-title">
|
|
3598
|
-
${this._getContentTypeDisplayName(
|
|
4047
|
+
${this._getContentTypeDisplayName(n.type)}
|
|
3599
4048
|
</h3>
|
|
3600
4049
|
<div class="question-header-controls">
|
|
3601
4050
|
<select
|
|
3602
4051
|
class="question-type-select"
|
|
3603
4052
|
.value=${t.type||"text"}
|
|
3604
|
-
|
|
3605
|
-
@change=${o=>{const l=o.target.value;if(!["text","html","divider","markdown"].includes(l)){this._addQuestion(l),this._deleteQuestion(t.id);return}this._addQuestion(l),this._deleteQuestion(t.id)}}
|
|
4053
|
+
@change=${o=>{const d=o.target.value;if(!["text","html","divider","markdown"].includes(d)){this._addQuestion(d),this._deleteQuestion(t.id);return}this._addQuestion(d),this._deleteQuestion(t.id)}}
|
|
3606
4054
|
>
|
|
3607
4055
|
<optgroup label="Questions">
|
|
3608
4056
|
<option value="text_input">Text Input (short)</option>
|
|
@@ -3625,7 +4073,7 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
3625
4073
|
<button
|
|
3626
4074
|
class="delete-question-button"
|
|
3627
4075
|
@click=${()=>this._deleteQuestion(t.id)}
|
|
3628
|
-
title="Delete content"
|
|
4076
|
+
title="Delete content block"
|
|
3629
4077
|
>
|
|
3630
4078
|
<svg
|
|
3631
4079
|
xmlns="http://www.w3.org/2000/svg"
|
|
@@ -3649,18 +4097,18 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
3649
4097
|
</div>
|
|
3650
4098
|
</div>
|
|
3651
4099
|
<div class="question-content">
|
|
3652
|
-
${this._renderContentTypeSpecificFields(
|
|
4100
|
+
${this._renderContentTypeSpecificFields(n)}
|
|
3653
4101
|
</div>
|
|
3654
4102
|
</div>
|
|
3655
|
-
`}else{const
|
|
4103
|
+
`}else{const n=t;return l`
|
|
3656
4104
|
<div class="question-item">
|
|
3657
4105
|
<div class="question-header">
|
|
3658
4106
|
<h3 class="question-title">Unknown Element</h3>
|
|
3659
4107
|
<div class="question-header-controls">
|
|
3660
4108
|
<button
|
|
3661
4109
|
class="delete-question-button"
|
|
3662
|
-
@click=${()=>this._deleteQuestion(
|
|
3663
|
-
title="Delete
|
|
4110
|
+
@click=${()=>this._deleteQuestion(n.id)}
|
|
4111
|
+
title="Delete block"
|
|
3664
4112
|
>
|
|
3665
4113
|
✕
|
|
3666
4114
|
</button>
|
|
@@ -3669,125 +4117,127 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
3669
4117
|
</div>
|
|
3670
4118
|
`}})}
|
|
3671
4119
|
</div>
|
|
3672
|
-
`:
|
|
4120
|
+
`:l`
|
|
3673
4121
|
<div class="empty-state">
|
|
3674
|
-
<h3>Add
|
|
4122
|
+
<h3>Add blocks</h3>
|
|
3675
4123
|
<p>Use the add button to start building your workflow</p>
|
|
3676
|
-
<button class="add-button" @click=${()=>this._addQuestion()}>
|
|
4124
|
+
<button class="add-button" @click=${()=>this._addQuestion()}>
|
|
4125
|
+
Add block
|
|
4126
|
+
</button>
|
|
3677
4127
|
</div>
|
|
3678
4128
|
`}
|
|
3679
4129
|
</div>
|
|
3680
4130
|
</div>
|
|
3681
4131
|
</div>
|
|
3682
|
-
`}};
|
|
4132
|
+
`}};_.styles=L`
|
|
3683
4133
|
${pt}
|
|
3684
4134
|
${ct}
|
|
3685
4135
|
${ut}
|
|
3686
|
-
${
|
|
4136
|
+
${Ue}
|
|
3687
4137
|
${ht}
|
|
3688
|
-
`,S([
|
|
4138
|
+
`,S([f()],_.prototype,"_templateData",2),S([f()],_.prototype,"_showStepModal",2),S([f()],_.prototype,"_stepFormData",2),S([f()],_.prototype,"_draggedStepId",2),S([f()],_.prototype,"_dragOverStepId",2),S([f()],_.prototype,"_selectedStepId",2),S([f()],_.prototype,"_questions",2),S([f()],_.prototype,"_editingStepId",2),S([f()],_.prototype,"_stepAssignmentCategory",2),S([f()],_.prototype,"_stepAssignmentType",2),S([f()],_.prototype,"_stepAssignmentTarget",2),S([f()],_.prototype,"_stepAssignmentFirstName",2),S([f()],_.prototype,"_stepAssignmentLastName",2),S([A({attribute:!1})],_.prototype,"onCancel",2),S([A({attribute:!1})],_.prototype,"workflow",2),S([f()],_.prototype,"_openMenuStepId",2),_=S([Ie("builder-widget")],_);class ft{constructor(e,t){this.signaturePads=e,this.savedSignatures=t}validateStep(e,t,i){if(i==="preview")return{isValid:!0,errors:{}};if(!e)return{isValid:!1,errors:{}};let r=!0;const n={};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&&(r=!1,n[a.id]=d.message)}}return{isValid:r,errors:n}}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 i=this.signaturePads.get(e.id);return!i||i.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,i,r,n,o){var c,u,h;const a=this.getStorageKey(e),d=o?{...o,currentStepId:(u=(c=o.steps)==null?void 0:c[i])==null?void 0:u.id,completedSteps:Array.from(n),steps:(h=o.steps)==null?void 0:h.map(m=>({...m,responses:m.responses||[]}))}:null,p={formData:t,timestamp:new Date().toISOString(),stepIndex:i,savedSignatures:Array.from(r),completedSteps:Array.from(n),instance:d};try{localStorage.setItem(a,JSON.stringify(p))}catch(m){console.warn("Failed to save form data to localStorage:",m)}}restoreFormData(e){const t=this.getStorageKey(e);try{const i=localStorage.getItem(t);if(!i)return null;const r=JSON.parse(i);return{formData:r.formData||{},stepIndex:r.stepIndex||0,savedSignatures:new Set(r.savedSignatures||[]),completedSteps:new Set(r.completedSteps||[]),savedInstance:r.instance||null}}catch(i){return console.warn("Failed to restore form data from localStorage:",i),null}}clearFormData(e,t="completed workflow"){const i=this.getStorageKey(e);try{localStorage.removeItem(i),console.log(`Cleared saved form data for ${t}`)}catch(r){console.warn("Failed to clear saved form data:",r)}}shouldRestoreData(e){return e==="default"}}/*!
|
|
3689
4139
|
* Signature Pad v5.0.10 | https://github.com/szimek/signature_pad
|
|
3690
4140
|
* (c) 2025 Szymon Nowak | Released under the MIT license
|
|
3691
|
-
*/class Z{constructor(e,t,i,n){if(isNaN(e)||isNaN(t))throw new Error(`Point is invalid: (${e}, ${t})`);this.x=+e,this.y=+t,this.pressure=i||0,this.time=n||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 i=this.calculateControlPoints(e[0],e[1],e[2]).c2,n=this.calculateControlPoints(e[1],e[2],e[3]).c1;return new ge(e[1],i,n,e[2],t.start,t.end)}static calculateControlPoints(e,t,i){const n=e.x-t.x,r=e.y-t.y,o=t.x-i.x,a=t.y-i.y,l={x:(e.x+t.x)/2,y:(e.y+t.y)/2},p={x:(t.x+i.x)/2,y:(t.y+i.y)/2},c=Math.sqrt(n*n+r*r),u=Math.sqrt(o*o+a*a),h=l.x-p.x,m=l.y-p.y,v=c+u==0?0:u/(c+u),D={x:p.x+h*v,y:p.y+m*v},se=t.x-D.x,ne=t.y-D.y;return{c1:new Z(l.x+se,l.y+ne),c2:new Z(p.x+se,p.y+ne)}}constructor(e,t,i,n,r,o){this.startPoint=e,this.control2=t,this.control1=i,this.endPoint=n,this.startWidth=r,this.endWidth=o}length(){let t=0,i,n;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),l=this.point(o,this.startPoint.y,this.control1.y,this.control2.y,this.endPoint.y);if(r>0){const p=a-i,c=l-n;t+=Math.sqrt(p*p+c*c)}i=a,n=l}return t}point(e,t,i,n,r){return t*(1-e)*(1-e)*(1-e)+3*i*(1-e)*(1-e)*e+3*n*(1-e)*e*e+r*e*e*e}}class vt{constructor(){try{this._et=new EventTarget}catch{this._et=document}}addEventListener(e,t,i){this._et.addEventListener(e,t,i)}dispatchEvent(e){return this._et.dispatchEvent(e)}removeEventListener(e,t,i){this._et.removeEventListener(e,t,i)}}function xt(s,e=250){let t=0,i=null,n,r,o;const a=()=>{t=Date.now(),i=null,n=s.apply(r,o),i||(r=null,o=[])};return function(...p){const c=Date.now(),u=e-(c-t);return r=this,o=p,u<=0||u>e?(i&&(clearTimeout(i),i=null),t=c,n=s.apply(r,o),i||(r=null,o=[])):i||(i=window.setTimeout(a,u)),n}}class ee extends vt{constructor(e,t={}){var i,n,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=(i=t.throttle)!==null&&i!==void 0?i:16,this.minDistance=(n=t.minDistance)!==null&&n!==void 0?n: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(ee.prototype._strokeUpdate,this.throttle):ee.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((i,n)=>{const r=new Image,o=t.ratio||window.devicePixelRatio||1,a=t.width||this.canvas.width/o,l=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,l),i()},r.onerror=u=>{n(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:i}=this._getListenerFunctions();switch(e.event.type){case"mousedown":i("mousemove",this._handleMouseMove,{passive:!1}),i("mouseup",this._handleMouseUp,{passive:!1});break;case"touchstart":i("touchmove",this._handleTouchMove,{passive:!1}),i("touchend",this._handleTouchEnd,{passive:!1});break;case"pointerdown":i("pointermove",this._handlePointerMove,{passive:!1}),i("pointerup",this._handlePointerUp,{passive:!1});break}this._drawingStroke=!0;const n=this._getPointGroupOptions(),r=Object.assign(Object.assign({},n),{points:[]});this._data.push(r),this._reset(n),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),i=this._data[this._data.length-1],n=i.points,r=n.length>0&&n[n.length-1],o=r?t.distanceTo(r)<=this.minDistance:!1,a=this._getPointGroupOptions(i);if(!r||!(r&&o)){const l=this._addPoint(t,a);r?l&&this._drawCurve(l,a):this._drawDot(t,a),n.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,i){const n=this.canvas.getBoundingClientRect();return new Z(e-n.left,t-n.top,i,new Date().getTime())}_addPoint(e,t){const{_lastPoints:i}=this;if(i.push(e),i.length>2){i.length===3&&i.unshift(i[0]);const n=this._calculateCurveWidths(i[1],i[2],t),r=ge.fromPoints(i,n);return i.shift(),r}return null}_calculateCurveWidths(e,t,i){const n=i.velocityFilterWeight*t.velocityFrom(e)+(1-i.velocityFilterWeight)*this._lastVelocity,r=this._strokeWidth(n,i),o={end:r,start:this._lastWidth};return this._lastVelocity=n,this._lastWidth=r,o}_strokeWidth(e,t){return Math.max(t.maxWidth/(e+1),t.minWidth)}_drawCurveSegment(e,t,i){const n=this._ctx;n.moveTo(e,t),n.arc(e,t,i,0,2*Math.PI,!1),this._isEmpty=!1}_drawCurve(e,t){const i=this._ctx,n=e.endWidth-e.startWidth,r=Math.ceil(e.length())*2;i.beginPath(),i.fillStyle=t.penColor;for(let o=0;o<r;o+=1){const a=o/r,l=a*a,p=l*a,c=1-a,u=c*c,h=u*c;let m=h*e.startPoint.x;m+=3*u*a*e.control1.x,m+=3*c*l*e.control2.x,m+=p*e.endPoint.x;let v=h*e.startPoint.y;v+=3*u*a*e.control1.y,v+=3*c*l*e.control2.y,v+=p*e.endPoint.y;const D=Math.min(e.startWidth+p*n,t.maxWidth);this._drawCurveSegment(m,v,D)}i.closePath(),i.fill()}_drawDot(e,t){const i=this._ctx,n=t.dotSize>0?t.dotSize:(t.minWidth+t.maxWidth)/2;i.beginPath(),this._drawCurveSegment(e.x,e.y,n),i.closePath(),i.fillStyle=t.penColor,i.fill()}_fromData(e,t,i){for(const n of e){const{points:r}=n,o=this._getPointGroupOptions(n);if(r.length>1)for(let a=0;a<r.length;a+=1){const l=r[a],p=new Z(l.x,l.y,l.pressure,l.time);a===0&&this._reset(o);const c=this._addPoint(p,o);c&&t(c,o)}else this._reset(o),i(r[0],o)}}toSVG({includeBackgroundColor:e=!1}={}){const t=this._data,i=Math.max(window.devicePixelRatio||1,1),n=0,r=0,o=this.canvas.width/i,a=this.canvas.height/i,l=document.createElementNS("http://www.w3.org/2000/svg","svg");if(l.setAttribute("xmlns","http://www.w3.org/2000/svg"),l.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink"),l.setAttribute("viewBox",`${n} ${r} ${o} ${a}`),l.setAttribute("width",o.toString()),l.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),l.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"),l.appendChild(u)}},(p,{penColor:c,dotSize:u,minWidth:h,maxWidth:m})=>{const v=document.createElement("circle"),D=u>0?u:(h+m)/2;v.setAttribute("r",D.toString()),v.setAttribute("cx",p.x.toString()),v.setAttribute("cy",p.y.toString()),v.setAttribute("fill",c),l.appendChild(v)}),l.outerHTML}}class _t{constructor(e){this.signaturePads=new Map,this.canvasElements=new Map,this.onSignatureChange=e}initializeSignaturePad(e,t){const i=t==null?void 0:t.getElementById(`signature-${e}`);if(!i)return null;this.clearSignaturePad(e),this.resizeCanvas(i);const n=new ee(i,{backgroundColor:"rgb(255, 255, 255)",penColor:"rgb(0, 0, 0)",minWidth:.5,maxWidth:2.5});return this.signaturePads.set(e,n),this.canvasElements.set(e,i),n.addEventListener("endStroke",()=>{this.handleSignatureChange(e)}),n}handleSignatureChange(e){var r;const t=this.signaturePads.get(e);if(!t)return;const i=!t.isEmpty(),n=i?t.toData():null;(r=this.onSignatureChange)==null||r.call(this,{questionId:e,hasSignature:i,signatureData:n})}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 i=t.toSVG(),n=t.toDataURL();return{questionId:e,svgData:i,dataURL:n}}restoreSignature(e,t){const i=this.signaturePads.get(e);if(!i||!t)return!1;try{return i.clear(),i.fromData(t),!0}catch(n){return console.warn(`Failed to restore signature for ${e}:`,n),!1}}handleResize(){this.signaturePads.forEach((e,t)=>{const i=this.canvasElements.get(t);if(i){this.resizeCanvas(i);const n=e.toData();e.clear(),e.fromData(n)}})}resizeCanvas(e){const t=Math.max(window.devicePixelRatio||1,1),i=window.getComputedStyle(e),n=parseFloat(i.width),r=parseFloat(i.height);e.width=n*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 yt{trackQuestionResponse(e,t,i){if(!e)return;e.responses||(e.responses=[]);const n=e.responses.findIndex(o=>o.elementId===t),r={elementId:t,value:i,answeredAt:new Date};n>=0?e.responses[n]=r:e.responses.push(r)}updateInstanceWithFormData(e,t){e!=null&&e.steps&&e.steps.forEach(i=>{i.responses||(i.responses=[]),i.elements.forEach(n=>{if(this.isQuestionElement(n.type)){const r=t[n.id];if(r!==void 0&&i.responses){let o=i.responses.find(a=>a.elementId===n.id);o?(o.value=r,o.answeredAt=new Date):(o={elementId:n.id,value:r,answeredAt:new Date},i.responses.push(o))}}})})}extractFormDataFromSteps(e){const t={};return e.forEach(i=>{i.responses&&i.responses.forEach(n=>{t[n.elementId]=n.value})}),t}hasChangedFromPrevious(e,t,i){if(!(i!=null&&i.steps))return!0;for(const n of i.steps)if(n.responses){const r=n.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 wt{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 i=e+1;i<t.steps.length;i++){const n=t.steps[i];if(this.isStepAssignedToUser(n))return i}return-1}isLastAssignedStep(e,t){if(this.mode==="preview"||this.mode==="admin"||this.mode==="view-only"||this.mode==="print"){const i=t==null?void 0:t.steps;return e===((i==null?void 0:i.length)||0)-1}return this.findNextAssignedStep(e,t)===-1}canNavigateToStep(e,t,i,n,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=i.steps;return!p||e<0||e>=p.length?{canNavigate:!1,newStepIndex:t,reason:"Invalid step index"}:{canNavigate:!0,newStepIndex:e}}const a=i.steps;if(!a||e<0||e>=a.length)return{canNavigate:!1,newStepIndex:t,reason:"Invalid step index"};const l=a[e];if(this.isStepAssignedToUser(l)){const p=n.has(l.id),c=this.isStepWithinAllowedRange(e,i,n);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,i){if(!(t!=null&&t.steps))return!1;const r=this.getAssignedSteps(t).map(l=>t.steps.findIndex(p=>p.id===l.id)).sort((l,p)=>l-p);let o=-1;for(const l of r){const p=t.steps[l];i.has(p.id)&&(o=l)}let a=-1;for(const l of r)if(l>o){a=l;break}return a!==-1?e<=a&&this.isStepAssignedToUser(t.steps[e]):this.isStepAssignedToUser(t.steps[e])}}const te=class te{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(i=>{i.responses&&i.responses.forEach(n=>{t[n.elementId]=n.value})}),this.formData=t}reset(){this.formData={},this.validationErrors={}}isQuestionElement(e){return te.QUESTION_ELEMENT_TYPES.includes(e.type)}getStepFormData(e){var i;const t={};return(i=e.elements)==null||i.forEach(n=>{if(this.isQuestionElement(n)){const r=n,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}};te.QUESTION_ELEMENT_TYPES=["text_input","textarea","select","number","radio","checkbox","date","file_upload","signature"];let me=te;const ie=class ie{constructor(e,t){this.formStateManager=e,this.responseTracker=t}handleFileUpload(e,t,i){var p,c,u,h,m;const n=t.target,r=(p=n.files)==null?void 0:p[0];if(!r){this.clearFile(e),(c=i.onRequestUpdate)==null||c.call(i);return}const o=this.validateFileSize(r);if(o){this.handleFileValidationError(e,o,n),(u=i.onRequestUpdate)==null||u.call(i);return}this.formStateManager.clearValidationError(e);const a=this.createFileInfo(r);this.formStateManager.setFormField(e,a);const l=this.hasFileChanged(e,a,i.savedInstance);l&&i.mode!=="preview"?this.executeFileUploadCallback(e,r,a,i):this.logSkippedCallback(e,i.mode,l),(h=i.onRequestUpdate)==null||h.call(i),i.mode!=="admin"&&((m=i.onFormDataSave)==null||m.call(i))}clearFile(e){this.formStateManager.setFormField(e,null),this.formStateManager.clearValidationError(e)}validateFileSize(e){return e.size>ie.MAX_FILE_SIZE?`File size must be less than 5MB. Current size: ${(e.size/1024/1024).toFixed(2)}MB`:null}handleFileValidationError(e,t,i){this.formStateManager.setValidationError(e,t),this.formStateManager.setFormField(e,null),i.value=""}createFileInfo(e){return{name:e.name,size:e.size,type:e.type,lastModified:e.lastModified}}hasFileChanged(e,t,i){if(!(i!=null&&i.steps))return!0;for(const n of i.steps)if(n.responses){const r=n.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,i,n){var r,o;console.log("File changed, calling callback for:",e),console.log("Callback function exists:",!!n.onFileUploaded),n.onFileUploaded&&n.onFileUploaded({instanceId:(r=n.instance)==null?void 0:r.id,stepId:(o=n.currentStep)==null?void 0:o.id,questionId:e,file:t,fileName:i.name,fileSize:i.size,fileType:i.type})}logSkippedCallback(e,t,i){t==="preview"?console.log("Preview mode: skipping file upload callback for:",e):i||console.log("File unchanged, skipping callback for:",e)}};ie.MAX_FILE_SIZE=5*1024*1024;let fe=ie;class k{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,i=["Bytes","KB","MB","GB"],n=Math.floor(Math.log(e)/Math.log(t));return parseFloat((e/Math.pow(t,n)).toFixed(2))+" "+i[n]}static _extractFilenameFromUrl(e){try{return new URL(e).pathname.split("/").pop()||""||"Uploaded File"}catch{const t=e.split("/"),i=t[t.length-1];return i&&i.includes(".")?i:"Uploaded File"}}static _guessFileTypeFromUrl(e){var r;const i=(r=k._extractFilenameFromUrl(e).split(".").pop())==null?void 0:r.toLowerCase();return i?{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"}[i]||`${i.toUpperCase()} File`:"Unknown"}static renderTextArea(e,t,i){return i.mode==="print"?d`<div class="print-response-value textarea-response">
|
|
3692
|
-
${t||
|
|
3693
|
-
</div>`:
|
|
4141
|
+
*/class Z{constructor(e,t,i,r){if(isNaN(e)||isNaN(t))throw new Error(`Point is invalid: (${e}, ${t})`);this.x=+e,this.y=+t,this.pressure=i||0,this.time=r||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 i=this.calculateControlPoints(e[0],e[1],e[2]).c2,r=this.calculateControlPoints(e[1],e[2],e[3]).c1;return new ge(e[1],i,r,e[2],t.start,t.end)}static calculateControlPoints(e,t,i){const r=e.x-t.x,n=e.y-t.y,o=t.x-i.x,a=t.y-i.y,d={x:(e.x+t.x)/2,y:(e.y+t.y)/2},p={x:(t.x+i.x)/2,y:(t.y+i.y)/2},c=Math.sqrt(r*r+n*n),u=Math.sqrt(o*o+a*a),h=d.x-p.x,m=d.y-p.y,v=c+u==0?0:u/(c+u),D={x:p.x+h*v,y:p.y+m*v},se=t.x-D.x,re=t.y-D.y;return{c1:new Z(d.x+se,d.y+re),c2:new Z(p.x+se,p.y+re)}}constructor(e,t,i,r,n,o){this.startPoint=e,this.control2=t,this.control1=i,this.endPoint=r,this.startWidth=n,this.endWidth=o}length(){let t=0,i,r;for(let n=0;n<=10;n+=1){const o=n/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(n>0){const p=a-i,c=d-r;t+=Math.sqrt(p*p+c*c)}i=a,r=d}return t}point(e,t,i,r,n){return t*(1-e)*(1-e)*(1-e)+3*i*(1-e)*(1-e)*e+3*r*(1-e)*e*e+n*e*e*e}}class vt{constructor(){try{this._et=new EventTarget}catch{this._et=document}}addEventListener(e,t,i){this._et.addEventListener(e,t,i)}dispatchEvent(e){return this._et.dispatchEvent(e)}removeEventListener(e,t,i){this._et.removeEventListener(e,t,i)}}function xt(s,e=250){let t=0,i=null,r,n,o;const a=()=>{t=Date.now(),i=null,r=s.apply(n,o),i||(n=null,o=[])};return function(...p){const c=Date.now(),u=e-(c-t);return n=this,o=p,u<=0||u>e?(i&&(clearTimeout(i),i=null),t=c,r=s.apply(n,o),i||(n=null,o=[])):i||(i=window.setTimeout(a,u)),r}}class ee extends vt{constructor(e,t={}){var i,r,n;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=(i=t.throttle)!==null&&i!==void 0?i:16,this.minDistance=(r=t.minDistance)!==null&&r!==void 0?r: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=(n=t.canvasContextOptions)!==null&&n!==void 0?n:{},this._strokeMoveUpdate=this.throttle?xt(ee.prototype._strokeUpdate,this.throttle):ee.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((i,r)=>{const n=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()),n.onload=()=>{this._ctx.drawImage(n,p,c,a,d),i()},n.onerror=u=>{r(u)},n.crossOrigin="anonymous",n.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:i}=this._getListenerFunctions();switch(e.event.type){case"mousedown":i("mousemove",this._handleMouseMove,{passive:!1}),i("mouseup",this._handleMouseUp,{passive:!1});break;case"touchstart":i("touchmove",this._handleTouchMove,{passive:!1}),i("touchend",this._handleTouchEnd,{passive:!1});break;case"pointerdown":i("pointermove",this._handlePointerMove,{passive:!1}),i("pointerup",this._handlePointerUp,{passive:!1});break}this._drawingStroke=!0;const r=this._getPointGroupOptions(),n=Object.assign(Object.assign({},r),{points:[]});this._data.push(n),this._reset(r),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),i=this._data[this._data.length-1],r=i.points,n=r.length>0&&r[r.length-1],o=n?t.distanceTo(n)<=this.minDistance:!1,a=this._getPointGroupOptions(i);if(!n||!(n&&o)){const d=this._addPoint(t,a);n?d&&this._drawCurve(d,a):this._drawDot(t,a),r.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,i){const r=this.canvas.getBoundingClientRect();return new Z(e-r.left,t-r.top,i,new Date().getTime())}_addPoint(e,t){const{_lastPoints:i}=this;if(i.push(e),i.length>2){i.length===3&&i.unshift(i[0]);const r=this._calculateCurveWidths(i[1],i[2],t),n=ge.fromPoints(i,r);return i.shift(),n}return null}_calculateCurveWidths(e,t,i){const r=i.velocityFilterWeight*t.velocityFrom(e)+(1-i.velocityFilterWeight)*this._lastVelocity,n=this._strokeWidth(r,i),o={end:n,start:this._lastWidth};return this._lastVelocity=r,this._lastWidth=n,o}_strokeWidth(e,t){return Math.max(t.maxWidth/(e+1),t.minWidth)}_drawCurveSegment(e,t,i){const r=this._ctx;r.moveTo(e,t),r.arc(e,t,i,0,2*Math.PI,!1),this._isEmpty=!1}_drawCurve(e,t){const i=this._ctx,r=e.endWidth-e.startWidth,n=Math.ceil(e.length())*2;i.beginPath(),i.fillStyle=t.penColor;for(let o=0;o<n;o+=1){const a=o/n,d=a*a,p=d*a,c=1-a,u=c*c,h=u*c;let m=h*e.startPoint.x;m+=3*u*a*e.control1.x,m+=3*c*d*e.control2.x,m+=p*e.endPoint.x;let v=h*e.startPoint.y;v+=3*u*a*e.control1.y,v+=3*c*d*e.control2.y,v+=p*e.endPoint.y;const D=Math.min(e.startWidth+p*r,t.maxWidth);this._drawCurveSegment(m,v,D)}i.closePath(),i.fill()}_drawDot(e,t){const i=this._ctx,r=t.dotSize>0?t.dotSize:(t.minWidth+t.maxWidth)/2;i.beginPath(),this._drawCurveSegment(e.x,e.y,r),i.closePath(),i.fillStyle=t.penColor,i.fill()}_fromData(e,t,i){for(const r of e){const{points:n}=r,o=this._getPointGroupOptions(r);if(n.length>1)for(let a=0;a<n.length;a+=1){const d=n[a],p=new Z(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),i(n[0],o)}}toSVG({includeBackgroundColor:e=!1}={}){const t=this._data,i=Math.max(window.devicePixelRatio||1,1),r=0,n=0,o=this.canvas.width/i,a=this.canvas.height/i,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",`${r} ${n} ${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:m})=>{const v=document.createElement("circle"),D=u>0?u:(h+m)/2;v.setAttribute("r",D.toString()),v.setAttribute("cx",p.x.toString()),v.setAttribute("cy",p.y.toString()),v.setAttribute("fill",c),d.appendChild(v)}),d.outerHTML}}class _t{constructor(e){this.signaturePads=new Map,this.canvasElements=new Map,this.onSignatureChange=e}initializeSignaturePad(e,t){const i=t==null?void 0:t.getElementById(`signature-${e}`);if(!i)return null;this.clearSignaturePad(e),this.resizeCanvas(i);const r=new ee(i,{backgroundColor:"rgb(255, 255, 255)",penColor:"rgb(0, 0, 0)",minWidth:.5,maxWidth:2.5});return this.signaturePads.set(e,r),this.canvasElements.set(e,i),r.addEventListener("endStroke",()=>{this.handleSignatureChange(e)}),r}handleSignatureChange(e){var n;const t=this.signaturePads.get(e);if(!t)return;const i=!t.isEmpty(),r=i?t.toData():null;(n=this.onSignatureChange)==null||n.call(this,{questionId:e,hasSignature:i,signatureData:r})}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 i=t.toSVG(),r=t.toDataURL();return{questionId:e,svgData:i,dataURL:r}}restoreSignature(e,t){const i=this.signaturePads.get(e);if(!i||!t)return!1;try{return i.clear(),i.fromData(t),!0}catch(r){return console.warn(`Failed to restore signature for ${e}:`,r),!1}}handleResize(){this.signaturePads.forEach((e,t)=>{const i=this.canvasElements.get(t);if(i){this.resizeCanvas(i);const r=e.toData();e.clear(),e.fromData(r)}})}resizeCanvas(e){const t=Math.max(window.devicePixelRatio||1,1),i=window.getComputedStyle(e),r=parseFloat(i.width),n=parseFloat(i.height);e.width=r*t,e.height=n*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 yt{trackQuestionResponse(e,t,i){if(!e)return;e.responses||(e.responses=[]);const r=e.responses.findIndex(o=>o.elementId===t),n={elementId:t,value:i,answeredAt:new Date};r>=0?e.responses[r]=n:e.responses.push(n)}updateInstanceWithFormData(e,t){e!=null&&e.steps&&e.steps.forEach(i=>{i.responses||(i.responses=[]),i.elements.forEach(r=>{if(this.isQuestionElement(r.type)){const n=t[r.id];if(n!==void 0&&i.responses){let o=i.responses.find(a=>a.elementId===r.id);o?(o.value=n,o.answeredAt=new Date):(o={elementId:r.id,value:n,answeredAt:new Date},i.responses.push(o))}}})})}extractFormDataFromSteps(e){const t={};return e.forEach(i=>{i.responses&&i.responses.forEach(r=>{t[r.elementId]=r.value})}),t}hasChangedFromPrevious(e,t,i){if(!(i!=null&&i.steps))return!0;for(const r of i.steps)if(r.responses){const n=r.responses.find(o=>o.elementId===e);if(n)return n.value!==t}return!0}isQuestionElement(e){return["text_input","textarea","select","number","radio","checkbox","date","file_upload","signature"].includes(e)}}class wt{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 i=e+1;i<t.steps.length;i++){const r=t.steps[i];if(this.isStepAssignedToUser(r))return i}return-1}isLastAssignedStep(e,t){if(this.mode==="preview"||this.mode==="admin"||this.mode==="view-only"||this.mode==="print"){const i=t==null?void 0:t.steps;return e===((i==null?void 0:i.length)||0)-1}return this.findNextAssignedStep(e,t)===-1}canNavigateToStep(e,t,i,r,n,o){if((n||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=i.steps;return!p||e<0||e>=p.length?{canNavigate:!1,newStepIndex:t,reason:"Invalid step index"}:{canNavigate:!0,newStepIndex:e}}const a=i.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=r.has(d.id),c=this.isStepWithinAllowedRange(e,i,r);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,i){if(!(t!=null&&t.steps))return!1;const n=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 n){const p=t.steps[d];i.has(p.id)&&(o=d)}let a=-1;for(const d of n)if(d>o){a=d;break}return a!==-1?e<=a&&this.isStepAssignedToUser(t.steps[e]):this.isStepAssignedToUser(t.steps[e])}}const te=class te{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(i=>{i.responses&&i.responses.forEach(r=>{t[r.elementId]=r.value})}),this.formData=t}reset(){this.formData={},this.validationErrors={}}isQuestionElement(e){return te.QUESTION_ELEMENT_TYPES.includes(e.type)}getStepFormData(e){var i;const t={};return(i=e.elements)==null||i.forEach(r=>{if(this.isQuestionElement(r)){const n=r,o=this.formData[n.id];o!==void 0&&(t[n.id]=o)}}),t}hasFormData(){return Object.keys(this.formData).length>0}getFormFieldIds(){return Object.keys(this.formData)}getValidationErrorCount(){return Object.keys(this.validationErrors).length}};te.QUESTION_ELEMENT_TYPES=["text_input","textarea","select","number","radio","checkbox","date","file_upload","signature"];let me=te;const ie=class ie{constructor(e,t){this.formStateManager=e,this.responseTracker=t}handleFileUpload(e,t,i){var p,c,u,h,m;const r=t.target,n=(p=r.files)==null?void 0:p[0];if(!n){this.clearFile(e),(c=i.onRequestUpdate)==null||c.call(i);return}const o=this.validateFileSize(n);if(o){this.handleFileValidationError(e,o,r),(u=i.onRequestUpdate)==null||u.call(i);return}this.formStateManager.clearValidationError(e);const a=this.createFileInfo(n);this.formStateManager.setFormField(e,a);const d=this.hasFileChanged(e,a,i.savedInstance);d&&i.mode!=="preview"?this.executeFileUploadCallback(e,n,a,i):this.logSkippedCallback(e,i.mode,d),(h=i.onRequestUpdate)==null||h.call(i),i.mode!=="admin"&&((m=i.onFormDataSave)==null||m.call(i))}clearFile(e){this.formStateManager.setFormField(e,null),this.formStateManager.clearValidationError(e)}validateFileSize(e){return e.size>ie.MAX_FILE_SIZE?`File size must be less than 5MB. Current size: ${(e.size/1024/1024).toFixed(2)}MB`:null}handleFileValidationError(e,t,i){this.formStateManager.setValidationError(e,t),this.formStateManager.setFormField(e,null),i.value=""}createFileInfo(e){return{name:e.name,size:e.size,type:e.type,lastModified:e.lastModified}}hasFileChanged(e,t,i){if(!(i!=null&&i.steps))return!0;for(const r of i.steps)if(r.responses){const n=r.responses.find(o=>o.elementId===e);if(n&&n.value&&typeof n.value=="object"){const o=n.value;return o.name!==t.name||o.size!==t.size||o.type!==t.type||o.lastModified!==t.lastModified}}return!0}executeFileUploadCallback(e,t,i,r){var n,o;console.log("File changed, calling callback for:",e),console.log("Callback function exists:",!!r.onFileUploaded),r.onFileUploaded&&r.onFileUploaded({instanceId:(n=r.instance)==null?void 0:n.id,stepId:(o=r.currentStep)==null?void 0:o.id,questionId:e,file:t,fileName:i.name,fileSize:i.size,fileType:i.type})}logSkippedCallback(e,t,i){t==="preview"?console.log("Preview mode: skipping file upload callback for:",e):i||console.log("File unchanged, skipping callback for:",e)}};ie.MAX_FILE_SIZE=5*1024*1024;let fe=ie;class k{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,i=["Bytes","KB","MB","GB"],r=Math.floor(Math.log(e)/Math.log(t));return parseFloat((e/Math.pow(t,r)).toFixed(2))+" "+i[r]}static _extractFilenameFromUrl(e){try{return new URL(e).pathname.split("/").pop()||""||"Uploaded File"}catch{const t=e.split("/"),i=t[t.length-1];return i&&i.includes(".")?i:"Uploaded File"}}static _guessFileTypeFromUrl(e){var n;const i=(n=k._extractFilenameFromUrl(e).split(".").pop())==null?void 0:n.toLowerCase();return i?{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"}[i]||`${i.toUpperCase()} File`:"Unknown"}static renderTextArea(e,t,i){return i.mode==="print"?l`<div class="print-response-value textarea-response">
|
|
4142
|
+
${t||l`<span class="print-no-response">No response</span>`}
|
|
4143
|
+
</div>`:l`<textarea
|
|
3694
4144
|
id=${e.id}
|
|
3695
4145
|
.value=${t}
|
|
3696
4146
|
?required=${e.required}
|
|
3697
4147
|
?disabled=${this._isInputDisabled(i)}
|
|
3698
4148
|
placeholder=${e.placeholder?e.placeholder:"Your response"}
|
|
3699
|
-
@input=${
|
|
3700
|
-
></textarea>`}static renderSelect(e,t,i){var
|
|
3701
|
-
${t||
|
|
3702
|
-
</div>`:
|
|
4149
|
+
@input=${r=>i.handlers.handleInputChange(e.id,r)}
|
|
4150
|
+
></textarea>`}static renderSelect(e,t,i){var r;return i.mode==="print"?l`<div class="print-response-value select-response">
|
|
4151
|
+
${t||l`<span class="print-no-response">No selection made</span>`}
|
|
4152
|
+
</div>`:l`<select
|
|
3703
4153
|
id=${e.id}
|
|
3704
4154
|
.value=${t}
|
|
3705
4155
|
?required=${e.required}
|
|
3706
4156
|
?disabled=${this._isInputDisabled(i)}
|
|
3707
4157
|
class=${t===""?"placeholder":""}
|
|
3708
|
-
@change=${
|
|
4158
|
+
@change=${n=>i.handlers.handleInputChange(e.id,n)}
|
|
3709
4159
|
>
|
|
3710
4160
|
<option value="">Choose</option>
|
|
3711
|
-
${(
|
|
3712
|
-
</select>`}static renderRadio(e,t,i){var o;const
|
|
3713
|
-
${t||
|
|
3714
|
-
</div>`:
|
|
3715
|
-
${(o=e.options)==null?void 0:o.map(a=>
|
|
4161
|
+
${(r=e.options)==null?void 0:r.map(n=>l`<option value=${n}>${n}</option>`)}
|
|
4162
|
+
</select>`}static renderRadio(e,t,i){var o;const r=this._isInputDisabled(i),n=i.mode==="print";return n?l`<div class="print-response-value radio-response">
|
|
4163
|
+
${t||l`<span class="print-no-response">No selection made</span>`}
|
|
4164
|
+
</div>`:l`<div class="radio-group ${n?"print-mode":""}">
|
|
4165
|
+
${(o=e.options)==null?void 0:o.map(a=>l`
|
|
3716
4166
|
<label class="radio-option">
|
|
3717
4167
|
<input
|
|
3718
4168
|
type="radio"
|
|
3719
4169
|
name=${e.id}
|
|
3720
4170
|
value=${a}
|
|
3721
4171
|
.checked=${t===a}
|
|
3722
|
-
?disabled=${
|
|
3723
|
-
@change=${
|
|
4172
|
+
?disabled=${r}
|
|
4173
|
+
@change=${n?null:d=>i.handlers.handleInputChange(e.id,d)}
|
|
3724
4174
|
/>
|
|
3725
4175
|
<span class="radio-label">${a}</span>
|
|
3726
4176
|
</label>
|
|
3727
4177
|
`)}
|
|
3728
|
-
</div>`}static renderCheckbox(e,t,i){var o;const
|
|
3729
|
-
${a.length>0?a.map(l
|
|
3730
|
-
</div>`}return
|
|
3731
|
-
${(o=e.options)==null?void 0:o.map(a=>
|
|
4178
|
+
</div>`}static renderCheckbox(e,t,i){var o;const r=this._isInputDisabled(i),n=i.mode==="print";if(e.options&&e.options.length>0){if(n){const a=Array.isArray(t)?t:[];return l`<div class="print-response-value checkbox-response">
|
|
4179
|
+
${a.length>0?a.map(d=>l`<div>• ${d}</div>`):l`<span class="print-no-response">No selections made</span>`}
|
|
4180
|
+
</div>`}return l`<div class="checkbox-group ${n?"print-mode":""}">
|
|
4181
|
+
${(o=e.options)==null?void 0:o.map(a=>l`
|
|
3732
4182
|
<label class="checkbox-option">
|
|
3733
4183
|
<input
|
|
3734
4184
|
type="checkbox"
|
|
3735
4185
|
name=${e.id}
|
|
3736
4186
|
value=${a}
|
|
3737
4187
|
.checked=${Array.isArray(t)?t.includes(a):!1}
|
|
3738
|
-
?disabled=${
|
|
3739
|
-
@change=${
|
|
4188
|
+
?disabled=${r}
|
|
4189
|
+
@change=${n?null:d=>i.handlers.handleCheckboxGroupChange(e.id,a,d)}
|
|
3740
4190
|
/>
|
|
3741
4191
|
<span class="checkbox-label">${a}</span>
|
|
3742
4192
|
</label>
|
|
3743
4193
|
`)}
|
|
3744
|
-
</div>`}else return
|
|
4194
|
+
</div>`}else return n?l`<div class="print-response-value checkbox-response">
|
|
3745
4195
|
${t?"Yes":"No"}
|
|
3746
|
-
</div>`:
|
|
4196
|
+
</div>`:l`<label class="checkbox-single ${n?"print-mode":""}">
|
|
3747
4197
|
<input
|
|
3748
4198
|
type="checkbox"
|
|
3749
4199
|
id=${e.id}
|
|
3750
4200
|
.checked=${!!t}
|
|
3751
|
-
?disabled=${
|
|
3752
|
-
@change=${
|
|
4201
|
+
?disabled=${r}
|
|
4202
|
+
@change=${n?null:a=>i.handlers.handleCheckboxChange(e.id,a)}
|
|
3753
4203
|
/>
|
|
3754
4204
|
<span class="checkbox-label">${e.label}</span>
|
|
3755
|
-
</label>`}static renderSignature(e,t,i){const
|
|
4205
|
+
</label>`}static renderSignature(e,t,i){const r=i.formData[e.id],n=!!i.formData[e.id],o=i.savedSignatures.has(e.id),a=i.replacingSignatures.has(e.id);if(i.mode==="print")return r&&typeof r=="string"?l`
|
|
3756
4206
|
<div class="print-response-value signature-response">
|
|
3757
4207
|
<img
|
|
3758
|
-
src="${
|
|
4208
|
+
src="${r}"
|
|
3759
4209
|
alt="Digital Signature"
|
|
3760
4210
|
class="signature-image"
|
|
3761
|
-
@error=${
|
|
4211
|
+
@error=${d=>{var u;const p=d.target;p.style.display="none";const c=(u=p.parentElement)==null?void 0:u.querySelector(".signature-fallback");c&&c.classList.remove("hidden")}}
|
|
3762
4212
|
/>
|
|
3763
4213
|
<div class="signature-fallback hidden">
|
|
3764
4214
|
<span class="signature-error">Unable to display signature</span>
|
|
3765
4215
|
</div>
|
|
3766
4216
|
</div>
|
|
3767
|
-
`:
|
|
4217
|
+
`:l`<div class="print-response-value signature-response">
|
|
3768
4218
|
<span class="print-no-response">No signature provided</span>
|
|
3769
|
-
</div>`;if(i.mode==="view-only")return
|
|
4219
|
+
</div>`;if(i.mode==="view-only")return r&&typeof r=="string"?l`
|
|
3770
4220
|
<div class="signature-view-only">
|
|
3771
4221
|
<img
|
|
3772
|
-
src="${
|
|
4222
|
+
src="${r}"
|
|
3773
4223
|
alt="Digital Signature"
|
|
3774
4224
|
class="signature-image"
|
|
3775
|
-
@error=${
|
|
4225
|
+
@error=${d=>{var u;const p=d.target;p.style.display="none";const c=(u=p.parentElement)==null?void 0:u.querySelector(".signature-fallback");c&&c.classList.remove("hidden")}}
|
|
3776
4226
|
/>
|
|
3777
4227
|
<div class="signature-fallback hidden">
|
|
3778
4228
|
<span class="signature-error">Unable to display signature</span>
|
|
3779
4229
|
</div>
|
|
3780
4230
|
</div>
|
|
3781
|
-
`:
|
|
4231
|
+
`:l`
|
|
3782
4232
|
<div class="signature-view-only">
|
|
3783
4233
|
<span class="no-signature">No signature captured</span>
|
|
3784
4234
|
</div>
|
|
3785
|
-
`;if(i.mode==="admin"&&
|
|
4235
|
+
`;if(i.mode==="admin"&&r&&typeof r=="string"&&!a){const d=r.trim().startsWith("<svg");return l`
|
|
3786
4236
|
<div class="signature-admin-display">
|
|
3787
4237
|
<div class="signature-existing">
|
|
3788
|
-
${l
|
|
4238
|
+
${d?l` <div class="signature-svg-container" .innerHTML=${r}></div> `:l`
|
|
3789
4239
|
<img
|
|
3790
|
-
src="${
|
|
4240
|
+
src="${r}"
|
|
3791
4241
|
alt="Digital Signature"
|
|
3792
4242
|
class="signature-image"
|
|
3793
4243
|
@error=${p=>{var h;const c=p.target;c.style.display="none";const u=(h=c.parentElement)==null?void 0:h.querySelector(".signature-fallback");u&&u.classList.remove("hidden")}}
|
|
@@ -3807,7 +4257,7 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
3807
4257
|
</button>
|
|
3808
4258
|
</div>
|
|
3809
4259
|
</div>
|
|
3810
|
-
`}return
|
|
4260
|
+
`}return l`
|
|
3811
4261
|
<div class="signature-container ${this._isInputDisabled(i)?"disabled":""}">
|
|
3812
4262
|
<canvas id="signature-${e.id}" class="signature-canvas"></canvas>
|
|
3813
4263
|
<div class="signature-controls">
|
|
@@ -3819,7 +4269,7 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
3819
4269
|
>
|
|
3820
4270
|
Clear
|
|
3821
4271
|
</button>
|
|
3822
|
-
${
|
|
4272
|
+
${n&&!o?l`
|
|
3823
4273
|
<button
|
|
3824
4274
|
type="button"
|
|
3825
4275
|
class="signature-save-btn"
|
|
@@ -3829,8 +4279,8 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
3829
4279
|
Save
|
|
3830
4280
|
</button>
|
|
3831
4281
|
`:""}
|
|
3832
|
-
${o?
|
|
3833
|
-
${i.mode==="admin"&&a?
|
|
4282
|
+
${o?l` <span class="signature-saved">✓ Saved</span> `:""}
|
|
4283
|
+
${i.mode==="admin"&&a?l`
|
|
3834
4284
|
<button
|
|
3835
4285
|
type="button"
|
|
3836
4286
|
class="signature-cancel-btn"
|
|
@@ -3841,45 +4291,45 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
3841
4291
|
`:""}
|
|
3842
4292
|
</div>
|
|
3843
4293
|
</div>
|
|
3844
|
-
`}static renderFileUpload(e,t,i){const
|
|
4294
|
+
`}static renderFileUpload(e,t,i){const r=i.formData[e.id];if(i.mode==="view-only"||i.mode==="print")if(r){const n=typeof r=="string",o=typeof r=="object"&&r.name;if(i.mode==="print"){if(o)return l`
|
|
3845
4295
|
<div class="print-response-value file-response">
|
|
3846
|
-
📎 ${
|
|
3847
|
-
${
|
|
3848
|
-
>(${k._formatFileSize(
|
|
4296
|
+
📎 ${r.name}
|
|
4297
|
+
${r.size?l` <span class="file-size"
|
|
4298
|
+
>(${k._formatFileSize(r.size)})</span
|
|
3849
4299
|
>`:""}
|
|
3850
4300
|
</div>
|
|
3851
|
-
`;if(
|
|
4301
|
+
`;if(n){const a=k._extractFilenameFromUrl(r);return l` <div class="print-response-value file-response">📎 ${a}</div> `}else return l` <div class="print-response-value file-response">📎 ${r}</div> `}else{const a=n?r:"#",d=o?r.name:n?k._extractFilenameFromUrl(r):"View File";return l`
|
|
3852
4302
|
<div class="file-upload-view-only">
|
|
3853
|
-
<a href="${a}" target="_blank" class="file-link"> 📎 ${
|
|
3854
|
-
${o&&
|
|
4303
|
+
<a href="${a}" target="_blank" class="file-link"> 📎 ${d} </a>
|
|
4304
|
+
${o&&r.size?l`
|
|
3855
4305
|
<span class="file-size-info"
|
|
3856
|
-
>(${k._formatFileSize(
|
|
4306
|
+
>(${k._formatFileSize(r.size)})</span
|
|
3857
4307
|
>
|
|
3858
4308
|
`:""}
|
|
3859
4309
|
</div>
|
|
3860
|
-
`}}else return i.mode==="print"?
|
|
4310
|
+
`}}else return i.mode==="print"?l`
|
|
3861
4311
|
<div class="print-response-value file-response">
|
|
3862
4312
|
<span class="print-no-response">No file uploaded</span>
|
|
3863
4313
|
</div>
|
|
3864
|
-
`:
|
|
4314
|
+
`:l`
|
|
3865
4315
|
<div class="file-upload-view-only">
|
|
3866
4316
|
<span class="no-file">No file uploaded</span>
|
|
3867
4317
|
</div>
|
|
3868
|
-
`;return
|
|
4318
|
+
`;return l`
|
|
3869
4319
|
<div class="file-upload-container">
|
|
3870
4320
|
<input
|
|
3871
4321
|
type="file"
|
|
3872
4322
|
id=${e.id}
|
|
3873
4323
|
?required=${e.required}
|
|
3874
4324
|
?disabled=${this._isInputDisabled(i)}
|
|
3875
|
-
@change=${
|
|
4325
|
+
@change=${n=>i.handlers.handleFileUpload(e.id,n)}
|
|
3876
4326
|
/>
|
|
3877
|
-
${
|
|
4327
|
+
${r?l`
|
|
3878
4328
|
<div class="file-preview">
|
|
3879
|
-
<span class="file-name">${
|
|
4329
|
+
<span class="file-name">${r.name||"File selected"}</span>
|
|
3880
4330
|
<button
|
|
3881
4331
|
type="button"
|
|
3882
|
-
class="file-
|
|
4332
|
+
class="file-remove-btn"
|
|
3883
4333
|
?disabled=${this._isInputDisabled(i)}
|
|
3884
4334
|
@click=${()=>{i.formData[e.id]=null,i.handlers.trackQuestionResponse(e.id,null)}}
|
|
3885
4335
|
>
|
|
@@ -3888,32 +4338,32 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
3888
4338
|
</div>
|
|
3889
4339
|
`:""}
|
|
3890
4340
|
</div>
|
|
3891
|
-
`}static renderDefaultInput(e,t,i){if(i.mode==="print"){const
|
|
3892
|
-
${
|
|
3893
|
-
</div>`}const
|
|
3894
|
-
type=${
|
|
4341
|
+
`}static renderDefaultInput(e,t,i){if(i.mode==="print"){const n=e.type==="date"&&t?new Date(t).toLocaleDateString():t;return l`<div class="print-response-value input-response">
|
|
4342
|
+
${n||l`<span class="print-no-response">No response</span>`}
|
|
4343
|
+
</div>`}const r=e.type==="number"?"number":e.type==="date"?"date":"text";return l`<input
|
|
4344
|
+
type=${r}
|
|
3895
4345
|
id=${e.id}
|
|
3896
4346
|
.value=${t}
|
|
3897
4347
|
?required=${e.required}
|
|
3898
4348
|
?disabled=${this._isInputDisabled(i)}
|
|
3899
4349
|
placeholder=${e.placeholder?e.placeholder:"Your response"} // custom placeholder when not blank
|
|
3900
|
-
@input=${
|
|
3901
|
-
/>`}static render(e,t){const i=t.formData[e.id]??"",
|
|
4350
|
+
@input=${n=>i.handlers.handleInputChange(e.id,n)}
|
|
4351
|
+
/>`}static render(e,t){const i=t.formData[e.id]??"",r=t.validationErrors[e.id],n=()=>{switch(e.type){case"textarea":return k.renderTextArea(e,i,t);case"select":return k.renderSelect(e,i,t);case"radio":return k.renderRadio(e,i,t);case"checkbox":return k.renderCheckbox(e,i,t);case"signature":return k.renderSignature(e,i,t);case"file_upload":return k.renderFileUpload(e,i,t);default:return k.renderDefaultInput(e,i,t)}},o=e.type==="checkbox"&&(!e.options||e.options.length===0);return t.mode==="print"?l`
|
|
3902
4352
|
<div class="question-print">
|
|
3903
|
-
${o?"":
|
|
3904
|
-
${
|
|
4353
|
+
${o?"":l` <div class="print-question-title">${e.label}:</div> `}
|
|
4354
|
+
${n()}
|
|
3905
4355
|
<hr class="print-question-separator" />
|
|
3906
4356
|
</div>
|
|
3907
|
-
`:
|
|
3908
|
-
<div class="question ${
|
|
3909
|
-
${o?"":
|
|
4357
|
+
`:l`
|
|
4358
|
+
<div class="question ${r?"error":""}">
|
|
4359
|
+
${o?"":l`
|
|
3910
4360
|
<div class="runner-question-title">
|
|
3911
|
-
${e.label}${e.required?
|
|
4361
|
+
${e.label}${e.required?l`<span class="runner-question-required">*</span>`:""}
|
|
3912
4362
|
</div>
|
|
3913
4363
|
<hr class="runner-question-divider" />
|
|
3914
4364
|
`}
|
|
3915
|
-
${
|
|
3916
|
-
${
|
|
4365
|
+
${n()}
|
|
4366
|
+
${r?l`<div class="error-message">${r}</div>`:""}
|
|
3917
4367
|
</div>
|
|
3918
4368
|
`}}/**
|
|
3919
4369
|
* @license
|
|
@@ -3923,74 +4373,74 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
3923
4373
|
* @license
|
|
3924
4374
|
* Copyright 2017 Google LLC
|
|
3925
4375
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
3926
|
-
*/class be extends $t{constructor(e){if(super(e),this.it=x,e.type!==St.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===x||e==null)return this._t=void 0,this.it=e;if(e===
|
|
4376
|
+
*/class be extends $t{constructor(e){if(super(e),this.it=x,e.type!==St.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===x||e==null)return this._t=void 0,this.it=e;if(e===P)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 Ne=kt(be);class ${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`
|
|
3927
4377
|
<div class="content-element text-content">
|
|
3928
4378
|
<p>${e.content}</p>
|
|
3929
4379
|
</div>
|
|
3930
|
-
`}static renderMarkdownElement(e){return
|
|
4380
|
+
`}static renderMarkdownElement(e){return l`
|
|
3931
4381
|
<div class="content-element markdown-content">
|
|
3932
4382
|
<div class="markdown-text">
|
|
3933
|
-
${
|
|
4383
|
+
${Ne($.renderMarkdown(e.content))}
|
|
3934
4384
|
</div>
|
|
3935
4385
|
</div>
|
|
3936
|
-
`}static renderDivider(e){return
|
|
4386
|
+
`}static renderDivider(e){return l`
|
|
3937
4387
|
<div class="content-element divider-content">
|
|
3938
4388
|
<hr class="content-divider" />
|
|
3939
|
-
${e.caption?
|
|
4389
|
+
${e.caption?l`<div class="divider-caption">${e.caption}</div>`:""}
|
|
3940
4390
|
</div>
|
|
3941
|
-
`}static renderHtml(e){return
|
|
4391
|
+
`}static renderHtml(e){return l`
|
|
3942
4392
|
<div class="content-element html-content">
|
|
3943
|
-
<div class="html-content-wrapper">${
|
|
4393
|
+
<div class="html-content-wrapper">${Ne(e.content)}</div>
|
|
3944
4394
|
</div>
|
|
3945
|
-
`}static renderImage(e){return
|
|
4395
|
+
`}static renderImage(e){return l`
|
|
3946
4396
|
<div class="content-element image-content">
|
|
3947
4397
|
<div class="image-placeholder">
|
|
3948
4398
|
<p>📷 Image: ${e.caption||e.alt||"Image content"}</p>
|
|
3949
4399
|
<small>URL: ${e.url||"No URL provided"}</small>
|
|
3950
4400
|
</div>
|
|
3951
4401
|
</div>
|
|
3952
|
-
`}static renderVideo(e){return
|
|
4402
|
+
`}static renderVideo(e){return l`
|
|
3953
4403
|
<div class="content-element video-content">
|
|
3954
4404
|
<div class="video-placeholder">
|
|
3955
4405
|
<p>🎥 Video: ${e.caption||"Video content"}</p>
|
|
3956
4406
|
<small>URL: ${e.url||"No URL provided"}</small>
|
|
3957
4407
|
</div>
|
|
3958
4408
|
</div>
|
|
3959
|
-
`}static renderFile(e){return
|
|
4409
|
+
`}static renderFile(e){return l`
|
|
3960
4410
|
<div class="content-element file-content">
|
|
3961
4411
|
<div class="file-placeholder">
|
|
3962
4412
|
<p>📄 File: ${e.caption||"File content"}</p>
|
|
3963
4413
|
<small>URL: ${e.url||"No URL provided"}</small>
|
|
3964
4414
|
</div>
|
|
3965
4415
|
</div>
|
|
3966
|
-
`}static renderUnknown(e){return
|
|
4416
|
+
`}static renderUnknown(e){return l`
|
|
3967
4417
|
<div class="content-element unknown-content">
|
|
3968
4418
|
<p>⚠️ Unknown content type: ${e.type}</p>
|
|
3969
4419
|
</div>
|
|
3970
|
-
`}static render(e,t){const i=()=>{switch(e.type){case"text":return $.renderText(e);case"markdown":return $.renderMarkdownElement(e);case"divider":return $.renderDivider(e);case"html":return $.renderHtml(e);case"image":return $.renderImage(e);case"video":return $.renderVideo(e);case"file":return $.renderFile(e);default:return $.renderUnknown(e)}};return(t==null?void 0:t.mode)==="print"?
|
|
4420
|
+
`}static render(e,t){const i=()=>{switch(e.type){case"text":return $.renderText(e);case"markdown":return $.renderMarkdownElement(e);case"divider":return $.renderDivider(e);case"html":return $.renderHtml(e);case"image":return $.renderImage(e);case"video":return $.renderVideo(e);case"file":return $.renderFile(e);default:return $.renderUnknown(e)}};return(t==null?void 0:t.mode)==="print"?l`
|
|
3971
4421
|
<div class="content-print">
|
|
3972
4422
|
${i()}
|
|
3973
|
-
${e.type!=="divider"?
|
|
4423
|
+
${e.type!=="divider"?l`<hr class="print-question-separator" />`:""}
|
|
3974
4424
|
</div>
|
|
3975
|
-
`:i()}}class
|
|
4425
|
+
`:i()}}class Le{static renderMobileStepsForStatus(e){const{steps:t,disabled:i=!1}=e;return l`
|
|
3976
4426
|
<div class="runner-mobile-steps">
|
|
3977
4427
|
<nav aria-label="Workflow steps">
|
|
3978
4428
|
<div class="runner-mobile-steps-container">
|
|
3979
|
-
${t==null?void 0:t.map(
|
|
4429
|
+
${t==null?void 0:t.map(r=>{const n=e.isStepAssignedToUser(r),o=e.completedSteps.has(r.id);return l`
|
|
3980
4430
|
<div
|
|
3981
|
-
class="runner-mobile-step-tab ${o?"completed":""} ${
|
|
3982
|
-
style="cursor: not-allowed; opacity: ${i?"0.6":
|
|
4431
|
+
class="runner-mobile-step-tab ${o?"completed":""} ${n?"":"unassigned"} ${i?"disabled":""}"
|
|
4432
|
+
style="cursor: not-allowed; opacity: ${i?"0.6":n?"1":"0.6"};"
|
|
3983
4433
|
>
|
|
3984
|
-
<span class="runner-mobile-step-title">${
|
|
4434
|
+
<span class="runner-mobile-step-title">${r.title}</span>
|
|
3985
4435
|
<span class="runner-mobile-step-badge">
|
|
3986
|
-
${o?"Completed":
|
|
4436
|
+
${o?"Completed":n?"Your Step":"Other User"}
|
|
3987
4437
|
</span>
|
|
3988
4438
|
</div>
|
|
3989
4439
|
`})}
|
|
3990
4440
|
</div>
|
|
3991
4441
|
</nav>
|
|
3992
4442
|
</div>
|
|
3993
|
-
`}static renderNotAssignedView(){return
|
|
4443
|
+
`}static renderNotAssignedView(){return l`
|
|
3994
4444
|
<div class="runner-content not-assigned-view">
|
|
3995
4445
|
<div class="not-assigned-container">
|
|
3996
4446
|
<div class="not-assigned-icon">
|
|
@@ -4013,7 +4463,7 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
4013
4463
|
</p>
|
|
4014
4464
|
</div>
|
|
4015
4465
|
</div>
|
|
4016
|
-
`}static renderUnifiedSubmissionView(e){var t,i,
|
|
4466
|
+
`}static renderUnifiedSubmissionView(e){var t,i,r;return l`
|
|
4017
4467
|
<div class="runner-layout">
|
|
4018
4468
|
<!-- Mobile Steps Navigation (visible only on mobile) -->
|
|
4019
4469
|
${this.renderMobileStepsForStatus({steps:(t=e.instance)==null?void 0:t.steps,isStepAssignedToUser:e.isStepAssignedToUser,completedSteps:e.completedSteps,disabled:!0})}
|
|
@@ -4023,12 +4473,12 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
4023
4473
|
<div class="runner-sidebar-header">Steps</div>
|
|
4024
4474
|
<nav aria-label="Workflow steps">
|
|
4025
4475
|
<ul class="runner-steps-list">
|
|
4026
|
-
${(
|
|
4476
|
+
${(r=(i=e.instance)==null?void 0:i.steps)==null?void 0:r.map(n=>{const o=e.isStepAssignedToUser(n),a=e.completedSteps.has(n.id);return l`
|
|
4027
4477
|
<li
|
|
4028
4478
|
class="runner-step-item ${a?"completed":""} ${o?"":"unassigned"}"
|
|
4029
4479
|
style="opacity: ${o?"1":"0.6"}; cursor: not-allowed;"
|
|
4030
4480
|
>
|
|
4031
|
-
<span class="runner-step-title">${
|
|
4481
|
+
<span class="runner-step-title">${n.title}</span>
|
|
4032
4482
|
<span class="runner-step-badge">
|
|
4033
4483
|
${a?"Submitted":o?"Your Step":"Other User"}
|
|
4034
4484
|
</span>
|
|
@@ -4062,59 +4512,59 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
4062
4512
|
</div>
|
|
4063
4513
|
</main>
|
|
4064
4514
|
</div>
|
|
4065
|
-
`}}class q{static isStepCompleted(e,t,i){return!!(t.completedSteps.has(e.id)||(t.isSubmitted||t.userStepsSubmitted)&&i)}static renderSidebar(e){const{steps:t}=e;return
|
|
4515
|
+
`}}class q{static isStepCompleted(e,t,i){return!!(t.completedSteps.has(e.id)||(t.isSubmitted||t.userStepsSubmitted)&&i)}static renderSidebar(e){const{steps:t}=e;return l`
|
|
4066
4516
|
<aside class="runner-sidebar">
|
|
4067
4517
|
<div class="runner-sidebar-header">Steps</div>
|
|
4068
4518
|
<nav aria-label="Workflow steps">
|
|
4069
4519
|
<ul class="runner-steps-list">
|
|
4070
|
-
${t==null?void 0:t.map((i,
|
|
4520
|
+
${t==null?void 0:t.map((i,r)=>{const n=e.mode==="preview"||e.mode==="admin"||e.mode==="view-only"||e.mode==="print"||e.isStepAssignedToUser(i),o=r===e.currentStepIndex,a=this.isStepCompleted(i,e,n),d=(e.isSubmitted||e.userStepsSubmitted)&&e.mode!=="preview"&&e.mode!=="admin"&&e.mode!=="view-only"&&e.mode!=="print",p=e.isLoading;return l`
|
|
4071
4521
|
<li
|
|
4072
|
-
class="runner-step-item ${o?"active":""} ${a?"completed":""} ${
|
|
4073
|
-
@click=${()=>!p&&e.goToStep(
|
|
4074
|
-
style="${
|
|
4522
|
+
class="runner-step-item ${o?"active":""} ${a?"completed":""} ${n?"":"unassigned"} ${d?"disabled":""} ${p?"loading-disabled":""}"
|
|
4523
|
+
@click=${()=>!p&&e.goToStep(r)}
|
|
4524
|
+
style="${d?"opacity: 0.5; cursor: not-allowed;":""}"
|
|
4075
4525
|
>
|
|
4076
4526
|
<span class="runner-step-title">${i.title}</span>
|
|
4077
4527
|
<span class="runner-step-badge">
|
|
4078
|
-
${e.mode==="preview"?"Preview":e.mode==="admin"?"Admin":e.mode==="view-only"?"View Only":e.mode==="print"?"Print":
|
|
4528
|
+
${e.mode==="preview"?"Preview":e.mode==="admin"?"Admin":e.mode==="view-only"?"View Only":e.mode==="print"?"Print":d?"Submitted":a?"Completed":n?"Assigned":"Not Assigned"}
|
|
4079
4529
|
</span>
|
|
4080
4530
|
</li>
|
|
4081
4531
|
`})}
|
|
4082
4532
|
</ul>
|
|
4083
4533
|
</nav>
|
|
4084
4534
|
</aside>
|
|
4085
|
-
`}static renderMobileSteps(e){const{steps:t}=e;return
|
|
4535
|
+
`}static renderMobileSteps(e){const{steps:t}=e;return l`
|
|
4086
4536
|
<div class="runner-mobile-steps">
|
|
4087
4537
|
<nav aria-label="Workflow steps">
|
|
4088
4538
|
<div class="runner-mobile-steps-container">
|
|
4089
|
-
${t==null?void 0:t.map((i,
|
|
4539
|
+
${t==null?void 0:t.map((i,r)=>{const n=e.mode==="preview"||e.mode==="admin"||e.mode==="view-only"||e.mode==="print"||e.isStepAssignedToUser(i),o=r===e.currentStepIndex,a=this.isStepCompleted(i,e,n),d=(e.isSubmitted||e.userStepsSubmitted)&&e.mode!=="preview"&&e.mode!=="admin"&&e.mode!=="view-only"&&e.mode!=="print",p=e.isLoading;return l`
|
|
4090
4540
|
<button
|
|
4091
|
-
class="runner-mobile-step-tab ${o?"active":""} ${a?"completed":""} ${
|
|
4092
|
-
@click=${()=>!p&&e.goToStep(
|
|
4093
|
-
?disabled=${
|
|
4541
|
+
class="runner-mobile-step-tab ${o?"active":""} ${a?"completed":""} ${n?"":"unassigned"} ${d?"disabled":""} ${p?"loading-disabled":""}"
|
|
4542
|
+
@click=${()=>!p&&e.goToStep(r)}
|
|
4543
|
+
?disabled=${d||p}
|
|
4094
4544
|
aria-current=${o?"step":"false"}
|
|
4095
4545
|
>
|
|
4096
4546
|
<span class="runner-mobile-step-title">${i.title}</span>
|
|
4097
4547
|
<span class="runner-mobile-step-badge">
|
|
4098
|
-
${e.mode==="preview"?"Preview":e.mode==="admin"?"Admin":e.mode==="view-only"?"View Only":e.mode==="print"?"Print":
|
|
4548
|
+
${e.mode==="preview"?"Preview":e.mode==="admin"?"Admin":e.mode==="view-only"?"View Only":e.mode==="print"?"Print":d?"Submitted":a?"Completed":n?"Assigned":"Not Assigned"}
|
|
4099
4549
|
</span>
|
|
4100
4550
|
</button>
|
|
4101
4551
|
`})}
|
|
4102
4552
|
</div>
|
|
4103
4553
|
</nav>
|
|
4104
4554
|
</div>
|
|
4105
|
-
`}static renderStepHeader(e){const{step:t,mode:i}=e;return i==="print"?
|
|
4555
|
+
`}static renderStepHeader(e){const{step:t,mode:i}=e;return i==="print"?l`
|
|
4106
4556
|
<div class="step-print-header">
|
|
4107
4557
|
<div class="print-step-title">${t.title}</div>
|
|
4108
|
-
${t.description?
|
|
4558
|
+
${t.description?l`<div class="print-step-description">${t.description}</div>`:""}
|
|
4109
4559
|
<hr class="print-question-separator" />
|
|
4110
4560
|
</div>
|
|
4111
|
-
`:
|
|
4561
|
+
`:l`
|
|
4112
4562
|
<section class="runner-step-header">
|
|
4113
4563
|
<h2 class="runner-step-title">${t.title}</h2>
|
|
4114
4564
|
<hr class="runner-step-divider" />
|
|
4115
|
-
${t.description?
|
|
4565
|
+
${t.description?l`<p class="runner-step-desc">${t.description}</p>`:""}
|
|
4116
4566
|
</section>
|
|
4117
|
-
`}}class Dt{static renderFormActions(e){return e.mode==="preview"||e.mode==="view-only"||e.mode==="print"||!e.isCurrentStepAssigned?
|
|
4567
|
+
`}}class Dt{static renderFormActions(e){return e.mode==="preview"||e.mode==="view-only"||e.mode==="print"||!e.isCurrentStepAssigned?l``:l`
|
|
4118
4568
|
<div class="runner-form-actions">
|
|
4119
4569
|
<button
|
|
4120
4570
|
class="next-button ${e.mode==="admin"&&e.justSaved?"saved-state":""}"
|
|
@@ -4124,13 +4574,13 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
4124
4574
|
${e.mode==="admin"?e.justSaved?"✓ Saved!":"Save":e.isLastStep?"Submit":"Next"}
|
|
4125
4575
|
</button>
|
|
4126
4576
|
</div>
|
|
4127
|
-
`}}class ve{static handleInputChange(e,t,i,n,r,o){const a=t.target;let l;a.type==="radio"?l=a.value:a.type==="checkbox"?l=a.checked:l=a.value;const p={...i,[e]:l};n(p),o!=="preview"&&r(e,l)}static handleCheckboxChange(e,t,i,n,r,o){const l=t.target.checked,p={...i,[e]:l};n(p),o!=="preview"&&r(e,l)}static handleCheckboxGroupChange(e,t,i,n,r,o,a){const l=i.target,p=n[e];let c=Array.isArray(p)?[...p]:[];l.checked?c.includes(t)||c.push(t):c=c.filter(h=>h!==t);const u={...n,[e]:c};r(u),a!=="preview"&&o(e,c)}}var Ct=Object.defineProperty,Et=Object.getOwnPropertyDescriptor,_=(s,e,t,i)=>{for(var n=i>1?void 0:i?Et(e,t):e,r=s.length-1,o;r>=0;r--)(o=s[r])&&(n=(i?o(e,t,n):o(n))||n);return i&&n&&Ct(e,t,n),n};let f=class extends H{constructor(){super(...arguments),this.mode="default",this.isLoading=!1,this._currentStepIndex=0,this._formData={},this._validationErrors={},this._internalCompletedSteps=new Set,this._formRestorationComplete=!1,this._savedSignatures=new Set,this._replacingSignatures=new Set,this._isSubmitted=!1,this._userStepsSubmitted=!1,this._justSaved=!1}willUpdate(s){(s.has("mode")||s.has("currentUser"))&&this._updateNavigationService(),(s.has("instance")||s.has("workflow")||s.has("mode"))&&(this._initializeState(),this._updateValidationService())}connectedCallback(){super.connectedCallback(),this._initializeServices(),this._initializeState(),window.addEventListener("resize",this._handleResize.bind(this)),this._restoreFormData()}disconnectedCallback(){var s;super.disconnectedCallback(),window.removeEventListener("resize",this._handleResize.bind(this)),(s=this.signatureManager)==null||s.destroy()}_initializeServices(){this.persistenceManager=new bt,this.responseTracker=new yt,this.formStateManager=new me,this.signatureManager=new _t(s=>this._handleSignatureChange(s)),this.fileUploadManager=new fe(this.formStateManager,this.responseTracker),this._updateNavigationService(),this._updateValidationService()}_updateNavigationService(){this.navigationService=new wt(this.mode||"default",this.currentUser)}_updateValidationService(){var s;this.validationService=new ft(((s=this.signatureManager)==null?void 0:s.getAllSignaturePads())||new Map,this._savedSignatures)}_getRenderContext(){return{formData:this._formData,validationErrors:this._validationErrors,currentStepIndex:this._currentStepIndex,internalCompletedSteps:this._internalCompletedSteps,savedSignatures:this._savedSignatures,replacingSignatures:this._replacingSignatures,isSubmitted:this._isSubmitted,userStepsSubmitted:this._userStepsSubmitted,justSaved:this._justSaved,validationService:this.validationService,persistenceManager:this.persistenceManager,signatureManager:this.signatureManager,responseTracker:this.responseTracker,navigationService:this.navigationService,formStateManager:this.formStateManager,fileUploadManager:this.fileUploadManager,mode:this.mode||"default",instance:this.instance,workflow:this.workflow,currentUser:this.currentUser,isLoading:this.isLoading,handlers:{handleInputChange:this._handleInputChange.bind(this),handleCheckboxChange:this._handleCheckboxChange.bind(this),handleCheckboxGroupChange:this._handleCheckboxGroupChange.bind(this),startReplaceSignature:this._startReplaceSignature.bind(this),cancelReplaceSignature:this._cancelReplaceSignature.bind(this),clearSignature:this._clearSignature.bind(this),saveSignature:this._saveSignature.bind(this),handleFileUpload:this._handleFileUpload.bind(this),trackQuestionResponse:this._trackQuestionResponse.bind(this),isCurrentStepAssigned:this._isCurrentStepAssigned.bind(this)}}}_handleSignatureChange(s){this.formStateManager.setFormField(s.questionId,s.hasSignature),this.formStateManager.setFormField(`${s.questionId}_signatureData`,s.signatureData),this._formData=this.formStateManager.getFormData(),this._savedSignatures.has(s.questionId)&&(this._savedSignatures=new Set([...this._savedSignatures].filter(e=>e!==s.questionId))),this._clearValidationError(s.questionId),this.mode!=="admin"&&this._saveFormDataToHistory()}_clearValidationError(s){this.formStateManager.clearValidationError(s),this._validationErrors=this.formStateManager.getValidationErrors()}_updateFormData(s){this.formStateManager.updateFormData(s),this._formData=this.formStateManager.getFormData(),this.mode!=="admin"&&this._saveFormDataToHistory()}_handleFormDataUpdate(s){this._clearValidationError(s)}_initializeState(){var s,e,t;if((s=this.formStateManager)==null||s.reset(),this._validationErrors={},this._formData={},this._formRestorationComplete=!1,this._savedSignatures=new Set,this._replacingSignatures=new Set,this._savedInstance=void 0,this._justSaved=!1,this._isSubmitted=((e=this.instance)==null?void 0:e.status)==="completed"||!1,this.instance&&this.instance.status!=="completed"){const i=this._getAssignedSteps(),n=i.filter(r=>{var o;return(o=this.instance.completedSteps)==null?void 0:o.includes(r.id)});this._userStepsSubmitted=i.length>0&&n.length===i.length}else this._userStepsSubmitted=((t=this.instance)==null?void 0:t.status)==="completed"||!1;this.mode==="preview"&&this.workflow?this._initializePreviewMode():this.mode==="view-only"&&this.instance?this._initializeViewOnlyMode():this.mode==="print"&&this.instance?this._initializePrintMode():this.instance&&this._initializeDefaultMode()}_initializePreviewMode(){var s;if(console.log("Initializing preview mode..."),!((s=this.workflow)!=null&&s.steps)||this.workflow.steps.length===0){console.warn("Workflow has no steps in preview mode.");return}this.formStateManager.reset(),this._formData=this.formStateManager.getFormData(),this._currentStepIndex=0,this._internalCompletedSteps=new Set,console.log("Preview mode initialized with empty form data.")}_initializeDefaultMode(){var s;!((s=this.instance)!=null&&s.steps)||this.instance.steps.length===0||(this.instance.completedSteps?this._internalCompletedSteps=new Set(this.instance.completedSteps):this._internalCompletedSteps=new Set(this.instance.steps.filter(e=>e.status==="completed").map(e=>e.id)),this.formStateManager.initializeFromResponses(this.instance.steps),this._formData=this.formStateManager.getFormData(),this._currentStepIndex=this.instance.steps.findIndex(e=>{var t;return e.id===((t=this.instance)==null?void 0:t.currentStepId)}),this._currentStepIndex<0&&(this._currentStepIndex=0),this.instance.steps.forEach((e,t)=>{this._internalCompletedSteps.has(e.id)?e.status="completed":t===this._currentStepIndex?e.status="active":e.status="pending"}))}_initializeViewOnlyMode(){var s;!((s=this.instance)!=null&&s.steps)||this.instance.steps.length===0||(this.formStateManager.initializeFromResponses(this.instance.steps),this._formData=this.formStateManager.getFormData(),this._currentStepIndex=0,this.instance.steps.forEach(e=>{e.responses&&e.responses.length>0?(e.status="completed",this._internalCompletedSteps.add(e.id)):e.status="pending"}),console.log("View-only mode initialized with existing responses:",this._formData))}_initializePrintMode(){var s;!((s=this.instance)!=null&&s.steps)||this.instance.steps.length===0||(this.formStateManager.initializeFromResponses(this.instance.steps),this._formData=this.formStateManager.getFormData(),this._currentStepIndex=0,this.instance.steps.forEach(e=>{e.responses&&e.responses.length>0?(e.status="completed",this._internalCompletedSteps.add(e.id)):e.status="pending"}),console.log("Print mode initialized with existing responses:",this._formData))}_isStepAssignedToUser(s){return this.navigationService.isStepAssignedToUser(s)}_getAssignedSteps(){return this.instance?this.navigationService.getAssignedSteps(this.instance):[]}_isCurrentStepAssigned(){const s=this._currentStep;return!s||this.mode!=="default"?!0:this._isStepAssignedToUser(s)}_renderNotAssignedView(){return Ne.renderNotAssignedView()}get _currentStep(){var s,e,t;return this.mode==="preview"&&this.workflow?(s=this.workflow.steps)==null?void 0:s[this._currentStepIndex]:(t=(e=this.instance)==null?void 0:e.steps)==null?void 0:t[this._currentStepIndex]}_validateStep(){const s=this._currentStep;if(!s)return!1;const e=this.validationService.validateStep(s,this._formData,this.mode||"default");return this.formStateManager.setValidationErrors(e.errors),this._validationErrors=this.formStateManager.getValidationErrors(),e.isValid}_handleInputChange(s,e){ve.handleInputChange(s,e,this._formData,this._updateFormData.bind(this),this._trackQuestionResponse.bind(this),this.mode),this._handleFormDataUpdate(s)}_handleCheckboxChange(s,e){ve.handleCheckboxChange(s,e,this._formData,this._updateFormData.bind(this),this._trackQuestionResponse.bind(this),this.mode),this._handleFormDataUpdate(s)}_handleCheckboxGroupChange(s,e,t){ve.handleCheckboxGroupChange(s,e,t,this._formData,this._updateFormData.bind(this),this._trackQuestionResponse.bind(this),this.mode),this._handleFormDataUpdate(s)}_initializeSignaturePad(s){this.signatureManager.initializeSignaturePad(s,this.shadowRoot)&&this._updateValidationService()}_handleResize(){this.signatureManager.handleResize()}_clearSignature(s){this.signatureManager.clearSignature(s)}_startReplaceSignature(s){this._replacingSignatures=new Set([...this._replacingSignatures,s]),this.formStateManager.setFormField(s,!1),this.formStateManager.setFormField(`${s}_signatureData`,null),this._formData=this.formStateManager.getFormData(),this._savedSignatures=new Set([...this._savedSignatures].filter(e=>e!==s)),this.requestUpdate()}_cancelReplaceSignature(s){this._replacingSignatures=new Set([...this._replacingSignatures].filter(e=>e!==s))}_saveSignature(s){var i,n,r;const e=this.signatureManager.saveSignature(s);if(!e)return;const t=this._hasSignatureChanged(s,e.svgData);this._savedSignatures=new Set([...this._savedSignatures,s]),this._replacingSignatures.has(s)&&(this._replacingSignatures=new Set([...this._replacingSignatures].filter(o=>o!==s))),this._trackQuestionResponse(s,e.svgData),t&&this.mode!=="preview"?(console.log("Signature changed, calling callback for:",s),console.log("Callback function exists:",!!this.onSignatureCaptured),(r=this.onSignatureCaptured)==null||r.call(this,{instanceId:(i=this.instance)==null?void 0:i.id,stepId:(n=this._currentStep)==null?void 0:n.id,questionId:s,svgData:e.svgData,dataURL:e.dataURL})):this.mode==="preview"?console.log("Preview mode: skipping signature callback for:",s):console.log("Signature unchanged, skipping callback for:",s),this._clearValidationError(s),this.mode!=="admin"&&this._saveFormDataToHistory()}_hasSignatureChanged(s,e){return this.responseTracker.hasChangedFromPrevious(s,e,this._savedInstance)}_restoreInstanceResponses(){var s,e;!((s=this._savedInstance)!=null&&s.steps)||!((e=this.instance)!=null&&e.steps)||this._savedInstance.steps.forEach((t,i)=>{var n;(n=this.instance)!=null&&n.steps&&this.instance.steps[i]&&(this.instance.steps[i].responses=t.responses||[])})}_handleFileUpload(s,e){this.fileUploadManager.handleFileUpload(s,e,{instance:this.instance,currentStep:this._currentStep,mode:this.mode||"default",savedInstance:this._savedInstance,onFileUploaded:this.onFileUploaded,onFormDataSave:()=>this._saveFormDataToHistory(),onRequestUpdate:()=>{this._formData=this.formStateManager.getFormData(),this._validationErrors=this.formStateManager.getValidationErrors();const t=this._formData[s];t&&this._trackQuestionResponse(s,t),this.requestUpdate()}})}_captureSignaturesFromStep(s){console.log("Capturing signatures from step:",s.id)}_trackQuestionResponse(s,e){this.responseTracker.trackQuestionResponse(this._currentStep,s,e)}_renderQuestion(s){return k.render(s,this._getRenderContext())}_renderContentElement(s){return $.render(s,this._getRenderContext())}_isQuestionElement(s){return f.QUESTION_ELEMENT_TYPES.includes(s.type)}_isContentElement(s){return f.CONTENT_ELEMENT_TYPES.includes(s.type)}_renderStepElement(s){return this.mode==="print"?this._isQuestionElement(s)?this._renderQuestion(s):this._isContentElement(s)?this._renderContentElement(s):d`<div class="unknown-element">
|
|
4577
|
+
`}}class ve{static handleInputChange(e,t,i,r,n,o){const a=t.target;let d;a.type==="radio"?d=a.value:a.type==="checkbox"?d=a.checked:d=a.value;const p={...i,[e]:d};r(p),o!=="preview"&&n(e,d)}static handleCheckboxChange(e,t,i,r,n,o){const d=t.target.checked,p={...i,[e]:d};r(p),o!=="preview"&&n(e,d)}static handleCheckboxGroupChange(e,t,i,r,n,o,a){const d=i.target,p=r[e];let c=Array.isArray(p)?[...p]:[];d.checked?c.includes(t)||c.push(t):c=c.filter(h=>h!==t);const u={...r,[e]:c};n(u),a!=="preview"&&o(e,c)}}var Ct=Object.defineProperty,At=Object.getOwnPropertyDescriptor,y=(s,e,t,i)=>{for(var r=i>1?void 0:i?At(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&Ct(e,t,r),r};let b=class extends H{constructor(){super(...arguments),this.mode="default",this.isLoading=!1,this._currentStepIndex=0,this._formData={},this._validationErrors={},this._internalCompletedSteps=new Set,this._formRestorationComplete=!1,this._savedSignatures=new Set,this._replacingSignatures=new Set,this._isSubmitted=!1,this._userStepsSubmitted=!1,this._justSaved=!1}willUpdate(s){(s.has("mode")||s.has("currentUser"))&&this._updateNavigationService(),(s.has("instance")||s.has("workflow")||s.has("mode"))&&(this._initializeState(),this._updateValidationService())}connectedCallback(){super.connectedCallback(),this._initializeServices(),this._initializeState(),window.addEventListener("resize",this._handleResize.bind(this)),this._restoreFormData()}disconnectedCallback(){var s;super.disconnectedCallback(),window.removeEventListener("resize",this._handleResize.bind(this)),(s=this.signatureManager)==null||s.destroy()}_initializeServices(){this.persistenceManager=new bt,this.responseTracker=new yt,this.formStateManager=new me,this.signatureManager=new _t(s=>this._handleSignatureChange(s)),this.fileUploadManager=new fe(this.formStateManager,this.responseTracker),this._updateNavigationService(),this._updateValidationService()}_updateNavigationService(){this.navigationService=new wt(this.mode||"default",this.currentUser)}_updateValidationService(){var s;this.validationService=new ft(((s=this.signatureManager)==null?void 0:s.getAllSignaturePads())||new Map,this._savedSignatures)}_getRenderContext(){return{formData:this._formData,validationErrors:this._validationErrors,currentStepIndex:this._currentStepIndex,internalCompletedSteps:this._internalCompletedSteps,savedSignatures:this._savedSignatures,replacingSignatures:this._replacingSignatures,isSubmitted:this._isSubmitted,userStepsSubmitted:this._userStepsSubmitted,justSaved:this._justSaved,validationService:this.validationService,persistenceManager:this.persistenceManager,signatureManager:this.signatureManager,responseTracker:this.responseTracker,navigationService:this.navigationService,formStateManager:this.formStateManager,fileUploadManager:this.fileUploadManager,mode:this.mode||"default",instance:this.instance,workflow:this.workflow,currentUser:this.currentUser,isLoading:this.isLoading,handlers:{handleInputChange:this._handleInputChange.bind(this),handleCheckboxChange:this._handleCheckboxChange.bind(this),handleCheckboxGroupChange:this._handleCheckboxGroupChange.bind(this),startReplaceSignature:this._startReplaceSignature.bind(this),cancelReplaceSignature:this._cancelReplaceSignature.bind(this),clearSignature:this._clearSignature.bind(this),saveSignature:this._saveSignature.bind(this),handleFileUpload:this._handleFileUpload.bind(this),trackQuestionResponse:this._trackQuestionResponse.bind(this),isCurrentStepAssigned:this._isCurrentStepAssigned.bind(this)}}}_handleSignatureChange(s){this.formStateManager.setFormField(s.questionId,s.hasSignature),this.formStateManager.setFormField(`${s.questionId}_signatureData`,s.signatureData),this._formData=this.formStateManager.getFormData(),this._savedSignatures.has(s.questionId)&&(this._savedSignatures=new Set([...this._savedSignatures].filter(e=>e!==s.questionId))),this._clearValidationError(s.questionId),this.mode!=="admin"&&this._saveFormDataToHistory()}_clearValidationError(s){this.formStateManager.clearValidationError(s),this._validationErrors=this.formStateManager.getValidationErrors()}_updateFormData(s){this.formStateManager.updateFormData(s),this._formData=this.formStateManager.getFormData(),this.mode!=="admin"&&this._saveFormDataToHistory()}_handleFormDataUpdate(s){this._clearValidationError(s)}_initializeState(){var s,e,t;if((s=this.formStateManager)==null||s.reset(),this._validationErrors={},this._formData={},this._formRestorationComplete=!1,this._savedSignatures=new Set,this._replacingSignatures=new Set,this._savedInstance=void 0,this._justSaved=!1,this._isSubmitted=((e=this.instance)==null?void 0:e.status)==="completed"||!1,this.instance&&this.instance.status!=="completed"){const i=this._getAssignedSteps(),r=i.filter(n=>{var o;return(o=this.instance.completedSteps)==null?void 0:o.includes(n.id)});this._userStepsSubmitted=i.length>0&&r.length===i.length}else this._userStepsSubmitted=((t=this.instance)==null?void 0:t.status)==="completed"||!1;this.mode==="preview"&&this.workflow?this._initializePreviewMode():this.mode==="view-only"&&this.instance?this._initializeViewOnlyMode():this.mode==="print"&&this.instance?this._initializePrintMode():this.instance&&this._initializeDefaultMode()}_initializePreviewMode(){var s;if(console.log("Initializing preview mode..."),!((s=this.workflow)!=null&&s.steps)||this.workflow.steps.length===0){console.warn("Workflow has no steps in preview mode.");return}this.formStateManager.reset(),this._formData=this.formStateManager.getFormData(),this._currentStepIndex=0,this._internalCompletedSteps=new Set,console.log("Preview mode initialized with empty form data.")}_initializeDefaultMode(){var s;!((s=this.instance)!=null&&s.steps)||this.instance.steps.length===0||(this.instance.completedSteps?this._internalCompletedSteps=new Set(this.instance.completedSteps):this._internalCompletedSteps=new Set(this.instance.steps.filter(e=>e.status==="completed").map(e=>e.id)),this.formStateManager.initializeFromResponses(this.instance.steps),this._formData=this.formStateManager.getFormData(),this._currentStepIndex=this.instance.steps.findIndex(e=>{var t;return e.id===((t=this.instance)==null?void 0:t.currentStepId)}),this._currentStepIndex<0&&(this._currentStepIndex=0),this.instance.steps.forEach((e,t)=>{this._internalCompletedSteps.has(e.id)?e.status="completed":t===this._currentStepIndex?e.status="active":e.status="pending"}))}_initializeViewOnlyMode(){var s;!((s=this.instance)!=null&&s.steps)||this.instance.steps.length===0||(this.formStateManager.initializeFromResponses(this.instance.steps),this._formData=this.formStateManager.getFormData(),this._currentStepIndex=0,this.instance.steps.forEach(e=>{e.responses&&e.responses.length>0?(e.status="completed",this._internalCompletedSteps.add(e.id)):e.status="pending"}),console.log("View-only mode initialized with existing responses:",this._formData))}_initializePrintMode(){var s;!((s=this.instance)!=null&&s.steps)||this.instance.steps.length===0||(this.formStateManager.initializeFromResponses(this.instance.steps),this._formData=this.formStateManager.getFormData(),this._currentStepIndex=0,this.instance.steps.forEach(e=>{e.responses&&e.responses.length>0?(e.status="completed",this._internalCompletedSteps.add(e.id)):e.status="pending"}),console.log("Print mode initialized with existing responses:",this._formData))}_isStepAssignedToUser(s){return this.navigationService.isStepAssignedToUser(s)}_getAssignedSteps(){return this.instance?this.navigationService.getAssignedSteps(this.instance):[]}_isCurrentStepAssigned(){const s=this._currentStep;return!s||this.mode!=="default"?!0:this._isStepAssignedToUser(s)}_renderNotAssignedView(){return Le.renderNotAssignedView()}get _currentStep(){var s,e,t;return this.mode==="preview"&&this.workflow?(s=this.workflow.steps)==null?void 0:s[this._currentStepIndex]:(t=(e=this.instance)==null?void 0:e.steps)==null?void 0:t[this._currentStepIndex]}_validateStep(){const s=this._currentStep;if(!s)return!1;const e=this.validationService.validateStep(s,this._formData,this.mode||"default");return this.formStateManager.setValidationErrors(e.errors),this._validationErrors=this.formStateManager.getValidationErrors(),e.isValid}_handleInputChange(s,e){ve.handleInputChange(s,e,this._formData,this._updateFormData.bind(this),this._trackQuestionResponse.bind(this),this.mode),this._handleFormDataUpdate(s)}_handleCheckboxChange(s,e){ve.handleCheckboxChange(s,e,this._formData,this._updateFormData.bind(this),this._trackQuestionResponse.bind(this),this.mode),this._handleFormDataUpdate(s)}_handleCheckboxGroupChange(s,e,t){ve.handleCheckboxGroupChange(s,e,t,this._formData,this._updateFormData.bind(this),this._trackQuestionResponse.bind(this),this.mode),this._handleFormDataUpdate(s)}_initializeSignaturePad(s){this.signatureManager.initializeSignaturePad(s,this.shadowRoot)&&this._updateValidationService()}_handleResize(){this.signatureManager.handleResize()}_clearSignature(s){this.signatureManager.clearSignature(s)}_startReplaceSignature(s){this._replacingSignatures=new Set([...this._replacingSignatures,s]),this.formStateManager.setFormField(s,!1),this.formStateManager.setFormField(`${s}_signatureData`,null),this._formData=this.formStateManager.getFormData(),this._savedSignatures=new Set([...this._savedSignatures].filter(e=>e!==s)),this.requestUpdate()}_cancelReplaceSignature(s){this._replacingSignatures=new Set([...this._replacingSignatures].filter(e=>e!==s))}_saveSignature(s){var i,r,n;const e=this.signatureManager.saveSignature(s);if(!e)return;const t=this._hasSignatureChanged(s,e.svgData);this._savedSignatures=new Set([...this._savedSignatures,s]),this._replacingSignatures.has(s)&&(this._replacingSignatures=new Set([...this._replacingSignatures].filter(o=>o!==s))),this._trackQuestionResponse(s,e.svgData),t&&this.mode!=="preview"?(console.log("Signature changed, calling callback for:",s),console.log("Callback function exists:",!!this.onSignatureCaptured),(n=this.onSignatureCaptured)==null||n.call(this,{instanceId:(i=this.instance)==null?void 0:i.id,stepId:(r=this._currentStep)==null?void 0:r.id,questionId:s,svgData:e.svgData,dataURL:e.dataURL})):this.mode==="preview"?console.log("Preview mode: skipping signature callback for:",s):console.log("Signature unchanged, skipping callback for:",s),this._clearValidationError(s),this.mode!=="admin"&&this._saveFormDataToHistory()}_hasSignatureChanged(s,e){return this.responseTracker.hasChangedFromPrevious(s,e,this._savedInstance)}_restoreInstanceResponses(){var s,e;!((s=this._savedInstance)!=null&&s.steps)||!((e=this.instance)!=null&&e.steps)||this._savedInstance.steps.forEach((t,i)=>{var r;(r=this.instance)!=null&&r.steps&&this.instance.steps[i]&&(this.instance.steps[i].responses=t.responses||[])})}_handleFileUpload(s,e){this.fileUploadManager.handleFileUpload(s,e,{instance:this.instance,currentStep:this._currentStep,mode:this.mode||"default",savedInstance:this._savedInstance,onFileUploaded:this.onFileUploaded,onFormDataSave:()=>this._saveFormDataToHistory(),onRequestUpdate:()=>{this._formData=this.formStateManager.getFormData(),this._validationErrors=this.formStateManager.getValidationErrors();const t=this._formData[s];t&&this._trackQuestionResponse(s,t),this.requestUpdate()}})}_captureSignaturesFromStep(s){console.log("Capturing signatures from step:",s.id)}_trackQuestionResponse(s,e){this.responseTracker.trackQuestionResponse(this._currentStep,s,e)}_renderQuestion(s){return k.render(s,this._getRenderContext())}_renderContentElement(s){return $.render(s,this._getRenderContext())}_isQuestionElement(s){return b.QUESTION_ELEMENT_TYPES.includes(s.type)}_isContentElement(s){return b.CONTENT_ELEMENT_TYPES.includes(s.type)}_renderStepElement(s){return this.mode==="print"?this._isQuestionElement(s)?this._renderQuestion(s):this._isContentElement(s)?this._renderContentElement(s):l`<div class="unknown-element">
|
|
4128
4578
|
<p>⚠️ Unknown element type: ${s.type}</p>
|
|
4129
|
-
</div>`:this._isQuestionElement(s)?
|
|
4579
|
+
</div>`:this._isQuestionElement(s)?l`<div class="runner-card">${this._renderQuestion(s)}</div>`:this._isContentElement(s)?l`<div class="runner-card">${this._renderContentElement(s)}</div>`:l`<div class="runner-card">
|
|
4130
4580
|
<div class="unknown-element">
|
|
4131
4581
|
<p>⚠️ Unknown element type: ${s.type}</p>
|
|
4132
4582
|
</div>
|
|
4133
|
-
</div>`}_renderStepWithElements(s){return
|
|
4583
|
+
</div>`}_renderStepWithElements(s){return l`
|
|
4134
4584
|
<div class="print-step">
|
|
4135
4585
|
<!-- Step Header -->
|
|
4136
4586
|
${q.renderStepHeader({step:s,mode:"print"})}
|
|
@@ -4138,9 +4588,9 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
4138
4588
|
<!-- Step Elements -->
|
|
4139
4589
|
${s.elements.map(e=>this._renderStepElement(e))}
|
|
4140
4590
|
</div>
|
|
4141
|
-
`}_renderAllStepsForPrint(){var s;return!((s=this.instance)!=null&&s.steps)||this.instance.steps.length===0?
|
|
4591
|
+
`}_renderAllStepsForPrint(){var s;return!((s=this.instance)!=null&&s.steps)||this.instance.steps.length===0?l`<div class="runner-content">
|
|
4142
4592
|
No workflow instance loaded or instance has no steps.
|
|
4143
|
-
</div>`:
|
|
4593
|
+
</div>`:l`
|
|
4144
4594
|
<div class="print-layout">
|
|
4145
4595
|
<!-- Instance Title at top -->
|
|
4146
4596
|
<div class="print-instance-title">${this.instance.name||"Untitled Form"}</div>
|
|
@@ -4148,9 +4598,9 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
4148
4598
|
|
|
4149
4599
|
${this.instance.steps.map(e=>this._renderStepWithElements(e))}
|
|
4150
4600
|
</div>
|
|
4151
|
-
`}_nextStep(){var t,i,n,r;if(!this._validateStep())return;const s=this._currentStep;s&&this._captureSignaturesFromStep(s);const e=this._findNextAssignedStep(this._currentStepIndex);if(e!==-1){const o=(t=this._currentStep)==null?void 0:t.id;if(this._currentStepIndex=e,o&&((i=this.instance)!=null&&i.steps)){const l=this.instance.steps.find(p=>p.id===o);l&&(l.status="completed")}const a=(r=(n=this.instance)==null?void 0:n.steps)==null?void 0:r[this._currentStepIndex];a&&(a.status="active"),this._updateInstanceData(o,"step_navigation",{direction:"next",fromStepIndex:this._currentStepIndex-1,toStepIndex:this._currentStepIndex,completedStepId:o}),this.mode!=="admin"&&this._saveFormDataToHistory(),this._scrollToTop()}}_findNextAssignedStep(s){return this.instance?this.navigationService.findNextAssignedStep(s,this.instance):-1}_isLastAssignedStep(){return this.navigationService.isLastAssignedStep(this._currentStepIndex,this.instance)}_isLastStepInWorkflow(){var e;const s=(e=this.instance)==null?void 0:e.steps;return s?this._currentStepIndex===s.length-1:!1}_goToStep(s){var i;console.log(`🎯 _goToStep called: stepIndex=${s}, mode=${this.mode}, currentStep=${this._currentStepIndex}`);const e=this.mode==="preview"?this.workflow:this.instance;if(console.log("📊 Data source:",e?`${((i=e.steps)==null?void 0:i.length)||0} steps`:"null"),!e){console.log("❌ No data source available");return}const t=this.navigationService.canNavigateToStep(s,this._currentStepIndex,e,this._internalCompletedSteps,this._isSubmitted,this._userStepsSubmitted);console.log("🚦 Navigation result:",t),t.canNavigate?(this._currentStepIndex=t.newStepIndex,console.log(`✅ Navigated to step ${t.newStepIndex}`),this._scrollToTop()):console.log("❌ Navigation blocked:",t.reason)}_submitUserSteps(){var t;if(!this._validateStep())return;const s=this._currentStep;if(s&&this._captureSignaturesFromStep(s),!this.instance){console.error("Cannot submit, instance data is missing.");return}const e=(t=this._currentStep)==null?void 0:t.id;e&&this._internalCompletedSteps.add(e),console.log("User completing their assigned steps:",this.instance.id),console.log("Form data:",this._formData),this._userStepsSubmitted=!0,this._clearSavedFormData("user steps submission"),this._updateInstanceData(e,"user_steps_submission"),this._scrollToTop()}_submit(){var t;if(!this._validateStep())return;const s=this._currentStep;if(s&&this._captureSignaturesFromStep(s),!this.instance){console.error("Cannot submit, instance data is missing.");return}const e=(t=this._currentStep)==null?void 0:t.id;e&&this._internalCompletedSteps.add(e),console.log("Submitting entire workflow:",this.instance.id),console.log("Final form data:",this._formData),this.instance&&(this.instance.status="completed",this.instance.currentStepId=void 0,this.instance.completedSteps=Array.from(this._internalCompletedSteps)),this._isSubmitted=!0,this._clearSavedFormData("full workflow submission"),this._scrollToTop(),this._updateInstanceData(e,"submission")}_saveStep(){var t;if(!this._validateStep())return;const s=this._currentStep;if(s&&this._captureSignaturesFromStep(s),!this.instance){console.error("Cannot save, instance data is missing.");return}const e=(t=this._currentStep)==null?void 0:t.id;if(e&&(this._internalCompletedSteps.add(e),this.instance.steps)){const i=this.instance.steps.find(n=>n.id===e);i&&(i.status="completed")}this._updateInstanceData(e,"admin_save",{stepId:e,adminMode:!0}),this._justSaved=!0,this.requestUpdate(),setTimeout(()=>{this._justSaved=!1,this.requestUpdate()},2e3)}_clearSavedFormData(s){var e;this.persistenceManager.clearFormData((e=this.instance)==null?void 0:e.id,s)}_scrollToTop(){requestAnimationFrame(()=>{var t,i;this.scrollIntoView({behavior:"smooth",block:"start"});const s=(t=this.shadowRoot)==null?void 0:t.querySelector(".runner-layout");s&&s.scrollTo({top:0,behavior:"smooth"});const e=(i=this.shadowRoot)==null?void 0:i.querySelector(".runner-main-content");e&&e.scrollTo({top:0,behavior:"smooth"})})}_updateInstanceData(s,e,t){var l,p,c,u,h,m,v;s&&this._internalCompletedSteps.add(s);let i=(p=(l=this.instance)==null?void 0:l.steps)==null?void 0:p.find(D=>D.id===s);if(!i&&this._internalCompletedSteps.size>0){const D=Array.from(this._internalCompletedSteps),se=D[D.length-1];i=(u=(c=this.instance)==null?void 0:c.steps)==null?void 0:u.find(ne=>ne.id===se)}const n=e==="submission",r=((h=this.instance)==null?void 0:h.steps)&&this._internalCompletedSteps.size>=this.instance.steps.length,o=n||r?null:this._currentStep?{id:this._currentStep.id,title:this._currentStep.title}:null,a={instanceId:(m=this.instance)==null?void 0:m.id,workflowId:(v=this.instance)==null?void 0:v.workflowId,completedStepId:s||(i?i.id:null),completedStepData:i?{id:i.id,title:i.title,responses:i.responses||[]}:null,completedSteps:Array.from(this._internalCompletedSteps),currentStep:o,mode:this.mode};this.dispatchEvent(new CustomEvent("instance-updated",{detail:a,bubbles:!0,composed:!0}))}_restoreFormData(){var e;if(!this.persistenceManager.shouldRestoreData(this.mode||"default")){console.log("Skipping form data restoration - showing official instance data");return}const s=this.persistenceManager.restoreFormData((e=this.instance)==null?void 0:e.id);s?(this.formStateManager.updateFormData(s.formData),this._formData=this.formStateManager.getFormData(),this._currentStepIndex=s.stepIndex,this._savedSignatures=s.savedSignatures,this._internalCompletedSteps=s.completedSteps,this._savedInstance=s.savedInstance||void 0):this._updateCompletedStepsFromCurrentIndex()}_updateCompletedStepsFromCurrentIndex(){var s;if((s=this.instance)!=null&&s.steps){this._internalCompletedSteps=new Set(this.instance.completedSteps||[]);for(let e=0;e<this._currentStepIndex;e++)this.instance.steps[e]&&this._internalCompletedSteps.add(this.instance.steps[e].id)}}_restoreFormDataFromDOM(){this._restoreFormData(),this._restoreFormValuesToDOM()}_restoreFormValuesToDOM(){this.updateComplete.then(()=>{var e,t;(e=this.shadowRoot)!=null&&e.querySelector(".runner-step-form")&&(Object.entries(this._formData).forEach(([i,n])=>{var o;if(i.endsWith("_signatureData"))return;const r=(o=this.shadowRoot)==null?void 0:o.getElementById(i);if(r){if(r.type==="checkbox"){const a=r;typeof n=="boolean"?a.checked=n:Array.isArray(n)&&(a.checked=n.includes(a.value))}else if(r.type==="radio"){const a=r;a.checked=a.value===n}else if(r.type==="file"){const a=r;a.value=""}else r.value=String(n||"");console.log(`Restored value for ${i}:`,n)}}),this._restoreSignatures(),console.log("Form values restored to DOM elements"),this._updateInstanceWithFormData(!0),(t=this._savedInstance)!=null&&t.steps&&this._restoreInstanceResponses())})}_updateInstanceWithFormData(s=!1){this.instance&&this.instance.steps&&this.instance.steps.forEach(e=>{e.responses||(e.responses=[]),e.elements.forEach(t=>{if(t.type==="text_input"||t.type==="textarea"||t.type==="select"||t.type==="number"||t.type==="radio"||t.type==="checkbox"||t.type==="date"||t.type==="file_upload"||t.type==="signature"){const i=t,n=this._formData[i.id];if(n!==void 0&&e.responses){let r=e.responses.find(o=>o.elementId===i.id);r?(r.value=n,r.answeredAt=new Date):(r={elementId:i.id,value:n,answeredAt:new Date},e.responses.push(r))}}})})}_restoreSignatures(){Object.entries(this._formData).forEach(([s,e])=>{if(s.endsWith("_signatureData")&&e){const t=s.replace("_signatureData",""),i=this.signatureManager.getSignaturePad(t);if(i&&e)try{i.clear(),i.fromData(e)}catch{}}})}_saveFormDataToHistory(){var s;this.persistenceManager.saveFormData((s=this.instance)==null?void 0:s.id,this._formData,this._currentStepIndex,this._savedSignatures,this._internalCompletedSteps,this.instance||null)}_extractFormDataFromDOM(){var i;const s={},e=(i=this.shadowRoot)==null?void 0:i.querySelector(".runner-step-form");if(!e)return s;const t=e.elements;for(let n=0;n<t.length;n++){const r=t[n];if(r.name||r.id){const o=r.id||r.name;if(r.type==="checkbox"){const a=r;a.name&&a.name===o?(s[o]||(s[o]=[]),a.checked&&s[o].push(a.value)):s[o]=a.checked}else if(r.type==="radio"){const a=r;a.checked&&(s[o]=a.value)}else s[o]=r.value}}return s}_updateInstanceFromFormData(s=!1){const e=this._extractFormDataFromDOM();Object.keys(e).length>0?(this.formStateManager.mergeFormData(e),this._formData=this.formStateManager.getFormData(),this.instance&&this.instance.steps&&this.instance.steps.forEach(i=>{i.responses||(i.responses=[]),i.elements.forEach(n=>{if(n.type==="text_input"||n.type==="textarea"||n.type==="select"||n.type==="number"||n.type==="radio"||n.type==="checkbox"||n.type==="date"||n.type==="file_upload"||n.type==="signature"){const r=n,o=this._formData[r.id];if(o!==void 0&&i.responses){let a=i.responses.find(l=>l.elementId===r.id);a?(a.value=o,a.answeredAt=new Date):(a={elementId:r.id,value:o,answeredAt:new Date},i.responses.push(a))}}})}),console.log("Instance updated from form data:",this.instance),s&&this._updateInstanceData(void 0,"form_data_update",{updatedFormDataKeys:Object.keys(this._formData),updatedCompletedSteps:Array.from(this._internalCompletedSteps)})):console.log("No new form data to update instance with")}updateInstanceFromFormData(s=!1){this._updateInstanceFromFormData(s)}getFormData(){return this.formStateManager.getFormData()}restoreFormData(){this._restoreFormDataFromDOM()}clearSavedFormData(s){this._clearSavedFormData(s)}_renderUnifiedSubmissionView(){const s={instance:this.instance,assignedSteps:this._getAssignedSteps(),completedSteps:this._internalCompletedSteps,isStepAssignedToUser:this._isStepAssignedToUser.bind(this)};return Ne.renderUnifiedSubmissionView(s)}_isInstanceCompleted(){var s;return((s=this.instance)==null?void 0:s.status)==="completed"}_areUserStepsCompleted(){var e;if(!((e=this.instance)!=null&&e.steps))return!1;const s=this._getAssignedSteps();return s.length===0?!1:s.every(t=>t.status==="completed")}_isCurrentStepCompleted(){const s=this._currentStep;return!s||!this._isCurrentStepAssigned()?!1:this._internalCompletedSteps.has(s.id)}_shouldShowCompletionView(){var s;return this.mode!=="default"?!1:!!(this._isCurrentStepCompleted()||this._isInstanceCompleted()||((s=this.instance)==null?void 0:s.status)==="active"&&this._areUserStepsCompleted())}_renderModeBasedContent(){var e,t;if(this._shouldShowCompletionView())return this._renderUnifiedSubmissionView();if(this.mode==="print")return this._renderAllStepsForPrint();const s=this.mode==="preview"?(e=this.workflow)==null?void 0:e.steps:(t=this.instance)==null?void 0:t.steps;return!s||s.length===0?d`<div class="runner-content">
|
|
4601
|
+
`}_nextStep(){var t,i,r,n;if(!this._validateStep())return;const s=this._currentStep;s&&this._captureSignaturesFromStep(s);const e=this._findNextAssignedStep(this._currentStepIndex);if(e!==-1){const o=(t=this._currentStep)==null?void 0:t.id;if(this._currentStepIndex=e,o&&((i=this.instance)!=null&&i.steps)){const d=this.instance.steps.find(p=>p.id===o);d&&(d.status="completed")}const a=(n=(r=this.instance)==null?void 0:r.steps)==null?void 0:n[this._currentStepIndex];a&&(a.status="active"),this._updateInstanceData(o,"step_navigation",{direction:"next",fromStepIndex:this._currentStepIndex-1,toStepIndex:this._currentStepIndex,completedStepId:o}),this.mode!=="admin"&&this._saveFormDataToHistory(),this._scrollToTop()}}_findNextAssignedStep(s){return this.instance?this.navigationService.findNextAssignedStep(s,this.instance):-1}_isLastAssignedStep(){return this.navigationService.isLastAssignedStep(this._currentStepIndex,this.instance)}_isLastStepInWorkflow(){var e;const s=(e=this.instance)==null?void 0:e.steps;return s?this._currentStepIndex===s.length-1:!1}_goToStep(s){var i;console.log(`🎯 _goToStep called: stepIndex=${s}, mode=${this.mode}, currentStep=${this._currentStepIndex}`);const e=this.mode==="preview"?this.workflow:this.instance;if(console.log("📊 Data source:",e?`${((i=e.steps)==null?void 0:i.length)||0} steps`:"null"),!e){console.log("❌ No data source available");return}const t=this.navigationService.canNavigateToStep(s,this._currentStepIndex,e,this._internalCompletedSteps,this._isSubmitted,this._userStepsSubmitted);console.log("🚦 Navigation result:",t),t.canNavigate?(this._currentStepIndex=t.newStepIndex,console.log(`✅ Navigated to step ${t.newStepIndex}`),this._scrollToTop()):console.log("❌ Navigation blocked:",t.reason)}_submitUserSteps(){var t;if(!this._validateStep())return;const s=this._currentStep;if(s&&this._captureSignaturesFromStep(s),!this.instance){console.error("Cannot submit, instance data is missing.");return}const e=(t=this._currentStep)==null?void 0:t.id;e&&this._internalCompletedSteps.add(e),console.log("User completing their assigned steps:",this.instance.id),console.log("Form data:",this._formData),this._userStepsSubmitted=!0,this._clearSavedFormData("user steps submission"),this._updateInstanceData(e,"user_steps_submission"),this._scrollToTop()}_submit(){var t;if(!this._validateStep())return;const s=this._currentStep;if(s&&this._captureSignaturesFromStep(s),!this.instance){console.error("Cannot submit, instance data is missing.");return}const e=(t=this._currentStep)==null?void 0:t.id;e&&this._internalCompletedSteps.add(e),console.log("Submitting entire workflow:",this.instance.id),console.log("Final form data:",this._formData),this.instance&&(this.instance.status="completed",this.instance.currentStepId=void 0,this.instance.completedSteps=Array.from(this._internalCompletedSteps)),this._isSubmitted=!0,this._clearSavedFormData("full workflow submission"),this._scrollToTop(),this._updateInstanceData(e,"submission")}_saveStep(){var t;if(!this._validateStep())return;const s=this._currentStep;if(s&&this._captureSignaturesFromStep(s),!this.instance){console.error("Cannot save, instance data is missing.");return}const e=(t=this._currentStep)==null?void 0:t.id;if(e&&(this._internalCompletedSteps.add(e),this.instance.steps)){const i=this.instance.steps.find(r=>r.id===e);i&&(i.status="completed")}this._updateInstanceData(e,"admin_save",{stepId:e,adminMode:!0}),this._justSaved=!0,this.requestUpdate(),setTimeout(()=>{this._justSaved=!1,this.requestUpdate()},2e3)}_clearSavedFormData(s){var e;this.persistenceManager.clearFormData((e=this.instance)==null?void 0:e.id,s)}_scrollToTop(){requestAnimationFrame(()=>{var t,i;this.scrollIntoView({behavior:"smooth",block:"start"});const s=(t=this.shadowRoot)==null?void 0:t.querySelector(".runner-layout");s&&s.scrollTo({top:0,behavior:"smooth"});const e=(i=this.shadowRoot)==null?void 0:i.querySelector(".runner-main-content");e&&e.scrollTo({top:0,behavior:"smooth"})})}_updateInstanceData(s,e,t){var d,p,c,u,h,m,v;s&&this._internalCompletedSteps.add(s);let i=(p=(d=this.instance)==null?void 0:d.steps)==null?void 0:p.find(D=>D.id===s);if(!i&&this._internalCompletedSteps.size>0){const D=Array.from(this._internalCompletedSteps),se=D[D.length-1];i=(u=(c=this.instance)==null?void 0:c.steps)==null?void 0:u.find(re=>re.id===se)}const r=e==="submission",n=((h=this.instance)==null?void 0:h.steps)&&this._internalCompletedSteps.size>=this.instance.steps.length,o=r||n?null:this._currentStep?{id:this._currentStep.id,title:this._currentStep.title}:null,a={instanceId:(m=this.instance)==null?void 0:m.id,workflowId:(v=this.instance)==null?void 0:v.workflowId,completedStepId:s||(i?i.id:null),completedStepData:i?{id:i.id,title:i.title,responses:i.responses||[]}:null,completedSteps:Array.from(this._internalCompletedSteps),currentStep:o,mode:this.mode};this.dispatchEvent(new CustomEvent("instance-updated",{detail:a,bubbles:!0,composed:!0}))}_restoreFormData(){var e;if(!this.persistenceManager.shouldRestoreData(this.mode||"default")){console.log("Skipping form data restoration - showing official instance data");return}const s=this.persistenceManager.restoreFormData((e=this.instance)==null?void 0:e.id);s?(this.formStateManager.updateFormData(s.formData),this._formData=this.formStateManager.getFormData(),this._currentStepIndex=s.stepIndex,this._savedSignatures=s.savedSignatures,this._internalCompletedSteps=s.completedSteps,this._savedInstance=s.savedInstance||void 0):this._updateCompletedStepsFromCurrentIndex()}_updateCompletedStepsFromCurrentIndex(){var s;if((s=this.instance)!=null&&s.steps){this._internalCompletedSteps=new Set(this.instance.completedSteps||[]);for(let e=0;e<this._currentStepIndex;e++)this.instance.steps[e]&&this._internalCompletedSteps.add(this.instance.steps[e].id)}}_restoreFormDataFromDOM(){this._restoreFormData(),this._restoreFormValuesToDOM()}_restoreFormValuesToDOM(){this.updateComplete.then(()=>{var e,t;(e=this.shadowRoot)!=null&&e.querySelector(".runner-step-form")&&(Object.entries(this._formData).forEach(([i,r])=>{var o;if(i.endsWith("_signatureData"))return;const n=(o=this.shadowRoot)==null?void 0:o.getElementById(i);if(n){if(n.type==="checkbox"){const a=n;typeof r=="boolean"?a.checked=r:Array.isArray(r)&&(a.checked=r.includes(a.value))}else if(n.type==="radio"){const a=n;a.checked=a.value===r}else if(n.type==="file"){const a=n;a.value=""}else n.value=String(r||"");console.log(`Restored value for ${i}:`,r)}}),this._restoreSignatures(),console.log("Form values restored to DOM elements"),this._updateInstanceWithFormData(!0),(t=this._savedInstance)!=null&&t.steps&&this._restoreInstanceResponses())})}_updateInstanceWithFormData(s=!1){this.instance&&this.instance.steps&&this.instance.steps.forEach(e=>{e.responses||(e.responses=[]),e.elements.forEach(t=>{if(t.type==="text_input"||t.type==="textarea"||t.type==="select"||t.type==="number"||t.type==="radio"||t.type==="checkbox"||t.type==="date"||t.type==="file_upload"||t.type==="signature"){const i=t,r=this._formData[i.id];if(r!==void 0&&e.responses){let n=e.responses.find(o=>o.elementId===i.id);n?(n.value=r,n.answeredAt=new Date):(n={elementId:i.id,value:r,answeredAt:new Date},e.responses.push(n))}}})})}_restoreSignatures(){Object.entries(this._formData).forEach(([s,e])=>{if(s.endsWith("_signatureData")&&e){const t=s.replace("_signatureData",""),i=this.signatureManager.getSignaturePad(t);if(i&&e)try{i.clear(),i.fromData(e)}catch{}}})}_saveFormDataToHistory(){var s;this.persistenceManager.saveFormData((s=this.instance)==null?void 0:s.id,this._formData,this._currentStepIndex,this._savedSignatures,this._internalCompletedSteps,this.instance||null)}_extractFormDataFromDOM(){var i;const s={},e=(i=this.shadowRoot)==null?void 0:i.querySelector(".runner-step-form");if(!e)return s;const t=e.elements;for(let r=0;r<t.length;r++){const n=t[r];if(n.name||n.id){const o=n.id||n.name;if(n.type==="checkbox"){const a=n;a.name&&a.name===o?(s[o]||(s[o]=[]),a.checked&&s[o].push(a.value)):s[o]=a.checked}else if(n.type==="radio"){const a=n;a.checked&&(s[o]=a.value)}else s[o]=n.value}}return s}_updateInstanceFromFormData(s=!1){const e=this._extractFormDataFromDOM();Object.keys(e).length>0?(this.formStateManager.mergeFormData(e),this._formData=this.formStateManager.getFormData(),this.instance&&this.instance.steps&&this.instance.steps.forEach(i=>{i.responses||(i.responses=[]),i.elements.forEach(r=>{if(r.type==="text_input"||r.type==="textarea"||r.type==="select"||r.type==="number"||r.type==="radio"||r.type==="checkbox"||r.type==="date"||r.type==="file_upload"||r.type==="signature"){const n=r,o=this._formData[n.id];if(o!==void 0&&i.responses){let a=i.responses.find(d=>d.elementId===n.id);a?(a.value=o,a.answeredAt=new Date):(a={elementId:n.id,value:o,answeredAt:new Date},i.responses.push(a))}}})}),console.log("Instance updated from form data:",this.instance),s&&this._updateInstanceData(void 0,"form_data_update",{updatedFormDataKeys:Object.keys(this._formData),updatedCompletedSteps:Array.from(this._internalCompletedSteps)})):console.log("No new form data to update instance with")}updateInstanceFromFormData(s=!1){this._updateInstanceFromFormData(s)}getFormData(){return this.formStateManager.getFormData()}restoreFormData(){this._restoreFormDataFromDOM()}clearSavedFormData(s){this._clearSavedFormData(s)}_renderUnifiedSubmissionView(){const s={instance:this.instance,assignedSteps:this._getAssignedSteps(),completedSteps:this._internalCompletedSteps,isStepAssignedToUser:this._isStepAssignedToUser.bind(this)};return Le.renderUnifiedSubmissionView(s)}_isInstanceCompleted(){var s;return((s=this.instance)==null?void 0:s.status)==="completed"}_areUserStepsCompleted(){var e;if(!((e=this.instance)!=null&&e.steps))return!1;const s=this._getAssignedSteps();return s.length===0?!1:s.every(t=>t.status==="completed")}_isCurrentStepCompleted(){const s=this._currentStep;return!s||!this._isCurrentStepAssigned()?!1:this._internalCompletedSteps.has(s.id)}_shouldShowCompletionView(){var s;return this.mode!=="default"?!1:!!(this._isCurrentStepCompleted()||this._isInstanceCompleted()||((s=this.instance)==null?void 0:s.status)==="active"&&this._areUserStepsCompleted())}_renderModeBasedContent(){var e,t;if(this._shouldShowCompletionView())return this._renderUnifiedSubmissionView();if(this.mode==="print")return this._renderAllStepsForPrint();const s=this.mode==="preview"?(e=this.workflow)==null?void 0:e.steps:(t=this.instance)==null?void 0:t.steps;return!s||s.length===0?l`<div class="runner-content">
|
|
4152
4602
|
${this.mode==="preview"?"No workflow loaded or workflow has no steps.":"No workflow instance loaded or instance has no steps."}
|
|
4153
|
-
</div>`:this.mode==="default"&&this._getAssignedSteps().length===0?this._renderNotAssignedView():null}_validateCurrentStep(){return this._currentStep}_initializeStepAssets(s){this.updateComplete.then(()=>{s.elements.forEach(e=>{var t;e.type==="signature"&&((t=this.shadowRoot)!=null&&t.getElementById(`signature-${e.id}`))&&this._initializeSignaturePad(e.id)}),this._restoreSignatures(),setTimeout(()=>{this._formRestorationComplete||(this._restoreFormDataFromDOM(),this._formRestorationComplete=!0)},100)})}_renderCurrentStepLayout(s){var n
|
|
4603
|
+
</div>`:this.mode==="default"&&this._getAssignedSteps().length===0?this._renderNotAssignedView():null}_validateCurrentStep(){return this._currentStep}_initializeStepAssets(s){this.updateComplete.then(()=>{s.elements.forEach(e=>{var t;e.type==="signature"&&((t=this.shadowRoot)!=null&&t.getElementById(`signature-${e.id}`))&&this._initializeSignaturePad(e.id)}),this._restoreSignatures(),setTimeout(()=>{this._formRestorationComplete||(this._restoreFormDataFromDOM(),this._formRestorationComplete=!0)},100)})}_renderCurrentStepLayout(s){var r,n;const e=this._isLastAssignedStep(),t=this._isLastStepInWorkflow(),i=this.mode==="preview"?(r=this.workflow)==null?void 0:r.steps:(n=this.instance)==null?void 0:n.steps;return l`
|
|
4154
4604
|
<!-- Mobile Steps Navigation (visible only on mobile) -->
|
|
4155
4605
|
${q.renderMobileSteps({steps:i,currentStepIndex:this._currentStepIndex,mode:this.mode||"default",isSubmitted:this._isSubmitted,userStepsSubmitted:this._userStepsSubmitted,completedSteps:this._internalCompletedSteps,isLoading:this.isLoading,isStepAssignedToUser:this._isStepAssignedToUser.bind(this),goToStep:this._goToStep.bind(this)})}
|
|
4156
4606
|
|
|
@@ -4159,7 +4609,7 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
4159
4609
|
|
|
4160
4610
|
<!-- Main Content: Step Details and Questions -->
|
|
4161
4611
|
<main class="runner-main-content">
|
|
4162
|
-
${this.mode==="print"?q.renderStepHeader({step:s,mode:this.mode}):
|
|
4612
|
+
${this.mode==="print"?q.renderStepHeader({step:s,mode:this.mode}):l`<div class="runner-card">
|
|
4163
4613
|
${q.renderStepHeader({step:s,mode:this.mode})}
|
|
4164
4614
|
</div>`}
|
|
4165
4615
|
<form class="runner-step-form" @submit=${o=>o.preventDefault()}>
|
|
@@ -4167,12 +4617,12 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
4167
4617
|
${Dt.renderFormActions({mode:this.mode||"default",isLastStep:e,isLastStepInWorkflow:t,justSaved:this._justSaved,isCurrentStepAssigned:this._isCurrentStepAssigned(),handlers:{saveStep:this._saveStep.bind(this),nextStep:this._nextStep.bind(this),submitUserSteps:this._submitUserSteps.bind(this),submit:this._submit.bind(this)}})}
|
|
4168
4618
|
</form>
|
|
4169
4619
|
</main>
|
|
4170
|
-
`}_renderMainContent(){const s=this._renderModeBasedContent();if(s)return s;const e=this._validateCurrentStep();return e?(this._initializeStepAssets(e),this._renderCurrentStepLayout(e)):
|
|
4620
|
+
`}_renderMainContent(){const s=this._renderModeBasedContent();if(s)return s;const e=this._validateCurrentStep();return e?(this._initializeStepAssets(e),this._renderCurrentStepLayout(e)):l`<div class="runner-content">Invalid current step.</div>`}render(){return l`
|
|
4171
4621
|
<div class="runner-layout">
|
|
4172
4622
|
${this._renderMainContent()}
|
|
4173
4623
|
|
|
4174
4624
|
<!-- Loading overlay with white box (conditionally rendered) -->
|
|
4175
|
-
${this.isLoading?
|
|
4625
|
+
${this.isLoading?l`
|
|
4176
4626
|
<div class="runner-loading-overlay">
|
|
4177
4627
|
<div class="runner-loading-box">
|
|
4178
4628
|
<div class="runner-loading-spinner"></div>
|
|
@@ -4181,14 +4631,14 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
4181
4631
|
</div>
|
|
4182
4632
|
`:""}
|
|
4183
4633
|
</div>
|
|
4184
|
-
`}};
|
|
4634
|
+
`}};b.styles=[Ue],b.QUESTION_ELEMENT_TYPES=["text_input","textarea","select","number","radio","checkbox","date","file_upload","signature"],b.CONTENT_ELEMENT_TYPES=["text","html","image","video","file","divider","markdown"],y([A({type:Object})],b.prototype,"instance",2),y([A({type:Object})],b.prototype,"workflow",2),y([A({type:String})],b.prototype,"mode",2),y([A({type:Boolean})],b.prototype,"isLoading",2),y([A({type:Object})],b.prototype,"currentUser",2),y([A({type:Function})],b.prototype,"onSignatureCaptured",2),y([A({type:Function})],b.prototype,"onFileUploaded",2),y([f()],b.prototype,"_currentStepIndex",2),y([f()],b.prototype,"_formData",2),y([f()],b.prototype,"_validationErrors",2),y([f()],b.prototype,"_internalCompletedSteps",2),y([f()],b.prototype,"_formRestorationComplete",2),y([f()],b.prototype,"_savedSignatures",2),y([f()],b.prototype,"_replacingSignatures",2),y([f()],b.prototype,"_savedInstance",2),y([f()],b.prototype,"_isSubmitted",2),y([f()],b.prototype,"_userStepsSubmitted",2),y([f()],b.prototype,"_justSaved",2),b=y([Ie("runner-widget")],b);function Et(s,e={}){const{title:t=s.name||"Workflow Instance",includeStyles:i=!0,customCSS:r="",showTimestamps:n=!1}=e,o=new Date;if(!(s!=null&&s.steps)||s.steps.length===0)throw new Error("Instance must have at least one step to generate HTML");return{html:`<!DOCTYPE html>
|
|
4185
4635
|
<html lang="en">
|
|
4186
4636
|
<head>
|
|
4187
4637
|
<meta charset="UTF-8">
|
|
4188
4638
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
4189
4639
|
<title>${g(t)}</title>
|
|
4190
4640
|
${i?`<style>${Yt()}</style>`:""}
|
|
4191
|
-
${
|
|
4641
|
+
${r?`<style>${r}</style>`:""}
|
|
4192
4642
|
</head>
|
|
4193
4643
|
<body>
|
|
4194
4644
|
<div class="print-layout">
|
|
@@ -4198,8 +4648,8 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
4198
4648
|
</div>
|
|
4199
4649
|
<hr class="print-question-separator" />
|
|
4200
4650
|
|
|
4201
|
-
${
|
|
4202
|
-
${s.steps.map(
|
|
4651
|
+
${n?Vt(s,o):""}
|
|
4652
|
+
${s.steps.map(d=>Mt(d)).join(`
|
|
4203
4653
|
`)}
|
|
4204
4654
|
</div>
|
|
4205
4655
|
</body>
|
|
@@ -4218,11 +4668,11 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
4218
4668
|
${s.description?`<div class="print-step-description">${g(s.description)}</div>`:""}
|
|
4219
4669
|
<hr class="print-question-separator" />
|
|
4220
4670
|
</div>
|
|
4221
|
-
`}function Ft(s,e){return Wt(s)?zt(s,e):It(s)}function zt(s,e){const t=
|
|
4671
|
+
`}function Ft(s,e){return Wt(s)?zt(s,e):It(s)}function zt(s,e){const t=jt(s.id,e.responses),i=t==null?void 0:t.value,n=s.type==="checkbox"&&(!s.options||s.options.length===0)?"":`
|
|
4222
4672
|
<div class="print-question-title">
|
|
4223
4673
|
${g(s.label)}:
|
|
4224
4674
|
</div>
|
|
4225
|
-
`,o='<hr class="print-question-separator" />';switch(s.type){case"text_input":case"number":case"date":return
|
|
4675
|
+
`,o='<hr class="print-question-separator" />';switch(s.type){case"text_input":case"number":case"date":return n+Pt(s,i)+o;case"textarea":return n+Ut(s,i)+o;case"select":return n+Nt(s,i)+o;case"radio":return n+Lt(s,i)+o;case"checkbox":return n+Ot(s,i)+o;case"file_upload":return n+Rt(s,i)+o;case"signature":return n+Ht(s,i)+o;default:return n+`
|
|
4226
4676
|
<div class="unknown-element">
|
|
4227
4677
|
<p>⚠️ Unknown question type: ${g(s.type)}</p>
|
|
4228
4678
|
</div>
|
|
@@ -4301,19 +4751,19 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
4301
4751
|
</div>
|
|
4302
4752
|
${e}
|
|
4303
4753
|
</div>
|
|
4304
|
-
`}}function
|
|
4754
|
+
`}}function Pt(s,e){const t=e!=null?g(String(e)):"";return`
|
|
4305
4755
|
<div class="print-response-value input-response">
|
|
4306
4756
|
${(s.type==="date"&&e?new Date(e).toLocaleDateString():t)||'<span class="print-no-response">No response</span>'}
|
|
4307
4757
|
</div>
|
|
4308
|
-
`}function
|
|
4758
|
+
`}function Ut(s,e){return`
|
|
4309
4759
|
<div class="print-response-value textarea-response">
|
|
4310
4760
|
${(e!=null?g(String(e)):"")||'<span class="print-no-response">No response</span>'}
|
|
4311
4761
|
</div>
|
|
4312
|
-
`}function
|
|
4762
|
+
`}function Nt(s,e){const t=e!=null?String(e):"";return`
|
|
4313
4763
|
<div class="print-response-value select-response">
|
|
4314
4764
|
${t?g(t):'<span class="print-no-response">No selection made</span>'}
|
|
4315
4765
|
</div>
|
|
4316
|
-
`}function
|
|
4766
|
+
`}function Lt(s,e){const t=e!=null?String(e):"";return`
|
|
4317
4767
|
<div class="print-response-value radio-response">
|
|
4318
4768
|
${t?g(t):'<span class="print-no-response">No selection made</span>'}
|
|
4319
4769
|
</div>
|
|
@@ -4323,16 +4773,16 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
4323
4773
|
</div>
|
|
4324
4774
|
`;{const i=Array.isArray(e)?e.map(String):[];return`
|
|
4325
4775
|
<div class="print-response-value checkbox-response">
|
|
4326
|
-
${i.length>0?i.map(
|
|
4776
|
+
${i.length>0?i.map(r=>`<div>• ${g(r)}</div>`).join(""):'<span class="print-no-response">No selections made</span>'}
|
|
4327
4777
|
</div>
|
|
4328
4778
|
`}}function Rt(s,e){if(!e)return'<div class="print-response-value file-response"><span class="print-no-response">No file uploaded</span></div>';const t=typeof e=="string";if(typeof e=="object"&&e.name)return`
|
|
4329
4779
|
<div class="print-response-value file-response">
|
|
4330
4780
|
📎 ${g(e.name)}
|
|
4331
4781
|
${e.size?` <span class="file-size">(${Bt(e.size)})</span>`:""}
|
|
4332
4782
|
</div>
|
|
4333
|
-
`;if(t){const
|
|
4783
|
+
`;if(t){const r=Qt(e);return`
|
|
4334
4784
|
<div class="print-response-value file-response">
|
|
4335
|
-
📎 ${g(
|
|
4785
|
+
📎 ${g(r)}
|
|
4336
4786
|
</div>
|
|
4337
4787
|
`}else return`
|
|
4338
4788
|
<div class="print-response-value file-response">
|
|
@@ -4350,7 +4800,7 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
4350
4800
|
<div class="signature-fallback">
|
|
4351
4801
|
<div class="signature-error">Unable to display signature</div>
|
|
4352
4802
|
</div>
|
|
4353
|
-
`}function Wt(s){return["text_input","textarea","select","number","radio","checkbox","date","file_upload","signature"].includes(s.type)}function
|
|
4803
|
+
`}function Wt(s){return["text_input","textarea","select","number","radio","checkbox","date","file_upload","signature"].includes(s.type)}function jt(s,e){return e==null?void 0:e.find(t=>t.elementId===s)}function Vt(s,e){return`
|
|
4354
4804
|
<div class="runner-card" style="margin-bottom: 40px; border-left: 4px solid #3b82f6;">
|
|
4355
4805
|
<div style="display: flex; justify-content: between; align-items: center; gap: 20px;">
|
|
4356
4806
|
<div>
|
|
@@ -4873,4 +5323,4 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
4873
5323
|
margin: 2px 0;
|
|
4874
5324
|
line-height: 1.4;
|
|
4875
5325
|
}
|
|
4876
|
-
`}function qt(s,e={}){if(!customElements.get("builder-widget"))return console.error("Error: <builder-widget> is not defined. Make sure it was imported."),null;const t=document.getElementById(s);if(!t)return console.error(`Error: Target element with ID '${s}' not found.`),null;t.innerHTML="";const i=document.createElement("builder-widget");return e.workflow&&(i.workflow=e.workflow),e.onWorkflowCreated&&(i.onWorkflowCreated=e.onWorkflowCreated),e.onWorkflowDeleted&&(i.onWorkflowDeleted=e.onWorkflowDeleted),e.onWorkflowUpdated&&(i.onWorkflowUpdated=e.onWorkflowUpdated),t.appendChild(i),console.log(`Drill Builder mounted on #${s}`),i}function Kt(s,e){if(!customElements.get("runner-widget"))return console.error("Error: <runner-widget> is not defined. Make sure it was imported."),null;const t=document.getElementById(s);if(!t)return console.error(`Error: Target element with ID '${s}' not found.`),null;if(e.mode==="preview"){if(!e||!e.workflow)return console.error("Error: Workflow data must be provided for preview mode."),t.innerHTML='<p style="color: red;">Error: Workflow data required for preview mode.</p>',null;if(!e.workflow.steps||e.workflow.steps.length===0)return console.error("Error: Workflow provided to runner has no steps defined."),t.innerHTML='<p style="color: red;">Error: Workflow has no steps.</p>',null}else{if(!e||!e.instance)return console.error("Error: Instance data must be provided in runner config."),t.innerHTML='<p style="color: red;">Error: Instance data required.</p>',null;if(!e.instance.steps||e.instance.steps.length===0)return console.error("Error: Instance provided to runner has no steps defined."),t.innerHTML='<p style="color: red;">Error: Instance has no steps.</p>',null}t.innerHTML="";const i=document.createElement("runner-widget");return e.mode==="preview"?(i.workflow=e.workflow,i.mode="preview"):(i.instance=e.instance,i.mode=e.mode||"default"),e.mode&&(i.mode=e.mode),e.isLoading!==void 0&&(i.isLoading=e.isLoading),e.onSignatureCaptured&&(i.onSignatureCaptured=e.onSignatureCaptured),e.onFileUploaded&&(i.onFileUploaded=e.onFileUploaded),e.currentUser&&(i.currentUser=e.currentUser),e.onInstanceUpdated&&i.addEventListener("instance-updated",
|
|
5326
|
+
`}function qt(s,e={}){if(!customElements.get("builder-widget"))return console.error("Error: <builder-widget> is not defined. Make sure it was imported."),null;const t=document.getElementById(s);if(!t)return console.error(`Error: Target element with ID '${s}' not found.`),null;t.innerHTML="";const i=document.createElement("builder-widget");return e.workflow&&(i.workflow=e.workflow),e.onWorkflowCreated&&(i.onWorkflowCreated=e.onWorkflowCreated),e.onWorkflowDeleted&&(i.onWorkflowDeleted=e.onWorkflowDeleted),e.onWorkflowUpdated&&(i.onWorkflowUpdated=e.onWorkflowUpdated),t.appendChild(i),console.log(`Drill Builder mounted on #${s}`),i}function Kt(s,e){if(!customElements.get("runner-widget"))return console.error("Error: <runner-widget> is not defined. Make sure it was imported."),null;const t=document.getElementById(s);if(!t)return console.error(`Error: Target element with ID '${s}' not found.`),null;if(e.mode==="preview"){if(!e||!e.workflow)return console.error("Error: Workflow data must be provided for preview mode."),t.innerHTML='<p style="color: red;">Error: Workflow data required for preview mode.</p>',null;if(!e.workflow.steps||e.workflow.steps.length===0)return console.error("Error: Workflow provided to runner has no steps defined."),t.innerHTML='<p style="color: red;">Error: Workflow has no steps.</p>',null}else{if(!e||!e.instance)return console.error("Error: Instance data must be provided in runner config."),t.innerHTML='<p style="color: red;">Error: Instance data required.</p>',null;if(!e.instance.steps||e.instance.steps.length===0)return console.error("Error: Instance provided to runner has no steps defined."),t.innerHTML='<p style="color: red;">Error: Instance has no steps.</p>',null}t.innerHTML="";const i=document.createElement("runner-widget");return e.mode==="preview"?(i.workflow=e.workflow,i.mode="preview"):(i.instance=e.instance,i.mode=e.mode||"default"),e.mode&&(i.mode=e.mode),e.isLoading!==void 0&&(i.isLoading=e.isLoading),e.onSignatureCaptured&&(i.onSignatureCaptured=e.onSignatureCaptured),e.onFileUploaded&&(i.onFileUploaded=e.onFileUploaded),e.currentUser&&(i.currentUser=e.currentUser),e.onInstanceUpdated&&i.addEventListener("instance-updated",r=>{const n=r;try{e.onInstanceUpdated(n.detail)}catch(o){console.error("Error executing onInstanceUpdated callback:",o)}}),t.appendChild(i),console.log(`Drill Runner mounted on #${s}`),i}function Jt(s,e){const t=s.getFormData(),i=JSON.parse(JSON.stringify(e));return i.steps&&i.steps.forEach(r=>{r.responses||(r.responses=[]),r.elements.forEach(n=>{if(n.type==="text_input"||n.type==="textarea"||n.type==="select"||n.type==="number"||n.type==="radio"||n.type==="checkbox"||n.type==="date"||n.type==="file_upload"||n.type==="signature"){const o=t[n.id];if(o!==void 0){let a=r.responses.find(d=>d.elementId===n.id);a?(a.value=o,a.answeredAt=new Date):(a={elementId:n.id,value:o,answeredAt:new Date},r.responses.push(a))}}})}),i}function Xt(s,e){const t={};e.steps&&e.steps.forEach(i=>{i.responses&&i.responses.forEach(r=>{t[r.elementId]=r.value})}),s.restoreFormData(),console.log("Form data restored to runner widget:",t)}C.createBuilder=qt,C.createRunner=Kt,C.generateInstanceHTML=Et,C.restoreFormDataToRunner=Xt,C.updateInstanceFromRunnerForm=Jt,Object.defineProperty(C,Symbol.toStringTag,{value:"Module"})});
|