UNPKG

3.3 kBJavaScriptView Raw
1module.exports=function(t){var n={};function r(e){if(n[e])return n[e].exports;var o=n[e]={i:e,l:!1,exports:{}};return t[e].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=n,r.d=function(t,n,e){r.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:e})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,n){if(1&n&&(t=r(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var e=Object.create(null);if(r.r(e),Object.defineProperty(e,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var o in t)r.d(e,o,function(n){return t[n]}.bind(null,o));return e},r.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(n,"a",n),n},r.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},r.p="",r(r.s=52)}({52:function(t,n,r){"use strict";r.r(n);var e=function(t){return t.blocks.map(function(t){return t.text}).join("\n\n")},o=r(8),a=function(t){return t.blocks.map(function(t){return"".concat(t.data.speaker," \t [").concat(Object(o.shortTimecode)(t.data.start),"] \t ").concat(t.text)}).join("\n\n")},c=function(t){var n={words:[],paragraphs:[]};return t.blocks.forEach(function(t,r){if(void 0!==t.data.words){var e={id:r,start:t.data.words[0].start,end:t.data.words[t.data.words.length-1].end,speaker:t.data.speaker};n.paragraphs.push(e);var o=t.data.words.map(function(t){var n={id:t.index,start:t.start,end:t.end,text:null};return t.text?n.text=t.punct:t.punct?n.text=t.punct:t.word&&(n.text=t.punct),n});n.words=n.words.concat(o)}}),n};n.default=function(t,n){switch(n){case"draftjs":return{data:t,ext:"json"};case"txt":return{data:e(t),ext:"txt"};case"txtspeakertimecodes":return{data:a(t),ext:"txt"};case"digitalpaperedit":return{data:c(t),ext:"json"};default:console.error("Did not recognise the export format")}}},8:function(t,n,r){"use strict";r.r(n);var e=function(t,n){function r(t){return 10>t?"0".concat(parseInt(t)):parseInt(t)}var e=25;void 0!==n&&(e=n);var o=function(t,n){return+(1/n*Math.floor(+(n*t).toPrecision(12))).toFixed(2)}(t,e),a=Math.floor(o),c=((o-a)*e).toFixed(2);return"".concat(r(a/60/60%60),":").concat(r(a/60%60),":").concat(r(a%60),":").concat(r(c))},o=function(t,n){var r=25;return void 0!==n&&(r=n),+(+function(t,n){var r=t.split(":"),e=parseInt(r[3]);return e+=parseInt(r[2])*n,e+=parseInt(r[1])*(60*n),e+=parseInt(r[0])*(60*n*60)}(t,r)/r).toFixed(2)},a=function(t){return 1===t.length},c=function(t){if("string"!=typeof t)return t;switch(t.split(":").length){case 4:return t;case 2:return a(t.split(":")[0])?"00:0".concat(t,":00"):"00:".concat(t,":00");case 3:return"".concat(t,":00");default:return function(t){return t.includes(".")}(t)?a(t.split(".")[0])?"00:0".concat(t.split(".")[0],":").concat(t.split(".")[1],":00"):"00:".concat(t.replace(".",":"),":00"):a(t)?"00:00:0".concat(t,":00"):"00:00:".concat(t,":00")}};r.d(n,"timecodeToSeconds",function(){return u}),r.d(n,"shortTimecode",function(){return i}),r.d(n,"secondsToTimecode",function(){return e});var u=function(t){if("string"==typeof t){var n=c(t);return o(n)}return parseFloat(t)},i=function(t){return e(t).slice(0,-3)}}});
2//# sourceMappingURL=exportAdapter.js.map
\No newline at end of file