@formio/js 5.0.0-rc.31 → 5.0.0-rc.33

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see formio.embed.min.js.LICENSE.txt */
2
- !function(e,o){"object"==typeof exports&&"object"==typeof module?module.exports=o():"function"==typeof define&&define.amd?define([],o):"object"==typeof exports?exports.Formio=o():e.Formio=o()}(self,(function(){return function(){"use strict";var e={36310:function(e,o){Object.defineProperty(o,"__esModule",{value:!0});class t{constructor(e,o={}){this.baseUrl=e||t.defaultCDN,this.overrides=o,this.libs={js:"",ace:"1.4.12",bootstrap:"5.3.2",bootstrap4:"4.6.2",bootstrap5:"5.3.2","bootstrap-icons":"1.11.1",ckeditor:"19.0.0",flatpickr:"4.6.8","flatpickr-formio":"4.6.13-formio.3","font-awesome":"4.7.0",grid:"latest","moment-timezone":"latest",quill:"2.0.0-dev.3","shortcut-buttons-flatpickr":"0.4.0",uswds:"2.4.8",core:""},this.updateUrls()}getVersion(e){return this.libs[e]}setVersion(e,o){this.libs[e]=o,this.updateUrls()}setBaseUrl(e){this.baseUrl=e,this.updateUrls()}setOverrideUrl(e,o){this.overrides[e]=o,this.updateUrls()}removeOverride(e){delete this.overrides[e],this.updateUrls()}removeOverrides(){this.overrides={},this.updateUrls()}buildUrl(e,o,t){let i;return i="latest"===t||""===t?`${e}/${o}`:`${e}/${o}/${t}`,i}updateUrls(){for(const e in this.libs)e in this.overrides?this[e]=this.buildUrl(this.overrides[e],e,this.libs[e]):this[e]=this.buildUrl(this.baseUrl,e,this.libs[e])}}t.defaultCDN="https://cdn.form.io",o.default=t},4481:function(e,o,t){var i=this&&this.__awaiter||function(e,o,t,i){return new(t||(t=Promise))((function(s,r){function n(e){try{a(i.next(e))}catch(e){r(e)}}function c(e){try{a(i.throw(e))}catch(e){r(e)}}function a(e){var o;e.done?s(e.value):(o=e.value,o instanceof t?o:new t((function(e){e(o)}))).then(n,c)}a((i=i.apply(e,o||[])).next())}))},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(o,"__esModule",{value:!0}),o.FormBuilder=o.Form=o.Formio=void 0;const r=s(t(36310));class n{static setLicense(e,o=!1){n.license=e,!o&&n.FormioClass&&n.FormioClass.setLicense(e)}static setBaseUrl(e,o=!1){n.baseUrl=e,!o&&n.FormioClass&&n.FormioClass.setBaseUrl(e)}static setApiUrl(e,o=!1){n.baseUrl=e,!o&&n.FormioClass&&n.FormioClass.setApiUrl(e)}static setProjectUrl(e,o=!1){n.projectUrl=e,!o&&n.FormioClass&&n.FormioClass.setProjectUrl(e)}static setAppUrl(e,o=!1){n.projectUrl=e,!o&&n.FormioClass&&n.FormioClass.setAppUrl(e)}static setPathType(e,o=!1){n.pathType=e,!o&&n.FormioClass&&n.FormioClass.setPathType(e)}static debug(...e){n.config.debug&&console.log(...e)}static clearCache(){n.FormioClass&&n.FormioClass.clearCache()}static global(e,o=""){const t=window[e];return o&&t&&!t[o]?null:(n.debug(`Getting global ${e}`,t),t)}static use(e){n.FormioClass&&n.FormioClass.isRenderer?n.FormioClass.use(e):n.modules.push(e)}static createElement(e,o,t){const i=document.createElement(e);return Object.keys(o).forEach((e=>{i.setAttribute(e,o[e])})),(t||[]).forEach((e=>{i.appendChild(n.createElement(e.tag,e.attrs,e.children))})),i}static addScript(e,o,t,s=""){return i(this,void 0,void 0,(function*(){if(!o)return Promise.resolve();if("string"!=typeof o&&o.length)return Promise.all(o.map((o=>n.addScript(e,o))));if(t&&n.global(t,s))return n.debug(`${t} already loaded.`),Promise.resolve(n.global(t));n.debug("Adding Script",o);try{e.appendChild(n.createElement("script",{src:o}))}catch(e){return n.debug(e),Promise.resolve()}return t?new Promise((e=>{n.debug(`Waiting to load ${t}`);const o=setInterval((()=>{n.global(t,s)&&(clearInterval(o),n.debug(`${t} loaded.`),e(n.global(t)))}),100)})):Promise.resolve()}))}static addStyles(e,o){return i(this,void 0,void 0,(function*(){o&&("string"!=typeof o&&o.length?o.forEach((o=>n.addStyles(e,o))):(n.debug("Adding Styles",o),e.appendChild(n.createElement("link",{rel:"stylesheet",href:o}))))}))}static submitDone(e,o){return i(this,void 0,void 0,(function*(){n.debug("Submision Complete",o);const t=(n.config.success||"").toString();t&&"false"!==t.toLowerCase()&&e.element&&(e.element.innerHTML=`<div class="alert-success" role="alert">${t}</div>`);let i=n.config.redirect;if(!i&&e._form&&e._form.settings&&(e._form.settings.returnUrl||e._form.settings.redirect)&&(n.debug("Return url found in form configuration"),i=e._form.settings.returnUrl||e._form.settings.redirect),i){const t=e.formio?e.formio.formUrl:"",s=!!i.match(/\?/),r=0===i.indexOf(location.origin);i+=s?"&":"?",i+=`sub=${o._id}`,!r&&t&&(i+=`&form=${encodeURIComponent(t)}`),n.debug("Return URL",i),window.location.href=i,r&&window.location.reload()}}))}static formioScript(e,o){return o=o||n.config.includeBuilder,n.fullAdded||o?(n.fullAdded=!0,e.replace("formio.form","formio.full")):e}static addLibrary(e,o,t){return i(this,void 0,void 0,(function*(){if(o){if(o.dependencies)for(let t=0;t<o.dependencies.length;t++)yield n.addLibrary(e,n.cdn.libs[o.dependencies[t]]);if(o.css&&(yield n.addStyles(e,o.css)),o.js){const i=yield n.addScript(e,o.js,!!o.use&&t);if(o.use){n.debug(`Using ${t}`);const e=o.options||{};!e.license&&n.license&&(e.license=n.license),n.use("function"==typeof o.use?o.use(i):i,e)}}}}))}static init(e,o={},t=!1){return i(this,void 0,void 0,(function*(){n.cdn=new r.default(n.config.cdn,n.config.cdnUrls||{}),n.config.libs=n.config.libs||{uswds:{dependencies:["fontawesome"],js:`${n.cdn.uswds}/uswds.min.js`,css:`${n.cdn.uswds}/uswds.min.css`,use:!0},fontawesome:{css:`${n.cdn["font-awesome"]}/css/font-awesome.min.css`},bootstrap4:{dependencies:["fontawesome"],css:`${n.cdn.bootstrap4}/css/bootstrap.min.css`},bootstrap:{dependencies:["bootstrap-icons"],css:`${n.cdn.bootstrap}/css/bootstrap.min.css`},"bootstrap-icons":{css:`${n.cdn["bootstrap-icons"]}/css/bootstrap-icons.css`}};const i=n.config.id||`formio-${Math.random().toString(36).substring(7)}`;let s=n.createElement("div",{id:`${i}-wrapper`});e.parentNode.insertBefore(s,e),n.config.includeLibs&&"function"==typeof s.attachShadow&&!n.config.premium&&(s=s.attachShadow({mode:"open"}),o.shadowRoot=s),e.parentNode.removeChild(e),s.appendChild(e),yield n.addStyles(s,n.config.embedCSS||`${n.cdn.js}/formio.embed.css`),s.appendChild(n.createElement("div",{class:"formio-loader"},[{tag:"div",attrs:{class:"loader-wrapper"},children:[{tag:"div",attrs:{class:"loader text-center"}}]}]));const c=n.config.debug?"formio.form":"formio.form.min";if(n.FormioClass=yield n.addScript(s,n.formioScript(n.config.script||`${n.cdn.js}/${c}.js`,t),"Formio",t?"isBuilder":"isRenderer"),n.FormioClass.cdn=n.cdn,n.FormioClass.setBaseUrl(o.baseUrl||n.baseUrl||n.config.base),n.FormioClass.setProjectUrl(o.projectUrl||n.projectUrl||n.config.project),n.FormioClass.language=n.language,n.setLicense(n.license||n.config.license||!1),n.modules.forEach((e=>{n.FormioClass.use(e)})),n.icons&&(n.FormioClass.icons=n.icons),n.pathType&&n.FormioClass.setPathType(n.pathType),n.config.template&&n.config.includeLibs&&(yield n.addLibrary(s,n.config.libs[n.config.template],n.config.template)),n.config.premium&&(n.config.modules.premium=n.config.premium),n.config.modules)for(const e in n.config.modules){const o=n.config.modules[e];o.use=o.use||!0,yield n.addLibrary(s,o,e)}return yield n.addStyles(s,n.formioScript(n.config.style||`${n.cdn.js}/${c}.css`,t)),n.config.before&&(yield n.config.before(n.FormioClass,e,n.config)),n.FormioClass.license=!0,n._formioReady(n.FormioClass),s}))}static afterCreate(e,o,t){return i(this,void 0,void 0,(function*(){return o.removeChild(o.querySelector(".formio-loader")),n.FormioClass.events.emit(t,e),n.config.after&&(n.debug("Calling ready callback"),n.config.after(e,n.config)),e}))}static createForm(e,o,t={}){return i(this,void 0,void 0,(function*(){const i=yield n.init(e,t);return n.FormioClass.createForm(e,o,Object.assign(Object.assign({},t),{noLoader:!0})).then((e=>(n.config.submission&&(n.debug("Setting submission",n.config.submission),e.submission=n.config.submission),n.afterCreate(e,i,"formEmbedded"),e)))}))}static builder(e,o,t={}){return i(this,void 0,void 0,(function*(){const i=yield n.init(e,t,!0);return n.FormioClass.builder(e,o,t).then((e=>(n.afterCreate(e,i,"builderEmbedded"),e)))}))}}n.FormioClass=null,n.config={},n.modules=[],n.icons="",n.license="",n.formioReady=new Promise(((e,o)=>{n._formioReady=e,n._formioReadyReject=o})),n.version="5.0.0-rc.31",n.Report={create:(e,o,t={})=>i(void 0,void 0,void 0,(function*(){const i=yield n.init(e,t,!0);return n.FormioClass.Report.create(e,o,t).then((e=>(n.afterCreate(e,i,"reportEmbedded"),e)))}))},o.Formio=n,r.default.defaultCDN=n.version.includes("rc")?"https://cdn.test-form.io":"https://cdn.form.io";class c{constructor(e,o,t){this.form=o,this.element=e,this.options=t||{},this.init(),this.instance={proxy:!0,ready:this.ready,destroy:()=>{}}}init(){this.element.innerHTML="",this.ready=this.create().then((e=>(this.instance=e,this.form=e.form,e)))}create(){return n.createForm(this.element,this.form,this.options)}setDisplay(e){return this.instance.proxy||(this.form.display=e,this.init()),this.ready}}o.Form=c;class a extends c{create(){return n.builder(this.element,this.form,this.options)}}o.FormBuilder=a,n.Form=c,n.FormBuilder=a}},o={};function t(i){var s=o[i];if(void 0!==s)return s.exports;var r=o[i]={exports:{}};return e[i].call(r.exports,r,r.exports,t),r.exports}var i={};return function(){var e=i;e.Formio=void 0;const o=t(4481);Object.defineProperty(e,"Formio",{enumerable:!0,get:function(){return o.Formio}});const s=document.getElementsByTagName("script"),r=window.FormioConfig||{};let n=null,c=s.length;const a=r.scriptName||"formio.embed.";for(;c--;)if(s[c].src&&-1!==s[c].src.indexOf(a)){n=s[c];break}if(n){const e={};n.src.replace(/^[^?]+\??/,"").replace(/\?/g,"&").split("&").forEach((o=>{e[o.split("=")[0]]=o.split("=")[1]&&decodeURIComponent(o.split("=")[1])}));let t=n.src.replace(/^([^?]+).*/,"$1").split("/");t.pop(),r.formioPath&&r.formioPath(t),t=t.join("/");const i="true"===e.debug||"1"===e.debug,s=i?"formio.form":"formio.form.min";o.Formio.config=Object.assign({script:e.script||`${r.updatePath?r.updatePath():t}/${s}.js`,style:e.styles||`${r.updatePath?r.updatePath():t}/${s}.css`,cdn:e.cdn,class:e.class||"formio-form-wrapper",src:e.src,form:null,submission:null,project:e.project,base:e.base||"https://api.form.io",submit:e.submit,includeLibs:"true"===e.libs||"1"===e.libs,template:e.template,debug:i,config:{},redirect:e.return||e.redirect,embedCSS:`${r.updatePath?r.updatePath():t}/formio.embed.css`,success:e.success||"Thank you for your submission!",before:null,after:null},r);const c=o.Formio.config.form||o.Formio.config.src;if(c){o.Formio.debug("Embedding Configuration",r),o.Formio.config.addPremiumLib&&o.Formio.config.addPremiumLib(o.Formio.config,t),o.Formio.config.id=`formio-${Math.random().toString(36).substring(7)}`,o.Formio.debug("Creating form element");const e=o.Formio.createElement("div",{id:o.Formio.config.id,class:o.Formio.config.class});n.parentNode.insertBefore(e,n.parentNode.firstElementChild.nextSibling),o.Formio.createForm(e,c,o.Formio.config.config).then((e=>{o.Formio.config.submit&&(e.nosubmit=!0),e.on("submit",(t=>{if(o.Formio.debug("on('submit')",t),o.Formio.config.submit){o.Formio.debug(`Sending submission to ${o.Formio.config.submit}`);const i={"content-type":"application/json"},s=o.Formio.FormioClass.getToken();s&&(i["x-jwt-token"]=s),o.Formio.FormioClass.fetch(o.Formio.config.submit,{body:JSON.stringify(t),headers:i,method:"POST",mode:"cors"}).then((e=>e.json())).then((t=>o.Formio.submitDone(e,t)))}else o.Formio.submitDone(e,t)}))}))}}else document.write("<span>Could not locate the Embedded form.</span>")}(),i.Formio}()}));
2
+ !function(e,o){"object"==typeof exports&&"object"==typeof module?module.exports=o():"function"==typeof define&&define.amd?define([],o):"object"==typeof exports?exports.Formio=o():e.Formio=o()}(self,(function(){return function(){"use strict";var e={36310:function(e,o){Object.defineProperty(o,"__esModule",{value:!0});class t{constructor(e,o={}){this.baseUrl=e||t.defaultCDN,this.overrides=o,this.libs={js:"",ace:"1.4.12",bootstrap:"5.3.2",bootstrap4:"4.6.2",bootstrap5:"5.3.2","bootstrap-icons":"1.11.1",ckeditor:"19.0.0",flatpickr:"4.6.8","flatpickr-formio":"4.6.13-formio.3","font-awesome":"4.7.0",grid:"latest","moment-timezone":"latest",quill:"2.0.0-dev.3","shortcut-buttons-flatpickr":"0.4.0",uswds:"2.4.8",core:""},this.updateUrls()}getVersion(e){return this.libs[e]}setVersion(e,o){this.libs[e]=o,this.updateUrls()}setBaseUrl(e){this.baseUrl=e,this.updateUrls()}setOverrideUrl(e,o){this.overrides[e]=o,this.updateUrls()}removeOverride(e){delete this.overrides[e],this.updateUrls()}removeOverrides(){this.overrides={},this.updateUrls()}buildUrl(e,o,t){let i;return i="latest"===t||""===t?`${e}/${o}`:`${e}/${o}/${t}`,i}updateUrls(){for(const e in this.libs)e in this.overrides?this[e]=this.buildUrl(this.overrides[e],e,this.libs[e]):this[e]=this.buildUrl(this.baseUrl,e,this.libs[e])}}t.defaultCDN="https://cdn.form.io",o.default=t},4481:function(e,o,t){var i=this&&this.__awaiter||function(e,o,t,i){return new(t||(t=Promise))((function(s,r){function n(e){try{a(i.next(e))}catch(e){r(e)}}function c(e){try{a(i.throw(e))}catch(e){r(e)}}function a(e){var o;e.done?s(e.value):(o=e.value,o instanceof t?o:new t((function(e){e(o)}))).then(n,c)}a((i=i.apply(e,o||[])).next())}))},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(o,"__esModule",{value:!0}),o.FormBuilder=o.Form=o.Formio=void 0;const r=s(t(36310));class n{static setLicense(e,o=!1){n.license=e,!o&&n.FormioClass&&n.FormioClass.setLicense(e)}static setBaseUrl(e,o=!1){n.baseUrl=e,!o&&n.FormioClass&&n.FormioClass.setBaseUrl(e)}static setApiUrl(e,o=!1){n.baseUrl=e,!o&&n.FormioClass&&n.FormioClass.setApiUrl(e)}static setProjectUrl(e,o=!1){n.projectUrl=e,!o&&n.FormioClass&&n.FormioClass.setProjectUrl(e)}static setAppUrl(e,o=!1){n.projectUrl=e,!o&&n.FormioClass&&n.FormioClass.setAppUrl(e)}static setPathType(e,o=!1){n.pathType=e,!o&&n.FormioClass&&n.FormioClass.setPathType(e)}static debug(...e){n.config.debug&&console.log(...e)}static clearCache(){n.FormioClass&&n.FormioClass.clearCache()}static global(e,o=""){const t=window[e];return o&&t&&!t[o]?null:(n.debug(`Getting global ${e}`,t),t)}static use(e){n.FormioClass&&n.FormioClass.isRenderer?n.FormioClass.use(e):n.modules.push(e)}static createElement(e,o,t){const i=document.createElement(e);return Object.keys(o).forEach((e=>{i.setAttribute(e,o[e])})),(t||[]).forEach((e=>{i.appendChild(n.createElement(e.tag,e.attrs,e.children))})),i}static addScript(e,o,t,s=""){return i(this,void 0,void 0,(function*(){if(!o)return Promise.resolve();if("string"!=typeof o&&o.length)return Promise.all(o.map((o=>n.addScript(e,o))));if(t&&n.global(t,s))return n.debug(`${t} already loaded.`),Promise.resolve(n.global(t));n.debug("Adding Script",o);try{e.appendChild(n.createElement("script",{src:o}))}catch(e){return n.debug(e),Promise.resolve()}return t?new Promise((e=>{n.debug(`Waiting to load ${t}`);const o=setInterval((()=>{n.global(t,s)&&(clearInterval(o),n.debug(`${t} loaded.`),e(n.global(t)))}),100)})):Promise.resolve()}))}static addStyles(e,o){return i(this,void 0,void 0,(function*(){o&&("string"!=typeof o&&o.length?o.forEach((o=>n.addStyles(e,o))):(n.debug("Adding Styles",o),e.appendChild(n.createElement("link",{rel:"stylesheet",href:o}))))}))}static submitDone(e,o){return i(this,void 0,void 0,(function*(){n.debug("Submision Complete",o);const t=(n.config.success||"").toString();t&&"false"!==t.toLowerCase()&&e.element&&(e.element.innerHTML=`<div class="alert-success" role="alert">${t}</div>`);let i=n.config.redirect;if(!i&&e._form&&e._form.settings&&(e._form.settings.returnUrl||e._form.settings.redirect)&&(n.debug("Return url found in form configuration"),i=e._form.settings.returnUrl||e._form.settings.redirect),i){const t=e.formio?e.formio.formUrl:"",s=!!i.match(/\?/),r=0===i.indexOf(location.origin);i+=s?"&":"?",i+=`sub=${o._id}`,!r&&t&&(i+=`&form=${encodeURIComponent(t)}`),n.debug("Return URL",i),window.location.href=i,r&&window.location.reload()}}))}static formioScript(e,o){return o=o||n.config.includeBuilder,n.fullAdded||o?(n.fullAdded=!0,e.replace("formio.form","formio.full")):e}static addLibrary(e,o,t){return i(this,void 0,void 0,(function*(){if(o){if(o.dependencies)for(let t=0;t<o.dependencies.length;t++)yield n.addLibrary(e,n.cdn.libs[o.dependencies[t]]);if(o.css&&(yield n.addStyles(e,o.css)),o.js){const i=yield n.addScript(e,o.js,!!o.use&&t);if(o.use){n.debug(`Using ${t}`);const e=o.options||{};!e.license&&n.license&&(e.license=n.license),n.use("function"==typeof o.use?o.use(i):i,e)}}}}))}static init(e,o={},t=!1){return i(this,void 0,void 0,(function*(){n.cdn=new r.default(n.config.cdn,n.config.cdnUrls||{}),n.config.libs=n.config.libs||{uswds:{dependencies:["fontawesome"],js:`${n.cdn.uswds}/uswds.min.js`,css:`${n.cdn.uswds}/uswds.min.css`,use:!0},fontawesome:{css:`${n.cdn["font-awesome"]}/css/font-awesome.min.css`},bootstrap4:{dependencies:["fontawesome"],css:`${n.cdn.bootstrap4}/css/bootstrap.min.css`},bootstrap:{dependencies:["bootstrap-icons"],css:`${n.cdn.bootstrap}/css/bootstrap.min.css`},"bootstrap-icons":{css:`${n.cdn["bootstrap-icons"]}/css/bootstrap-icons.css`}};const i=n.config.id||`formio-${Math.random().toString(36).substring(7)}`;let s=n.createElement("div",{id:`${i}-wrapper`});e.parentNode.insertBefore(s,e),n.config.includeLibs&&"function"==typeof s.attachShadow&&!n.config.premium&&(s=s.attachShadow({mode:"open"}),o.shadowRoot=s),e.parentNode.removeChild(e),s.appendChild(e),yield n.addStyles(s,n.config.embedCSS||`${n.cdn.js}/formio.embed.css`),s.appendChild(n.createElement("div",{class:"formio-loader"},[{tag:"div",attrs:{class:"loader-wrapper"},children:[{tag:"div",attrs:{class:"loader text-center"}}]}]));const c=n.config.full?"formio.full":"formio.form",a=n.config.debug?c:`${c}.min`;if(n.FormioClass=yield n.addScript(s,n.formioScript(n.config.script||`${n.cdn.js}/${a}.js`,t),"Formio",t?"isBuilder":"isRenderer"),n.FormioClass.cdn=n.cdn,n.FormioClass.setBaseUrl(o.baseUrl||n.baseUrl||n.config.base),n.FormioClass.setProjectUrl(o.projectUrl||n.projectUrl||n.config.project),n.FormioClass.language=n.language,n.setLicense(n.license||n.config.license||!1),n.modules.forEach((e=>{n.FormioClass.use(e)})),n.icons&&(n.FormioClass.icons=n.icons),n.pathType&&n.FormioClass.setPathType(n.pathType),n.config.template&&n.config.includeLibs&&(yield n.addLibrary(s,n.config.libs[n.config.template],n.config.template)),n.config.premium&&(n.config.modules.premium=n.config.premium),n.config.modules)for(const e in n.config.modules){const o=n.config.modules[e];o.use=o.use||!0,yield n.addLibrary(s,o,e)}return yield n.addStyles(s,n.formioScript(n.config.style||`${n.cdn.js}/${a}.css`,t)),n.config.before&&(yield n.config.before(n.FormioClass,e,n.config)),n.FormioClass.license=!0,n._formioReady(n.FormioClass),s}))}static afterCreate(e,o,t){return i(this,void 0,void 0,(function*(){const i=o.querySelector(".formio-loader");return i&&o.removeChild(i),n.FormioClass.events.emit(t,e),n.config.after&&(n.debug("Calling ready callback"),n.config.after(e,n.config)),e}))}static createForm(e,o,t={}){return i(this,void 0,void 0,(function*(){if(n.FormioClass)return n.FormioClass.createForm(e,o,Object.assign(Object.assign({},t),{noLoader:!0}));const i=yield n.init(e,t);return n.FormioClass.createForm(e,o,Object.assign(Object.assign({},t),{noLoader:!0})).then((e=>(n.config.submission&&(n.debug("Setting submission",n.config.submission),e.submission=n.config.submission),n.afterCreate(e,i,"formEmbedded"),e)))}))}static builder(e,o,t={}){var s;return i(this,void 0,void 0,(function*(){if(null===(s=n.FormioClass)||void 0===s?void 0:s.builder)return n.FormioClass.builder(e,o,t);const i=yield n.init(e,t,!0);return n.FormioClass.builder(e,o,t).then((e=>(n.afterCreate(e,i,"builderEmbedded"),e)))}))}}n.FormioClass=null,n.config={},n.modules=[],n.icons="",n.license="",n.formioReady=new Promise(((e,o)=>{n._formioReady=e,n._formioReadyReject=o})),n.version="5.0.0-rc.33",n.Report={create:(e,o,t={})=>i(void 0,void 0,void 0,(function*(){var i;if(null===(i=n.FormioClass)||void 0===i?void 0:i.Report)return n.FormioClass.Report.create(e,o,t);const s=yield n.init(e,t,!0);return n.FormioClass.Report.create(e,o,t).then((e=>(n.afterCreate(e,s,"reportEmbedded"),e)))}))},o.Formio=n,r.default.defaultCDN=n.version.includes("rc")?"https://cdn.test-form.io":"https://cdn.form.io";class c{constructor(e,o,t){this.form=o,this.element=e,this.options=t||{},this.init(),this.instance={proxy:!0,ready:this.ready,destroy:()=>{}}}init(){this.instance&&!this.instance.proxy&&this.instance.destroy(),this.element.innerHTML="",this.ready=this.create().then((e=>(this.instance=e,this.form=e.form,e)))}create(){return n.createForm(this.element,this.form,this.options)}setForm(e){this.form=e,this.instance&&this.instance.setForm(e)}setDisplay(e){return this.instance.proxy||(this.form.display=e,this.instance.destroy(),this.ready=this.create().then((e=>{this.instance=e,this.setForm(this.form)}))),this.ready}}o.Form=c;class a extends c{create(){return n.builder(this.element,this.form,this.options)}}o.FormBuilder=a,n.Form=c,n.FormBuilder=a}},o={};function t(i){var s=o[i];if(void 0!==s)return s.exports;var r=o[i]={exports:{}};return e[i].call(r.exports,r,r.exports,t),r.exports}var i={};return function(){var e=i;e.Formio=void 0;const o=t(4481);Object.defineProperty(e,"Formio",{enumerable:!0,get:function(){return o.Formio}});const s=document.getElementsByTagName("script"),r=window.FormioConfig||{};let n=null,c=s.length;const a=r.scriptName||"formio.embed.";for(;c--;)if(s[c].src&&-1!==s[c].src.indexOf(a)){n=s[c];break}if(n){const e={};n.src.replace(/^[^?]+\??/,"").replace(/\?/g,"&").split("&").forEach((o=>{e[o.split("=")[0]]=o.split("=")[1]&&decodeURIComponent(o.split("=")[1])}));let t=n.src.replace(/^([^?]+).*/,"$1").split("/");t.pop(),r.formioPath&&r.formioPath(t),t=t.join("/");const i="true"===e.debug||"1"===e.debug,s=i?"formio.form":"formio.form.min";o.Formio.config=Object.assign({script:e.script||`${r.updatePath?r.updatePath():t}/${s}.js`,style:e.styles||`${r.updatePath?r.updatePath():t}/${s}.css`,cdn:e.cdn,class:e.class||"formio-form-wrapper",src:e.src,form:null,submission:null,project:e.project,base:e.base||"https://api.form.io",submit:e.submit,includeLibs:"true"===e.libs||"1"===e.libs,template:e.template,debug:i,config:{},redirect:e.return||e.redirect,embedCSS:`${r.updatePath?r.updatePath():t}/formio.embed.css`,success:e.success||"Thank you for your submission!",before:null,after:null},r);const c=o.Formio.config.form||o.Formio.config.src;if(c){o.Formio.debug("Embedding Configuration",r),o.Formio.config.addPremiumLib&&o.Formio.config.addPremiumLib(o.Formio.config,t),o.Formio.config.id=`formio-${Math.random().toString(36).substring(7)}`,o.Formio.debug("Creating form element");const e=o.Formio.createElement("div",{id:o.Formio.config.id,class:o.Formio.config.class});n.parentNode.insertBefore(e,n.parentNode.firstElementChild.nextSibling),o.Formio.createForm(e,c,o.Formio.config.config).then((e=>{o.Formio.config.submit&&(e.nosubmit=!0),e.on("submit",(t=>{if(o.Formio.debug("on('submit')",t),o.Formio.config.submit){o.Formio.debug(`Sending submission to ${o.Formio.config.submit}`);const i={"content-type":"application/json"},s=o.Formio.FormioClass.getToken();s&&(i["x-jwt-token"]=s),o.Formio.FormioClass.fetch(o.Formio.config.submit,{body:JSON.stringify(t),headers:i,method:"POST",mode:"cors"}).then((e=>e.json())).then((t=>o.Formio.submitDone(e,t)))}else o.Formio.submitDone(e,t)}))}))}}else document.write("<span>Could not locate the Embedded form.</span>")}(),i.Formio}()}));
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see formio.embed.min.js.LICENSE.txt */
2
- !function(e,o){"object"==typeof exports&&"object"==typeof module?module.exports=o():"function"==typeof define&&define.amd?define([],o):"object"==typeof exports?exports.Formio=o():e.Formio=o()}(self,(function(){return function(){"use strict";var e={36310:function(e,o){Object.defineProperty(o,"__esModule",{value:!0});class t{constructor(e,o={}){this.baseUrl=e||t.defaultCDN,this.overrides=o,this.libs={js:"",ace:"1.4.12",bootstrap:"5.3.2",bootstrap4:"4.6.2",bootstrap5:"5.3.2","bootstrap-icons":"1.11.1",ckeditor:"19.0.0",flatpickr:"4.6.8","flatpickr-formio":"4.6.13-formio.3","font-awesome":"4.7.0",grid:"latest","moment-timezone":"latest",quill:"2.0.0-dev.3","shortcut-buttons-flatpickr":"0.4.0",uswds:"2.4.8",core:""},this.updateUrls()}getVersion(e){return this.libs[e]}setVersion(e,o){this.libs[e]=o,this.updateUrls()}setBaseUrl(e){this.baseUrl=e,this.updateUrls()}setOverrideUrl(e,o){this.overrides[e]=o,this.updateUrls()}removeOverride(e){delete this.overrides[e],this.updateUrls()}removeOverrides(){this.overrides={},this.updateUrls()}buildUrl(e,o,t){let i;return i="latest"===t||""===t?`${e}/${o}`:`${e}/${o}/${t}`,i}updateUrls(){for(const e in this.libs)e in this.overrides?this[e]=this.buildUrl(this.overrides[e],e,this.libs[e]):this[e]=this.buildUrl(this.baseUrl,e,this.libs[e])}}t.defaultCDN="https://cdn.form.io",o.default=t},4481:function(e,o,t){var i=this&&this.__awaiter||function(e,o,t,i){return new(t||(t=Promise))((function(s,r){function n(e){try{a(i.next(e))}catch(e){r(e)}}function c(e){try{a(i.throw(e))}catch(e){r(e)}}function a(e){var o;e.done?s(e.value):(o=e.value,o instanceof t?o:new t((function(e){e(o)}))).then(n,c)}a((i=i.apply(e,o||[])).next())}))},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(o,"__esModule",{value:!0}),o.FormBuilder=o.Form=o.Formio=void 0;const r=s(t(36310));class n{static setLicense(e,o=!1){n.license=e,!o&&n.FormioClass&&n.FormioClass.setLicense(e)}static setBaseUrl(e,o=!1){n.baseUrl=e,!o&&n.FormioClass&&n.FormioClass.setBaseUrl(e)}static setApiUrl(e,o=!1){n.baseUrl=e,!o&&n.FormioClass&&n.FormioClass.setApiUrl(e)}static setProjectUrl(e,o=!1){n.projectUrl=e,!o&&n.FormioClass&&n.FormioClass.setProjectUrl(e)}static setAppUrl(e,o=!1){n.projectUrl=e,!o&&n.FormioClass&&n.FormioClass.setAppUrl(e)}static setPathType(e,o=!1){n.pathType=e,!o&&n.FormioClass&&n.FormioClass.setPathType(e)}static debug(...e){n.config.debug&&console.log(...e)}static clearCache(){n.FormioClass&&n.FormioClass.clearCache()}static global(e,o=""){const t=window[e];return o&&t&&!t[o]?null:(n.debug(`Getting global ${e}`,t),t)}static use(e){n.FormioClass&&n.FormioClass.isRenderer?n.FormioClass.use(e):n.modules.push(e)}static createElement(e,o,t){const i=document.createElement(e);return Object.keys(o).forEach((e=>{i.setAttribute(e,o[e])})),(t||[]).forEach((e=>{i.appendChild(n.createElement(e.tag,e.attrs,e.children))})),i}static addScript(e,o,t,s=""){return i(this,void 0,void 0,(function*(){if(!o)return Promise.resolve();if("string"!=typeof o&&o.length)return Promise.all(o.map((o=>n.addScript(e,o))));if(t&&n.global(t,s))return n.debug(`${t} already loaded.`),Promise.resolve(n.global(t));n.debug("Adding Script",o);try{e.appendChild(n.createElement("script",{src:o}))}catch(e){return n.debug(e),Promise.resolve()}return t?new Promise((e=>{n.debug(`Waiting to load ${t}`);const o=setInterval((()=>{n.global(t,s)&&(clearInterval(o),n.debug(`${t} loaded.`),e(n.global(t)))}),100)})):Promise.resolve()}))}static addStyles(e,o){return i(this,void 0,void 0,(function*(){o&&("string"!=typeof o&&o.length?o.forEach((o=>n.addStyles(e,o))):(n.debug("Adding Styles",o),e.appendChild(n.createElement("link",{rel:"stylesheet",href:o}))))}))}static submitDone(e,o){return i(this,void 0,void 0,(function*(){n.debug("Submision Complete",o);const t=(n.config.success||"").toString();t&&"false"!==t.toLowerCase()&&e.element&&(e.element.innerHTML=`<div class="alert-success" role="alert">${t}</div>`);let i=n.config.redirect;if(!i&&e._form&&e._form.settings&&(e._form.settings.returnUrl||e._form.settings.redirect)&&(n.debug("Return url found in form configuration"),i=e._form.settings.returnUrl||e._form.settings.redirect),i){const t=e.formio?e.formio.formUrl:"",s=!!i.match(/\?/),r=0===i.indexOf(location.origin);i+=s?"&":"?",i+=`sub=${o._id}`,!r&&t&&(i+=`&form=${encodeURIComponent(t)}`),n.debug("Return URL",i),window.location.href=i,r&&window.location.reload()}}))}static formioScript(e,o){return o=o||n.config.includeBuilder,n.fullAdded||o?(n.fullAdded=!0,e.replace("formio.form","formio.full")):e}static addLibrary(e,o,t){return i(this,void 0,void 0,(function*(){if(o){if(o.dependencies)for(let t=0;t<o.dependencies.length;t++)yield n.addLibrary(e,n.cdn.libs[o.dependencies[t]]);if(o.css&&(yield n.addStyles(e,o.css)),o.js){const i=yield n.addScript(e,o.js,!!o.use&&t);if(o.use){n.debug(`Using ${t}`);const e=o.options||{};!e.license&&n.license&&(e.license=n.license),n.use("function"==typeof o.use?o.use(i):i,e)}}}}))}static init(e,o={},t=!1){return i(this,void 0,void 0,(function*(){n.cdn=new r.default(n.config.cdn,n.config.cdnUrls||{}),n.config.libs=n.config.libs||{uswds:{dependencies:["fontawesome"],js:`${n.cdn.uswds}/uswds.min.js`,css:`${n.cdn.uswds}/uswds.min.css`,use:!0},fontawesome:{css:`${n.cdn["font-awesome"]}/css/font-awesome.min.css`},bootstrap4:{dependencies:["fontawesome"],css:`${n.cdn.bootstrap4}/css/bootstrap.min.css`},bootstrap:{dependencies:["bootstrap-icons"],css:`${n.cdn.bootstrap}/css/bootstrap.min.css`},"bootstrap-icons":{css:`${n.cdn["bootstrap-icons"]}/css/bootstrap-icons.css`}};const i=n.config.id||`formio-${Math.random().toString(36).substring(7)}`;let s=n.createElement("div",{id:`${i}-wrapper`});e.parentNode.insertBefore(s,e),n.config.includeLibs&&"function"==typeof s.attachShadow&&!n.config.premium&&(s=s.attachShadow({mode:"open"}),o.shadowRoot=s),e.parentNode.removeChild(e),s.appendChild(e),yield n.addStyles(s,n.config.embedCSS||`${n.cdn.js}/formio.embed.css`),s.appendChild(n.createElement("div",{class:"formio-loader"},[{tag:"div",attrs:{class:"loader-wrapper"},children:[{tag:"div",attrs:{class:"loader text-center"}}]}]));const c=n.config.debug?"formio.form":"formio.form.min";if(n.FormioClass=yield n.addScript(s,n.formioScript(n.config.script||`${n.cdn.js}/${c}.js`,t),"Formio",t?"isBuilder":"isRenderer"),n.FormioClass.cdn=n.cdn,n.FormioClass.setBaseUrl(o.baseUrl||n.baseUrl||n.config.base),n.FormioClass.setProjectUrl(o.projectUrl||n.projectUrl||n.config.project),n.FormioClass.language=n.language,n.setLicense(n.license||n.config.license||!1),n.modules.forEach((e=>{n.FormioClass.use(e)})),n.icons&&(n.FormioClass.icons=n.icons),n.pathType&&n.FormioClass.setPathType(n.pathType),n.config.template&&n.config.includeLibs&&(yield n.addLibrary(s,n.config.libs[n.config.template],n.config.template)),n.config.premium&&(n.config.modules.premium=n.config.premium),n.config.modules)for(const e in n.config.modules){const o=n.config.modules[e];o.use=o.use||!0,yield n.addLibrary(s,o,e)}return yield n.addStyles(s,n.formioScript(n.config.style||`${n.cdn.js}/${c}.css`,t)),n.config.before&&(yield n.config.before(n.FormioClass,e,n.config)),n.FormioClass.license=!0,n._formioReady(n.FormioClass),s}))}static afterCreate(e,o,t){return i(this,void 0,void 0,(function*(){return o.removeChild(o.querySelector(".formio-loader")),n.FormioClass.events.emit(t,e),n.config.after&&(n.debug("Calling ready callback"),n.config.after(e,n.config)),e}))}static createForm(e,o,t={}){return i(this,void 0,void 0,(function*(){const i=yield n.init(e,t);return n.FormioClass.createForm(e,o,Object.assign(Object.assign({},t),{noLoader:!0})).then((e=>(n.config.submission&&(n.debug("Setting submission",n.config.submission),e.submission=n.config.submission),n.afterCreate(e,i,"formEmbedded"),e)))}))}static builder(e,o,t={}){return i(this,void 0,void 0,(function*(){const i=yield n.init(e,t,!0);return n.FormioClass.builder(e,o,t).then((e=>(n.afterCreate(e,i,"builderEmbedded"),e)))}))}}n.FormioClass=null,n.config={},n.modules=[],n.icons="",n.license="",n.formioReady=new Promise(((e,o)=>{n._formioReady=e,n._formioReadyReject=o})),n.version="5.0.0-rc.31",n.Report={create:(e,o,t={})=>i(void 0,void 0,void 0,(function*(){const i=yield n.init(e,t,!0);return n.FormioClass.Report.create(e,o,t).then((e=>(n.afterCreate(e,i,"reportEmbedded"),e)))}))},o.Formio=n,r.default.defaultCDN=n.version.includes("rc")?"https://cdn.test-form.io":"https://cdn.form.io";class c{constructor(e,o,t){this.form=o,this.element=e,this.options=t||{},this.init(),this.instance={proxy:!0,ready:this.ready,destroy:()=>{}}}init(){this.element.innerHTML="",this.ready=this.create().then((e=>(this.instance=e,this.form=e.form,e)))}create(){return n.createForm(this.element,this.form,this.options)}setDisplay(e){return this.instance.proxy||(this.form.display=e,this.init()),this.ready}}o.Form=c;class a extends c{create(){return n.builder(this.element,this.form,this.options)}}o.FormBuilder=a,n.Form=c,n.FormBuilder=a}},o={};function t(i){var s=o[i];if(void 0!==s)return s.exports;var r=o[i]={exports:{}};return e[i].call(r.exports,r,r.exports,t),r.exports}var i={};return function(){var e=i;e.Formio=void 0;const o=t(4481);Object.defineProperty(e,"Formio",{enumerable:!0,get:function(){return o.Formio}});const s=document.getElementsByTagName("script"),r=window.FormioConfig||{};let n=null,c=s.length;const a=r.scriptName||"formio.embed.";for(;c--;)if(s[c].src&&-1!==s[c].src.indexOf(a)){n=s[c];break}if(n){const e={};n.src.replace(/^[^?]+\??/,"").replace(/\?/g,"&").split("&").forEach((o=>{e[o.split("=")[0]]=o.split("=")[1]&&decodeURIComponent(o.split("=")[1])}));let t=n.src.replace(/^([^?]+).*/,"$1").split("/");t.pop(),r.formioPath&&r.formioPath(t),t=t.join("/");const i="true"===e.debug||"1"===e.debug,s=i?"formio.form":"formio.form.min";o.Formio.config=Object.assign({script:e.script||`${r.updatePath?r.updatePath():t}/${s}.js`,style:e.styles||`${r.updatePath?r.updatePath():t}/${s}.css`,cdn:e.cdn,class:e.class||"formio-form-wrapper",src:e.src,form:null,submission:null,project:e.project,base:e.base||"https://api.form.io",submit:e.submit,includeLibs:"true"===e.libs||"1"===e.libs,template:e.template,debug:i,config:{},redirect:e.return||e.redirect,embedCSS:`${r.updatePath?r.updatePath():t}/formio.embed.css`,success:e.success||"Thank you for your submission!",before:null,after:null},r);const c=o.Formio.config.form||o.Formio.config.src;if(c){o.Formio.debug("Embedding Configuration",r),o.Formio.config.addPremiumLib&&o.Formio.config.addPremiumLib(o.Formio.config,t),o.Formio.config.id=`formio-${Math.random().toString(36).substring(7)}`,o.Formio.debug("Creating form element");const e=o.Formio.createElement("div",{id:o.Formio.config.id,class:o.Formio.config.class});n.parentNode.insertBefore(e,n.parentNode.firstElementChild.nextSibling),o.Formio.createForm(e,c,o.Formio.config.config).then((e=>{o.Formio.config.submit&&(e.nosubmit=!0),e.on("submit",(t=>{if(o.Formio.debug("on('submit')",t),o.Formio.config.submit){o.Formio.debug(`Sending submission to ${o.Formio.config.submit}`);const i={"content-type":"application/json"},s=o.Formio.FormioClass.getToken();s&&(i["x-jwt-token"]=s),o.Formio.FormioClass.fetch(o.Formio.config.submit,{body:JSON.stringify(t),headers:i,method:"POST",mode:"cors"}).then((e=>e.json())).then((t=>o.Formio.submitDone(e,t)))}else o.Formio.submitDone(e,t)}))}))}}else document.write("<span>Could not locate the Embedded form.</span>")}(),i.Formio}()}));
2
+ !function(e,o){"object"==typeof exports&&"object"==typeof module?module.exports=o():"function"==typeof define&&define.amd?define([],o):"object"==typeof exports?exports.Formio=o():e.Formio=o()}(self,(function(){return function(){"use strict";var e={36310:function(e,o){Object.defineProperty(o,"__esModule",{value:!0});class t{constructor(e,o={}){this.baseUrl=e||t.defaultCDN,this.overrides=o,this.libs={js:"",ace:"1.4.12",bootstrap:"5.3.2",bootstrap4:"4.6.2",bootstrap5:"5.3.2","bootstrap-icons":"1.11.1",ckeditor:"19.0.0",flatpickr:"4.6.8","flatpickr-formio":"4.6.13-formio.3","font-awesome":"4.7.0",grid:"latest","moment-timezone":"latest",quill:"2.0.0-dev.3","shortcut-buttons-flatpickr":"0.4.0",uswds:"2.4.8",core:""},this.updateUrls()}getVersion(e){return this.libs[e]}setVersion(e,o){this.libs[e]=o,this.updateUrls()}setBaseUrl(e){this.baseUrl=e,this.updateUrls()}setOverrideUrl(e,o){this.overrides[e]=o,this.updateUrls()}removeOverride(e){delete this.overrides[e],this.updateUrls()}removeOverrides(){this.overrides={},this.updateUrls()}buildUrl(e,o,t){let i;return i="latest"===t||""===t?`${e}/${o}`:`${e}/${o}/${t}`,i}updateUrls(){for(const e in this.libs)e in this.overrides?this[e]=this.buildUrl(this.overrides[e],e,this.libs[e]):this[e]=this.buildUrl(this.baseUrl,e,this.libs[e])}}t.defaultCDN="https://cdn.form.io",o.default=t},4481:function(e,o,t){var i=this&&this.__awaiter||function(e,o,t,i){return new(t||(t=Promise))((function(s,r){function n(e){try{a(i.next(e))}catch(e){r(e)}}function c(e){try{a(i.throw(e))}catch(e){r(e)}}function a(e){var o;e.done?s(e.value):(o=e.value,o instanceof t?o:new t((function(e){e(o)}))).then(n,c)}a((i=i.apply(e,o||[])).next())}))},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(o,"__esModule",{value:!0}),o.FormBuilder=o.Form=o.Formio=void 0;const r=s(t(36310));class n{static setLicense(e,o=!1){n.license=e,!o&&n.FormioClass&&n.FormioClass.setLicense(e)}static setBaseUrl(e,o=!1){n.baseUrl=e,!o&&n.FormioClass&&n.FormioClass.setBaseUrl(e)}static setApiUrl(e,o=!1){n.baseUrl=e,!o&&n.FormioClass&&n.FormioClass.setApiUrl(e)}static setProjectUrl(e,o=!1){n.projectUrl=e,!o&&n.FormioClass&&n.FormioClass.setProjectUrl(e)}static setAppUrl(e,o=!1){n.projectUrl=e,!o&&n.FormioClass&&n.FormioClass.setAppUrl(e)}static setPathType(e,o=!1){n.pathType=e,!o&&n.FormioClass&&n.FormioClass.setPathType(e)}static debug(...e){n.config.debug&&console.log(...e)}static clearCache(){n.FormioClass&&n.FormioClass.clearCache()}static global(e,o=""){const t=window[e];return o&&t&&!t[o]?null:(n.debug(`Getting global ${e}`,t),t)}static use(e){n.FormioClass&&n.FormioClass.isRenderer?n.FormioClass.use(e):n.modules.push(e)}static createElement(e,o,t){const i=document.createElement(e);return Object.keys(o).forEach((e=>{i.setAttribute(e,o[e])})),(t||[]).forEach((e=>{i.appendChild(n.createElement(e.tag,e.attrs,e.children))})),i}static addScript(e,o,t,s=""){return i(this,void 0,void 0,(function*(){if(!o)return Promise.resolve();if("string"!=typeof o&&o.length)return Promise.all(o.map((o=>n.addScript(e,o))));if(t&&n.global(t,s))return n.debug(`${t} already loaded.`),Promise.resolve(n.global(t));n.debug("Adding Script",o);try{e.appendChild(n.createElement("script",{src:o}))}catch(e){return n.debug(e),Promise.resolve()}return t?new Promise((e=>{n.debug(`Waiting to load ${t}`);const o=setInterval((()=>{n.global(t,s)&&(clearInterval(o),n.debug(`${t} loaded.`),e(n.global(t)))}),100)})):Promise.resolve()}))}static addStyles(e,o){return i(this,void 0,void 0,(function*(){o&&("string"!=typeof o&&o.length?o.forEach((o=>n.addStyles(e,o))):(n.debug("Adding Styles",o),e.appendChild(n.createElement("link",{rel:"stylesheet",href:o}))))}))}static submitDone(e,o){return i(this,void 0,void 0,(function*(){n.debug("Submision Complete",o);const t=(n.config.success||"").toString();t&&"false"!==t.toLowerCase()&&e.element&&(e.element.innerHTML=`<div class="alert-success" role="alert">${t}</div>`);let i=n.config.redirect;if(!i&&e._form&&e._form.settings&&(e._form.settings.returnUrl||e._form.settings.redirect)&&(n.debug("Return url found in form configuration"),i=e._form.settings.returnUrl||e._form.settings.redirect),i){const t=e.formio?e.formio.formUrl:"",s=!!i.match(/\?/),r=0===i.indexOf(location.origin);i+=s?"&":"?",i+=`sub=${o._id}`,!r&&t&&(i+=`&form=${encodeURIComponent(t)}`),n.debug("Return URL",i),window.location.href=i,r&&window.location.reload()}}))}static formioScript(e,o){return o=o||n.config.includeBuilder,n.fullAdded||o?(n.fullAdded=!0,e.replace("formio.form","formio.full")):e}static addLibrary(e,o,t){return i(this,void 0,void 0,(function*(){if(o){if(o.dependencies)for(let t=0;t<o.dependencies.length;t++)yield n.addLibrary(e,n.cdn.libs[o.dependencies[t]]);if(o.css&&(yield n.addStyles(e,o.css)),o.js){const i=yield n.addScript(e,o.js,!!o.use&&t);if(o.use){n.debug(`Using ${t}`);const e=o.options||{};!e.license&&n.license&&(e.license=n.license),n.use("function"==typeof o.use?o.use(i):i,e)}}}}))}static init(e,o={},t=!1){return i(this,void 0,void 0,(function*(){n.cdn=new r.default(n.config.cdn,n.config.cdnUrls||{}),n.config.libs=n.config.libs||{uswds:{dependencies:["fontawesome"],js:`${n.cdn.uswds}/uswds.min.js`,css:`${n.cdn.uswds}/uswds.min.css`,use:!0},fontawesome:{css:`${n.cdn["font-awesome"]}/css/font-awesome.min.css`},bootstrap4:{dependencies:["fontawesome"],css:`${n.cdn.bootstrap4}/css/bootstrap.min.css`},bootstrap:{dependencies:["bootstrap-icons"],css:`${n.cdn.bootstrap}/css/bootstrap.min.css`},"bootstrap-icons":{css:`${n.cdn["bootstrap-icons"]}/css/bootstrap-icons.css`}};const i=n.config.id||`formio-${Math.random().toString(36).substring(7)}`;let s=n.createElement("div",{id:`${i}-wrapper`});e.parentNode.insertBefore(s,e),n.config.includeLibs&&"function"==typeof s.attachShadow&&!n.config.premium&&(s=s.attachShadow({mode:"open"}),o.shadowRoot=s),e.parentNode.removeChild(e),s.appendChild(e),yield n.addStyles(s,n.config.embedCSS||`${n.cdn.js}/formio.embed.css`),s.appendChild(n.createElement("div",{class:"formio-loader"},[{tag:"div",attrs:{class:"loader-wrapper"},children:[{tag:"div",attrs:{class:"loader text-center"}}]}]));const c=n.config.full?"formio.full":"formio.form",a=n.config.debug?c:`${c}.min`;if(n.FormioClass=yield n.addScript(s,n.formioScript(n.config.script||`${n.cdn.js}/${a}.js`,t),"Formio",t?"isBuilder":"isRenderer"),n.FormioClass.cdn=n.cdn,n.FormioClass.setBaseUrl(o.baseUrl||n.baseUrl||n.config.base),n.FormioClass.setProjectUrl(o.projectUrl||n.projectUrl||n.config.project),n.FormioClass.language=n.language,n.setLicense(n.license||n.config.license||!1),n.modules.forEach((e=>{n.FormioClass.use(e)})),n.icons&&(n.FormioClass.icons=n.icons),n.pathType&&n.FormioClass.setPathType(n.pathType),n.config.template&&n.config.includeLibs&&(yield n.addLibrary(s,n.config.libs[n.config.template],n.config.template)),n.config.premium&&(n.config.modules.premium=n.config.premium),n.config.modules)for(const e in n.config.modules){const o=n.config.modules[e];o.use=o.use||!0,yield n.addLibrary(s,o,e)}return yield n.addStyles(s,n.formioScript(n.config.style||`${n.cdn.js}/${a}.css`,t)),n.config.before&&(yield n.config.before(n.FormioClass,e,n.config)),n.FormioClass.license=!0,n._formioReady(n.FormioClass),s}))}static afterCreate(e,o,t){return i(this,void 0,void 0,(function*(){const i=o.querySelector(".formio-loader");return i&&o.removeChild(i),n.FormioClass.events.emit(t,e),n.config.after&&(n.debug("Calling ready callback"),n.config.after(e,n.config)),e}))}static createForm(e,o,t={}){return i(this,void 0,void 0,(function*(){if(n.FormioClass)return n.FormioClass.createForm(e,o,Object.assign(Object.assign({},t),{noLoader:!0}));const i=yield n.init(e,t);return n.FormioClass.createForm(e,o,Object.assign(Object.assign({},t),{noLoader:!0})).then((e=>(n.config.submission&&(n.debug("Setting submission",n.config.submission),e.submission=n.config.submission),n.afterCreate(e,i,"formEmbedded"),e)))}))}static builder(e,o,t={}){var s;return i(this,void 0,void 0,(function*(){if(null===(s=n.FormioClass)||void 0===s?void 0:s.builder)return n.FormioClass.builder(e,o,t);const i=yield n.init(e,t,!0);return n.FormioClass.builder(e,o,t).then((e=>(n.afterCreate(e,i,"builderEmbedded"),e)))}))}}n.FormioClass=null,n.config={},n.modules=[],n.icons="",n.license="",n.formioReady=new Promise(((e,o)=>{n._formioReady=e,n._formioReadyReject=o})),n.version="5.0.0-rc.33",n.Report={create:(e,o,t={})=>i(void 0,void 0,void 0,(function*(){var i;if(null===(i=n.FormioClass)||void 0===i?void 0:i.Report)return n.FormioClass.Report.create(e,o,t);const s=yield n.init(e,t,!0);return n.FormioClass.Report.create(e,o,t).then((e=>(n.afterCreate(e,s,"reportEmbedded"),e)))}))},o.Formio=n,r.default.defaultCDN=n.version.includes("rc")?"https://cdn.test-form.io":"https://cdn.form.io";class c{constructor(e,o,t){this.form=o,this.element=e,this.options=t||{},this.init(),this.instance={proxy:!0,ready:this.ready,destroy:()=>{}}}init(){this.instance&&!this.instance.proxy&&this.instance.destroy(),this.element.innerHTML="",this.ready=this.create().then((e=>(this.instance=e,this.form=e.form,e)))}create(){return n.createForm(this.element,this.form,this.options)}setForm(e){this.form=e,this.instance&&this.instance.setForm(e)}setDisplay(e){return this.instance.proxy||(this.form.display=e,this.instance.destroy(),this.ready=this.create().then((e=>{this.instance=e,this.setForm(this.form)}))),this.ready}}o.Form=c;class a extends c{create(){return n.builder(this.element,this.form,this.options)}}o.FormBuilder=a,n.Form=c,n.FormBuilder=a}},o={};function t(i){var s=o[i];if(void 0!==s)return s.exports;var r=o[i]={exports:{}};return e[i].call(r.exports,r,r.exports,t),r.exports}var i={};return function(){var e=i;e.Formio=void 0;const o=t(4481);Object.defineProperty(e,"Formio",{enumerable:!0,get:function(){return o.Formio}});const s=document.getElementsByTagName("script"),r=window.FormioConfig||{};let n=null,c=s.length;const a=r.scriptName||"formio.embed.";for(;c--;)if(s[c].src&&-1!==s[c].src.indexOf(a)){n=s[c];break}if(n){const e={};n.src.replace(/^[^?]+\??/,"").replace(/\?/g,"&").split("&").forEach((o=>{e[o.split("=")[0]]=o.split("=")[1]&&decodeURIComponent(o.split("=")[1])}));let t=n.src.replace(/^([^?]+).*/,"$1").split("/");t.pop(),r.formioPath&&r.formioPath(t),t=t.join("/");const i="true"===e.debug||"1"===e.debug,s=i?"formio.form":"formio.form.min";o.Formio.config=Object.assign({script:e.script||`${r.updatePath?r.updatePath():t}/${s}.js`,style:e.styles||`${r.updatePath?r.updatePath():t}/${s}.css`,cdn:e.cdn,class:e.class||"formio-form-wrapper",src:e.src,form:null,submission:null,project:e.project,base:e.base||"https://api.form.io",submit:e.submit,includeLibs:"true"===e.libs||"1"===e.libs,template:e.template,debug:i,config:{},redirect:e.return||e.redirect,embedCSS:`${r.updatePath?r.updatePath():t}/formio.embed.css`,success:e.success||"Thank you for your submission!",before:null,after:null},r);const c=o.Formio.config.form||o.Formio.config.src;if(c){o.Formio.debug("Embedding Configuration",r),o.Formio.config.addPremiumLib&&o.Formio.config.addPremiumLib(o.Formio.config,t),o.Formio.config.id=`formio-${Math.random().toString(36).substring(7)}`,o.Formio.debug("Creating form element");const e=o.Formio.createElement("div",{id:o.Formio.config.id,class:o.Formio.config.class});n.parentNode.insertBefore(e,n.parentNode.firstElementChild.nextSibling),o.Formio.createForm(e,c,o.Formio.config.config).then((e=>{o.Formio.config.submit&&(e.nosubmit=!0),e.on("submit",(t=>{if(o.Formio.debug("on('submit')",t),o.Formio.config.submit){o.Formio.debug(`Sending submission to ${o.Formio.config.submit}`);const i={"content-type":"application/json"},s=o.Formio.FormioClass.getToken();s&&(i["x-jwt-token"]=s),o.Formio.FormioClass.fetch(o.Formio.config.submit,{body:JSON.stringify(t),headers:i,method:"POST",mode:"cors"}).then((e=>e.json())).then((t=>o.Formio.submitDone(e,t)))}else o.Formio.submitDone(e,t)}))}))}}else document.write("<span>Could not locate the Embedded form.</span>")}(),i.Formio}()}));
@@ -1 +1 @@
1
- /*! formiojs v5.0.0-rc.31 | https://unpkg.com/formiojs@5.0.0-rc.31/LICENSE.txt */
1
+ /*! formiojs v5.0.0-rc.33 | https://unpkg.com/formiojs@5.0.0-rc.33/LICENSE.txt */