@xlork/core
Version:
XLork is a powerful Node.js/ Vanilla js package for parsing and manipulating CSV and XML files. With its intuitive API, XLork makes it easy to read, write, and modify CSV and XML data in your Node.js applications. Whether you're dealing with large dataset
3 lines (2 loc) • 13.2 kB
JavaScript
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e=e||self).XLorkClient=n()}(this,function(){"use strict";function j(){j=function(){return a};var c,a={},e=Object.prototype,u=e.hasOwnProperty,s=Object.defineProperty||function(e,n,t){e[n]=t.value},n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",t=n.asyncIterator||"@@asyncIterator",o=n.toStringTag||"@@toStringTag";function i(e,n,t){return Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}),e[n]}try{i({},"")}catch(c){i=function(e,n,t){return e[n]=t}}function l(e,n,t,r){var o,i,a,l,n=n&&n.prototype instanceof _?n:_,n=Object.create(n.prototype),r=new I(r||[]);return s(n,"_invoke",{value:(o=e,i=t,a=r,l=d,function(e,n){if(l===h)throw Error("Generator is already running");if(l===y){if("throw"===e)throw n;return{value:c,done:!0}}for(a.method=e,a.arg=n;;){var t=a.delegate;if(t){t=function e(n,t){var r=t.method,o=n.iterator[r];if(o===c)return t.delegate=null,"throw"===r&&n.iterator.return&&(t.method="return",t.arg=c,e(n,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),m;r=f(o,n.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,m;o=r.arg;return o?o.done?(t[n.resultName]=o.value,t.next=n.nextLoc,"return"!==t.method&&(t.method="next",t.arg=c),t.delegate=null,m):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,m)}(t,a);if(t){if(t===m)continue;return t}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if(l===d)throw l=y,a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);l=h;t=f(o,i,a);if("normal"===t.type){if(l=a.done?y:p,t.arg===m)continue;return{value:t.arg,done:a.done}}"throw"===t.type&&(l=y,a.method="throw",a.arg=t.arg)}})}),n}function f(e,n,t){try{return{type:"normal",arg:e.call(n,t)}}catch(e){return{type:"throw",arg:e}}}a.wrap=l;var d="suspendedStart",p="suspendedYield",h="executing",y="completed",m={};function _(){}function v(){}function g(){}var n={},x=(i(n,r,function(){return this}),Object.getPrototypeOf),x=x&&x(x(R([]))),b=(x&&x!==e&&u.call(x,r)&&(n=x),g.prototype=_.prototype=Object.create(n));function w(e){["next","throw","return"].forEach(function(n){i(e,n,function(e){return this._invoke(n,e)})})}function k(a,l){var n;s(this,"_invoke",{value:function(t,r){function e(){return new l(function(e,n){!function n(e,t,r,o){var i,e=f(a[e],a,t);if("throw"!==e.type)return(t=(i=e.arg).value)&&"object"==typeof t&&u.call(t,"__await")?l.resolve(t.__await).then(function(e){n("next",e,r,o)},function(e){n("throw",e,r,o)}):l.resolve(t).then(function(e){i.value=e,r(i)},function(e){return n("throw",e,r,o)});o(e.arg)}(t,r,e,n)})}return n=n?n.then(e,e):e()}})}function E(e){var n={tryLoc:e[0]};1 in e&&(n.catchLoc=e[1]),2 in e&&(n.finallyLoc=e[2],n.afterLoc=e[3]),this.tryEntries.push(n)}function L(e){var n=e.completion||{};n.type="normal",delete n.arg,e.completion=n}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function R(n){if(n||""===n){var t,e=n[r];if(e)return e.call(n);if("function"==typeof n.next)return n;if(!isNaN(n.length))return t=-1,(e=function e(){for(;++t<n.length;)if(u.call(n,t))return e.value=n[t],e.done=!1,e;return e.value=c,e.done=!0,e}).next=e}throw new TypeError(typeof n+" is not iterable")}return s(b,"constructor",{value:v.prototype=g,configurable:!0}),s(g,"constructor",{value:v,configurable:!0}),v.displayName=i(g,o,"GeneratorFunction"),a.isGeneratorFunction=function(e){e="function"==typeof e&&e.constructor;return!!e&&(e===v||"GeneratorFunction"===(e.displayName||e.name))},a.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,g):(e.__proto__=g,i(e,o,"GeneratorFunction")),e.prototype=Object.create(b),e},a.awrap=function(e){return{__await:e}},w(k.prototype),i(k.prototype,t,function(){return this}),a.AsyncIterator=k,a.async=function(e,n,t,r,o){void 0===o&&(o=Promise);var i=new k(l(e,n,t,r),o);return a.isGeneratorFunction(n)?i:i.next().then(function(e){return e.done?e.value:i.next()})},w(b),i(b,o,"Generator"),i(b,r,function(){return this}),i(b,"toString",function(){return"[object Generator]"}),a.keys=function(e){var n,t=Object(e),r=[];for(n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},a.values=R,I.prototype={constructor:I,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=c,this.done=!1,this.delegate=null,this.method="next",this.arg=c,this.tryEntries.forEach(L),!e)for(var n in this)"t"===n.charAt(0)&&u.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=c)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function e(e,n){return i.type="throw",i.arg=t,r.next=e,n&&(r.method="next",r.arg=c),!!n}for(var n=this.tryEntries.length-1;0<=n;--n){var o=this.tryEntries[n],i=o.completion;if("root"===o.tryLoc)return e("end");if(o.tryLoc<=this.prev){var a=u.call(o,"catchLoc"),l=u.call(o,"finallyLoc");if(a&&l){if(this.prev<o.catchLoc)return e(o.catchLoc,!0);if(this.prev<o.finallyLoc)return e(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return e(o.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return e(o.finallyLoc)}}}},abrupt:function(e,n){for(var t=this.tryEntries.length-1;0<=t;--t){var r=this.tryEntries[t];if(r.tryLoc<=this.prev&&u.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}var i=(o=o&&("break"===e||"continue"===e)&&o.tryLoc<=n&&n<=o.finallyLoc?null:o)?o.completion:{};return i.type=e,i.arg=n,o?(this.method="next",this.next=o.finallyLoc,m):this.complete(i)},complete:function(e,n){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&n&&(this.next=n),m},finish:function(e){for(var n=this.tryEntries.length-1;0<=n;--n){var t=this.tryEntries[n];if(t.finallyLoc===e)return this.complete(t.completion,t.afterLoc),L(t),m}},catch:function(e){for(var n=this.tryEntries.length-1;0<=n;--n){var t,r,o=this.tryEntries[n];if(o.tryLoc===e)return"throw"===(t=o.completion).type&&(r=t.arg,L(o)),r}throw Error("illegal catch attempt")},delegateYield:function(e,n,t){return this.delegate={iterator:R(e),resultName:n,nextLoc:t},"next"===this.method&&(this.arg=c),m}},a}function m(e){return(m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _(e,n,t,r,o,i,a){try{var l=e[i](a),c=l.value}catch(e){return void t(e)}l.done?n(c):Promise.resolve(c).then(r,o)}return function(e){this.props=e;var e=this.props,l=void 0===(n=e.settings)?{}:n,c=e.licenseKey,u=e.user,n=void 0===(n=e.origin)?"https://app.xlork.com":n,t=e.onCancel,s=void 0===t?function(e){console.log("[onCancelDefault]",e)}:t,f=void 0===(t=e.onComplete)?function(e){console.log("[onCompleteDefault]",e)}:t,l=Object.assign({},{title:"Data",allowInvalidSubmit:!0,theme:null,maxRecords:0,sampleUrl:null,columns:[],display:"popup",header:!0,branding:!1,history:!1,social:!0},l),r="__xlork",d=n+"/embed/"+c,o="<div class=".concat("inline"==(null==(e=l)?void 0:e.display)?"__xlork_iframe_container _inline":"__xlork_iframe_container",'><div class="__xlork_loader" id="__xlork_loader" style="height:100%"><div class="loader_ripple"><div></div><div></div></div><span> Connecting ...</span></div><iframe name="__xlork_iframe" id="__xlork_iframe" src=').concat(d,' frameBorder="0" style="height:0%" allowFullScreen ></iframe> </div>'),p='.__xlork_hidden {\n display: none;\n }\n .__xlork_modal_open {\n overflow: hidden;\n }\n .__xlork_btn_default {\n background-color: #7b66f0;\n border: none;\n color: white;\n padding: 15px 32px;\n text-align: center;\n text-decoration: none;\n display: inline-block;\n font-size: 16px;\n border-radius: 4px;\n font-weight: 600;\n }\n .__xlork_error {\n padding: 8px;\n border: 1px dashed;\n color: red;\n background: #f00 8;\n }\n .__xlork_iframe_container {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background: rgba(0, 0, 0, 0.5);\n display: flex;\n justify-content: center;\n align-items: center;\n padding: 16px;\n box-sizing: border-box;\n overflow: hidden;\n flex-direction: column;\n backdrop-filter: blur(4px);\n min-height: 400px;\n z-index: 2147483647;\n }\n .__xlork_iframe_container iframe {\n width: 100%;\n height: 100%;\n position: relative;\n border-width: 0;\n overflow: hidden;\n z-index: 9999;\n }\n .__xlork_iframe_container .__xlork_loader {\n width: 100%;\n display: flex;\n justify-content: center;\n color: #fff;\n font-size: 18px;\n align-items: center;\n font-family: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;\n font-weight: 500;\n }\n .__xlork_iframe_container .__xlork_loader .loader_ripple {\n display: inline-block;\n position: relative;\n width: 80px;\n height: 80px;\n }\n .__xlork_iframe_container .__xlork_loader .loader_ripple div {\n position: absolute;\n border: 4px solid #fff;\n opacity: 1;\n border-radius: 50%;\n animation: loader_ripple 1s cubic-bezier(0, 0.2, 0.8, 1) infinite;\n }\n .__xlork_iframe_container .__xlork_loader .loader_ripple div:nth-child(2) {\n animation-delay: -0.5s;\n }\n .__xlork_iframe_container._inline {\n background: transparent;\n display: flex;\n height: 100%;\n width: 100%;\n justify-self: center;\n align-self: center;\n backdrop-filter: blur(4px);\n position: relative;\n }\n .__xlork_iframe_container._inline .__xlork_loader {\n color: #707070;\n }\n .__xlork_iframe_container._inline .__xlork_loader .loader_ripple div {\n border: 4px solid #707070;\n }\n @keyframes loader_ripple {\n 0% {\n top: 36px;\n left: 36px;\n width: 0;\n height: 0;\n opacity: 1;\n }\n 100% {\n top: 0px;\n left: 0px;\n width: 72px;\n height: 72px;\n opacity: 0;\n }\n }\n ',h=function(){l=j().mark(function e(t){return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:null!=t&&t.error&&null!=t&&t.message?(alert(null==t?void 0:t.message),e.next=10):e.next=4;break;case 4:if("complete"==document.readyState){e.next=9;break}e.next=7;var n=100;return new Promise(function(e){return setTimeout(e,n)});case 7:e.next=4;break;case 9:i(o,"__xlork_main_container");case 10:case"end":return e.stop()}},e)});var l,n=function(){var e=this,a=arguments;return new Promise(function(n,t){var r=l.apply(e,a);function o(e){_(r,n,t,o,i,"next",e)}function i(e){_(r,n,t,o,i,"throw",e)}o(void 0)})};return function(e){return n.apply(this,arguments)}}(),i=function(e,n){var t=document.getElementById(n),t=(t&&t.remove(),document.body||document.getElementsByTagName("body")[0]),r=document.createElement("div");r.id=n,r.innerHTML=e,t.appendChild(r)},y=function(e){var n=null==e?void 0:e.data;if("object"==m(n)&&(null==n?void 0:n.channel)==r)switch(null==n?void 0:n.type){case"[IFRAME LOADED]":var t={type:"[CONFIG INITILIZE]",channel:r,settings:l,licenseKey:c,user:u};window.frames.__xlork_iframe.postMessage(t,"*");try{document.getElementById("__xlork_loader").style.display="none",document.getElementById("__xlork_iframe").style.height="100%"}catch(e){console.log(e)}break;case"[onComplete]":f&&f(n.value);case"[onCancel]":a(),s&&s()}},a=function(){window.removeEventListener("message",y,!1);try{document.body.classList.remove("__xlork_modal_open");var e=document.getElementById("__xlork_main_container");e&&e.remove()}catch(e){console.log("__xlork_modal_open",e)}};this.init=function(){var e,n,t,r,o,i,a;e="__xlork_styles",(n=document.getElementById(e))&&n.remove(),(n=document.createElement("style")).textContent=p,n.id=e,n.type="text/css",document.head.appendChild(n),window.addEventListener("message",y,!1),n=(e={settings:l,licenseKey:c,user:u,embedURL:d,onComplete:f,onCancel:s}).settings,t=e.licenseKey,r=e.user,o=e.embedURL,i=e.onComplete,e=e.onCancel,a="",t?r?null!=r&&r.email?o?i&&"function"!=typeof i?a="[REQUIRED] onComplete should be function type.":e&&"function"!=typeof e?a="[REQUIRED] onCancel should be function type.":n?null!=n&&n.hasOwnProperty("columns")?0<!(null!=n&&null!=(t=n.columns)&&t.length)||null!=n&&null!=(r=n.columns)&&r.forEach(function(e){if(!e.label||!e.key)return!(a="[REQUIRED] each column should have label & key in 'columns'")}):a="[REQUIRED] should have required property 'columns'":a="[REQUIRED] setting not defined.":a="[REQUIRED] embedURL not defined.":a="[REQUIRED] email(unique) not defined.":a="[REQUIRED] user not defined.":a="[REQUIRED] A Valid licenseKey is required.",h({error:!!a,message:a})}}});
//# sourceMappingURL=xlork.min.js.map