UNPKG

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