New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@progfay/scrapbox-parser

Package Overview
Dependencies
Maintainers
1
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@progfay/scrapbox-parser - npm Package Compare versions

Comparing version 8.0.0 to 8.1.0

2

esm/block/node/IconNode.js

@@ -22,3 +22,3 @@ import { createNodeParser } from "./creator";

export const IconNodeParser = createNodeParser(createIconNode, {
parseOnNested: false,
parseOnNested: true,
parseOnQuoted: true,

@@ -25,0 +25,0 @@ patterns: [iconRegExp],

@@ -26,3 +26,3 @@ "use strict";

exports.IconNodeParser = (0, creator_1.createNodeParser)(createIconNode, {
parseOnNested: false,
parseOnNested: true,
parseOnQuoted: true,

@@ -29,0 +29,0 @@ patterns: [iconRegExp],

{
"name": "@progfay/scrapbox-parser",
"version": "8.0.0",
"version": "8.1.0",
"description": "parse Scrapbox notation to JavaScript Object",

@@ -53,22 +53,22 @@ "files": [

"devDependencies": {
"@babel/core": "7.18.5",
"@babel/preset-env": "7.18.2",
"@babel/core": "7.18.13",
"@babel/preset-env": "7.18.10",
"@types/core-js": "2.5.5",
"@types/jest": "28.1.2",
"@types/jest": "28.1.8",
"@types/node": "17.0.2",
"@typescript-eslint/eslint-plugin": "5.28.0",
"@typescript-eslint/parser": "5.28.0",
"@typescript-eslint/eslint-plugin": "5.35.1",
"@typescript-eslint/parser": "5.35.1",
"babel-loader": "8.2.5",
"cspell": "6.1.2",
"eslint": "8.18.0",
"cspell": "6.8.1",
"eslint": "8.23.0",
"eslint-config-prettier": "8.5.0",
"eslint-plugin-jest": "26.5.3",
"jest": "28.1.1",
"jest-snapshot": "28.1.1",
"eslint-plugin-jest": "27.0.0",
"jest": "28.1.3",
"jest-snapshot": "28.1.3",
"npm-run-all": "4.1.5",
"prettier": "2.7.1",
"ts-jest": "28.0.5",
"ts-loader": "9.3.0",
"typescript": "4.7.4",
"webpack": "5.73.0",
"ts-jest": "28.0.8",
"ts-loader": "9.3.1",
"typescript": "4.8.2",
"webpack": "5.74.0",
"webpack-cli": "4.10.0"

@@ -75,0 +75,0 @@ },

@@ -1,1 +0,1 @@

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ScrapboxParser=e():t.ScrapboxParser=e()}(self,(()=>(()=>{"use strict";var t={d:(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function r(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function n(t){return function(t){if(Array.isArray(t))return a(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||o(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(t,e){if(t){if("string"==typeof t)return a(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?a(t,e):void 0}}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}t.r(e),t.d(e,{convertToBlock:()=>Z,getTitle:()=>V,packRows:()=>J,parse:()=>K,parseToRows:()=>L});var i=function(t,e){var r=e.parseOnNested,a=e.parseOnQuoted,i=e.patterns;return function(e,u,s){var c,l,p,f,d,b;if(!r&&u.nested)return null!==(c=null==s?void 0:s())&&void 0!==c?c:[];if(!a&&u.quoted)return null!==(l=null==s?void 0:s())&&void 0!==l?l:[];var y,g=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=o(t))){r&&(t=r);var n=0,a=function(){};return{s:a,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return u=t.done,t},e:function(t){s=!0,i=t},f:function(){try{u||null==r.return||r.return()}finally{if(s)throw i}}}}(i);try{for(g.s();!(y=g.n()).done;){var v=y.value.exec(e);if(null!==v){var m=e.substring(0,v.index),h=e.substring(v.index+(null!==(f=null===(p=v[0])||void 0===p?void 0:p.length)&&void 0!==f?f:0)),O=t(null!==(d=v[0])&&void 0!==d?d:"",u);return[].concat(n(B(m,u)),n(O),n(B(h,u)))}}}catch(t){g.e(t)}finally{g.f()}return null!==(b=null==s?void 0:s())&&void 0!==b?b:[]}},u=function(t){return[{type:"plain",raw:t,text:t}]},s=i(u,{parseOnNested:!0,parseOnQuoted:!0,patterns:[/^()(.*)()$/]});function c(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function l(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?c(Object(r),!0).forEach((function(e){p(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):c(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function p(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var f=i((function(t,e){return"table"===e.context?u(t):[{type:"quote",raw:t,nodes:B(t.substring(1),l(l({},e),{},{quoted:!0}))}]}),{parseOnNested:!1,parseOnQuoted:!1,patterns:[/^>.*$/]}),d=i((function(t,e){return"table"===e.context?u(t):[{type:"helpfeel",raw:t,text:t.substring(2)}]}),{parseOnNested:!1,parseOnQuoted:!1,patterns:[/^\? .+$/]}),b=i((function(t,e){if("table"===e.context)return u(t);var r=t.substring(2,t.length-2);return[{type:"strongImage",raw:t,src:/^https?:\/\/([0-9a-z-]\.)?gyazo\.com\/[0-9a-f]{32}$/.test(r)?"".concat(r,"/thumb/1000"):r}]}),{parseOnNested:!1,parseOnQuoted:!0,patterns:[/\[\[https?:\/\/[^\s\]]+\.(?:png|jpe?g|gif|svg)\]\]/i,/\[\[https?:\/\/(?:[0-9a-z-]+\.)?gyazo\.com\/[0-9a-f]{32}\]\]/]});function y(t){return function(e,r){if("strongIcon"===t&&"table"===r.context)return u(e);var n="icon"===t?e.substring(1,e.length-1):e.substring(2,e.length-2),o=n.lastIndexOf(".icon"),a=n.substring(0,o),i=a.startsWith("/")?"root":"relative",s=n.substring(o+5,n.length),c=s.startsWith("*")?parseInt(s.substring(1),10):1;return new Array(c).fill({}).map((function(){return{path:a,pathType:i,type:t,raw:e}}))}}var g=i(y("icon"),{parseOnNested:!1,parseOnQuoted:!0,patterns:[/\[[^[\]]*\.icon(?:\*[1-9]\d*)?\]/]}),v=i(y("strongIcon"),{parseOnNested:!1,parseOnQuoted:!0,patterns:[/\[\[[^[\]]*\.icon(?:\*\d+)?\]\]/]});function m(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function h(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?m(Object(r),!0).forEach((function(e){O(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):m(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function O(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var w=i((function(t,e){return"table"===e.context?u(t):[{type:"strong",raw:t,nodes:B(t.substring(2,t.length-2),h(h({},e),{},{nested:!0}))}]}),{parseOnNested:!1,parseOnQuoted:!0,patterns:[/\[\[(?:[^[]|\[[^[]).*?\]*\]\]/]}),j=i((function(t,e){return"table"===e.context?u(t):[{type:"formula",raw:t,formula:t.substring(3,t.length-(t.endsWith(" ]")?2:1))}]}),{parseOnNested:!1,parseOnQuoted:!0,patterns:[/\[\$ .+? \]/,/\[\$ [^\]]+\]/]});function S(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function A(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?S(Object(r),!0).forEach((function(e){x(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):S(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function x(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var P=i((function(t,e){if("table"===e.context)return u(t);var r=t.indexOf(" "),n=t.substring(1,r),o=t.substring(r+1,t.length-1),a=new Set(n);if(a.has("*")){var i=n.split("*").length-1;a.delete("*"),a.add("*-".concat(Math.min(i,10)))}return[{type:"decoration",raw:t,rawDecos:n,decos:Array.from(a),nodes:B(o,A(A({},e),{},{nested:!0}))}]}),{parseOnNested:!1,parseOnQuoted:!0,patterns:[/\[[!"#%&'()*+,\-./{|}<>_~]+ (?:\[[^[\]]+\]|[^\]])+\]/]}),I=i((function(t,e){return"table"===e.context?u(t):[{type:"code",raw:t,text:t.substring(1,t.length-1)}]}),{parseOnNested:!1,parseOnQuoted:!0,patterns:[/`.*?`/]}),N=i((function(t,e){var r;if("table"===e.context)return u(t);var n=null!==(r=t[0])&&void 0!==r?r:"",o=t.substring(2);return[{type:"commandLine",raw:t,symbol:n,text:o}]}),{parseOnNested:!1,parseOnQuoted:!1,patterns:[/^[$%] .+$/]}),T=i((function(t,e){return"table"===e.context?u(t):[{type:"blank",raw:t,text:t.substring(1,t.length-1)}]}),{parseOnNested:!1,parseOnQuoted:!0,patterns:[/\[\s+\]/]});function $(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var E=i((function(t,e){if("table"===e.context)return u(t);var r,n,o,a=t.search(/\s/),i=-1!==a?t.substring(1,a):t.substring(1,t.length-1),s=-1!==a?t.substring(a,t.length-1).trimLeft():"",c=(n=/^https?:\/\/[^\s\]]+\.(png|jpe?g|gif|svg)(\?[^\]\s]+)?$/i.test(r=s)||function(t){return/^https?:\/\/([0-9a-z-]\.)?gyazo\.com\/[0-9a-f]{32}(\/raw)?$/.test(t)}(r)?[s,i]:[i,s],o=2,function(t){if(Array.isArray(t))return t}(n)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,a=[],i=!0,u=!1;try{for(r=r.call(t);!(i=(n=r.next()).done)&&(a.push(n.value),!e||a.length!==e);i=!0);}catch(t){u=!0,o=t}finally{try{i||null==r.return||r.return()}finally{if(u)throw o}}return a}}(n,o)||function(t,e){if(t){if("string"==typeof t)return $(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?$(t,e):void 0}}(n,o)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),l=c[0],p=c[1];return[{type:"image",raw:t,src:/^https?:\/\/([0-9a-z-]\.)?gyazo\.com\/[0-9a-f]{32}$/.test(l)?"".concat(l,"/thumb/1000"):l,link:p}]}),{parseOnNested:!0,parseOnQuoted:!0,patterns:[/\[https?:\/\/[^\s\]]+\.(?:png|jpe?g|gif|svg)(?:\?[^\]\s]+)?(?:\s+https?:\/\/[^\s\]]+)?\]/i,/\[https?:\/\/[^\s\]]+\s+https?:\/\/[^\s\]]+\.(?:png|jpe?g|gif|svg)(?:\?[^\]\s]+)?\]/i,/\[https?:\/\/(?:[0-9a-z-]+\.)?gyazo\.com\/[0-9a-f]{32}(?:\/raw)?(?:\s+https?:\/\/[^\s\]]+)?\]/,/\[https?:\/\/[^\s\]]+\s+https?:\/\/(?:[0-9a-z-]+\.)?gyazo\.com\/[0-9a-f]{32}(?:\/raw)?\]/]}),Q=i((function(t,e){if("table"===e.context)return u(t);var r=t.startsWith("[")&&t.endsWith("]")?t.substring(1,t.length-1):t,n=/^https?:\/\/[^\s\]]/.test(r),o=(n?/^https?:\/\/[^\s\]]+/:/https?:\/\/[^\s\]]+$/).exec(r);if(void 0===(null==o?void 0:o[0]))return[];var a=n?r.substring(o[0].length):r.substring(0,o.index-1);return[{type:"link",raw:t,pathType:"absolute",href:o[0],content:a.trim()}]}),{parseOnNested:!0,parseOnQuoted:!0,patterns:[/\[https?:\/\/[^\s\]]+\s+[^\]]*[^\s]\]/,/\[[^[\]]*[^\s]\s+https?:\/\/[^\s\]]+\]/,/\[https?:\/\/[^\s\]]+\]/,/https?:\/\/[^\s]+/]});function z(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,a=[],i=!0,u=!1;try{for(r=r.call(t);!(i=(n=r.next()).done)&&(a.push(n.value),!e||a.length!==e);i=!0);}catch(t){u=!0,o=t}finally{try{i||null==r.return||r.return()}finally{if(u)throw o}}return a}}(t,e)||function(t,e){if(t){if("string"==typeof t)return D(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?D(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function D(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var k=/\[([^\]]*[^\s])\s+([NS]\d+(?:\.\d+)?,[EW]\d+(?:\.\d+)?(?:,Z\d+)?)\]/,W=/\[([NS]\d+(?:\.\d+)?,[EW]\d+(?:\.\d+)?(?:,Z\d+)?)(?:\s+([^\]]*[^\s]))?\]/;function M(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function U(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function C(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?U(Object(r),!0).forEach((function(e){q(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):U(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function q(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var B=function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return function(t,r){return e.reduceRight((function(e,n){return function(){return n(t,r,e)}}),(function(){return s(t,r)}))()}}((function(t,e,r){var n;return""===t?[]:null!==(n=null==r?void 0:r())&&void 0!==n?n:[]}),f,d,I,N,j,T,P,b,v,w,E,Q,g,i((function(t,e){var r;if("table"===e.context)return u(t);var n=null!==(r=t.match(k))&&void 0!==r?r:t.match(W);if(null===n)return[];var o,a,i,s,c,l,p,f=z(t.startsWith("[N")||t.startsWith("[S")?n:[n[0],n[2],n[1]],3),d=f[1],b=void 0===d?"":d,y=f[2],g=void 0===y?"":y,v=(i=void 0===(a=(o=z(b.split(","),3))[0])?"":a,c=void 0===(s=o[1])?"":s,p=void 0===(l=o[2])?"":l,{latitude:parseFloat(i.replace(/^N/,"").replace(/^S/,"-")),longitude:parseFloat(c.replace(/^E/,"").replace(/^W/,"-")),zoom:/^Z\d+$/.test(p)?parseInt(p.replace(/^Z/,""),10):14}),m=v.latitude,h=v.longitude,O=v.zoom;return[{type:"googleMap",raw:t,latitude:m,longitude:h,zoom:O,place:g,url:""!==g?"https://www.google.com/maps/place/".concat(encodeURIComponent(g),"/@").concat(m,",").concat(h,",").concat(O,"z"):"https://www.google.com/maps/@".concat(m,",").concat(h,",").concat(O,"z")}]}),{parseOnNested:!1,parseOnQuoted:!0,patterns:[k,W]}),i((function(t){var e=t.substring(1,t.length-1);return[{type:"link",raw:t,pathType:e.startsWith("/")?"root":"relative",href:e,content:""}]}),{parseOnNested:!0,parseOnQuoted:!0,patterns:[/\[\/?[^[\]]+\]/]}),i((function(t,e){if("table"===e.context)return u(t);if(t.startsWith("#"))return[{type:"hashTag",raw:t,href:t.substring(1)}];var r,n=t.substring(0,1),o=t.substring(1);return[].concat(function(t){if(Array.isArray(t))return M(t)}(r=u(n))||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(r)||function(t,e){if(t){if("string"==typeof t)return M(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?M(t,e):void 0}}(r)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),[{type:"hashTag",raw:o,href:o.substring(1)}])}),{parseOnNested:!0,parseOnQuoted:!0,patterns:[/(?:^|\s)#\S+/]}),i((function(t,e){if("table"===e.context)return u(t);var r=t.indexOf(" "),n=t.substring(0,r-1),o=parseInt(n,10),a=t.substring(r+1,t.length);return[{type:"numberList",raw:t,rawNumber:n,number:o,nodes:B(a,C(C({},e),{},{nested:!0}))}]}),{parseOnNested:!1,parseOnQuoted:!1,patterns:[/^[0-9]+\. .*$/]}));function R(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var Z=function(t){switch(t.type){case"title":return function(t){return{type:"title",text:t.rows[0].text}}(t);case"codeBlock":return function(t){var e,n=function(t){if(Array.isArray(t))return t}(e=t.rows)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(e)||function(t,e){if(t){if("string"==typeof t)return r(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(t,e):void 0}}(e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),o=n[0],a=n.slice(1),i=null!=o?o:{},u=i.indent,s=void 0===u?0:u,c=i.text,l=(void 0===c?"":c).replace(/^\s*code:/,"");return{indent:s,type:"codeBlock",fileName:l,content:a.map((function(t){return t.text.substring(s+1)})).join("\n")}}(t);case"table":return function(t){var e,r=function(t){if(Array.isArray(t))return t}(e=t.rows)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(e)||function(t,e){if(t){if("string"==typeof t)return R(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?R(t,e):void 0}}(e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),n=r[0],o=r.slice(1),a=null!=n?n:{},i=a.indent,u=void 0===i?0:i,s=a.text,c=(void 0===s?"":s).replace(/^\s*table:/,"");return{indent:u,type:"table",fileName:c,cells:o.map((function(t){return t.text.substring(u+1)})).map((function(t){return t.split("\t").map((function(t){return B(t,{nested:!1,quoted:!1,context:"table"})}))}))}}(t);case"line":return function(t){var e=t.rows[0],r=e.indent,n=e.text;return{indent:r,type:"line",nodes:B(n.substring(r),{nested:!1,quoted:!1,context:"line"})}}(t)}},L=function(t){return t.split("\n").map((function(t){var e,r,n;return{indent:null!==(n=null===(r=null===(e=/^\s+/.exec(t))||void 0===e?void 0:e[0])||void 0===r?void 0:r.length)&&void 0!==n?n:0,text:t}}))};function _(t,e){if(t){if("string"==typeof t)return F(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?F(t,e):void 0}}function F(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function G(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}var H=function(t,e){var r=t[t.length-1];return void 0!==r&&function(t,e){var r,n;return("codeBlock"===t.type||"table"===t.type)&&e.indent>(null!==(n=null===(r=t.rows[0])||void 0===r?void 0:r.indent)&&void 0!==n?n:0)}(r,e)?(r.rows.push(e),t):(t.push({type:/^\s*code:/.test(e.text)?"codeBlock":/^\s*table:/.test(e.text)?"table":"line",rows:[e]}),t)},J=function(t,e){var r,n;if(null===(r=e.hasTitle)||void 0===r||r){var o=function(t){if(Array.isArray(t))return t}(n=t)||G(n)||_(n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),a=o[0],i=o.slice(1);return void 0===a?[]:[{type:"title",rows:[a]}].concat(function(t){return function(t){if(Array.isArray(t))return F(t)}(t)||G(t)||_(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(i.reduce(H,[])))}return t.reduce(H,[])},K=function(t,e){var r,n=L(t);return J(n,{hasTitle:null===(r=null==e?void 0:e.hasTitle)||void 0===r||r}).map(Z)},V=function(t){var e,r,n=/^\s*\S.*$/m.exec(t);return null!==(r=null===(e=null==n?void 0:n[0])||void 0===e?void 0:e.trim())&&void 0!==r?r:"Untitled"};return e})()));
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ScrapboxParser=e():t.ScrapboxParser=e()}(self,(()=>(()=>{"use strict";var t={d:(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function r(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function n(t){return function(t){if(Array.isArray(t))return a(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||o(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(t,e){if(t){if("string"==typeof t)return a(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?a(t,e):void 0}}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}t.r(e),t.d(e,{convertToBlock:()=>Z,getTitle:()=>V,packRows:()=>J,parse:()=>K,parseToRows:()=>L});var i=function(t,e){var r=e.parseOnNested,a=e.parseOnQuoted,i=e.patterns;return function(e,u,s){var c,l,p,f,d,b;if(!r&&u.nested)return null!==(c=null==s?void 0:s())&&void 0!==c?c:[];if(!a&&u.quoted)return null!==(l=null==s?void 0:s())&&void 0!==l?l:[];var y,g=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=o(t))){r&&(t=r);var n=0,a=function(){};return{s:a,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return u=t.done,t},e:function(t){s=!0,i=t},f:function(){try{u||null==r.return||r.return()}finally{if(s)throw i}}}}(i);try{for(g.s();!(y=g.n()).done;){var v=y.value.exec(e);if(null!==v){var m=e.substring(0,v.index),h=e.substring(v.index+(null!==(f=null===(p=v[0])||void 0===p?void 0:p.length)&&void 0!==f?f:0)),O=t(null!==(d=v[0])&&void 0!==d?d:"",u);return[].concat(n(B(m,u)),n(O),n(B(h,u)))}}}catch(t){g.e(t)}finally{g.f()}return null!==(b=null==s?void 0:s())&&void 0!==b?b:[]}},u=function(t){return[{type:"plain",raw:t,text:t}]},s=i(u,{parseOnNested:!0,parseOnQuoted:!0,patterns:[/^()(.*)()$/]});function c(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function l(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?c(Object(r),!0).forEach((function(e){p(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):c(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function p(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var f=i((function(t,e){return"table"===e.context?u(t):[{type:"quote",raw:t,nodes:B(t.substring(1),l(l({},e),{},{quoted:!0}))}]}),{parseOnNested:!1,parseOnQuoted:!1,patterns:[/^>.*$/]}),d=i((function(t,e){return"table"===e.context?u(t):[{type:"helpfeel",raw:t,text:t.substring(2)}]}),{parseOnNested:!1,parseOnQuoted:!1,patterns:[/^\? .+$/]}),b=i((function(t,e){if("table"===e.context)return u(t);var r=t.substring(2,t.length-2);return[{type:"strongImage",raw:t,src:/^https?:\/\/([0-9a-z-]\.)?gyazo\.com\/[0-9a-f]{32}$/.test(r)?"".concat(r,"/thumb/1000"):r}]}),{parseOnNested:!1,parseOnQuoted:!0,patterns:[/\[\[https?:\/\/[^\s\]]+\.(?:png|jpe?g|gif|svg)\]\]/i,/\[\[https?:\/\/(?:[0-9a-z-]+\.)?gyazo\.com\/[0-9a-f]{32}\]\]/]});function y(t){return function(e,r){if("strongIcon"===t&&"table"===r.context)return u(e);var n="icon"===t?e.substring(1,e.length-1):e.substring(2,e.length-2),o=n.lastIndexOf(".icon"),a=n.substring(0,o),i=a.startsWith("/")?"root":"relative",s=n.substring(o+5,n.length),c=s.startsWith("*")?parseInt(s.substring(1),10):1;return new Array(c).fill({}).map((function(){return{path:a,pathType:i,type:t,raw:e}}))}}var g=i(y("icon"),{parseOnNested:!0,parseOnQuoted:!0,patterns:[/\[[^[\]]*\.icon(?:\*[1-9]\d*)?\]/]}),v=i(y("strongIcon"),{parseOnNested:!1,parseOnQuoted:!0,patterns:[/\[\[[^[\]]*\.icon(?:\*\d+)?\]\]/]});function m(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function h(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?m(Object(r),!0).forEach((function(e){O(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):m(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function O(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var w=i((function(t,e){return"table"===e.context?u(t):[{type:"strong",raw:t,nodes:B(t.substring(2,t.length-2),h(h({},e),{},{nested:!0}))}]}),{parseOnNested:!1,parseOnQuoted:!0,patterns:[/\[\[(?:[^[]|\[[^[]).*?\]*\]\]/]}),j=i((function(t,e){return"table"===e.context?u(t):[{type:"formula",raw:t,formula:t.substring(3,t.length-(t.endsWith(" ]")?2:1))}]}),{parseOnNested:!1,parseOnQuoted:!0,patterns:[/\[\$ .+? \]/,/\[\$ [^\]]+\]/]});function S(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function A(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?S(Object(r),!0).forEach((function(e){x(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):S(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function x(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var P=i((function(t,e){if("table"===e.context)return u(t);var r=t.indexOf(" "),n=t.substring(1,r),o=t.substring(r+1,t.length-1),a=new Set(n);if(a.has("*")){var i=n.split("*").length-1;a.delete("*"),a.add("*-".concat(Math.min(i,10)))}return[{type:"decoration",raw:t,rawDecos:n,decos:Array.from(a),nodes:B(o,A(A({},e),{},{nested:!0}))}]}),{parseOnNested:!1,parseOnQuoted:!0,patterns:[/\[[!"#%&'()*+,\-./{|}<>_~]+ (?:\[[^[\]]+\]|[^\]])+\]/]}),I=i((function(t,e){return"table"===e.context?u(t):[{type:"code",raw:t,text:t.substring(1,t.length-1)}]}),{parseOnNested:!1,parseOnQuoted:!0,patterns:[/`.*?`/]}),N=i((function(t,e){var r;if("table"===e.context)return u(t);var n=null!==(r=t[0])&&void 0!==r?r:"",o=t.substring(2);return[{type:"commandLine",raw:t,symbol:n,text:o}]}),{parseOnNested:!1,parseOnQuoted:!1,patterns:[/^[$%] .+$/]}),T=i((function(t,e){return"table"===e.context?u(t):[{type:"blank",raw:t,text:t.substring(1,t.length-1)}]}),{parseOnNested:!1,parseOnQuoted:!0,patterns:[/\[\s+\]/]});function $(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var E=i((function(t,e){if("table"===e.context)return u(t);var r,n,o,a=t.search(/\s/),i=-1!==a?t.substring(1,a):t.substring(1,t.length-1),s=-1!==a?t.substring(a,t.length-1).trimLeft():"",c=(n=/^https?:\/\/[^\s\]]+\.(png|jpe?g|gif|svg)(\?[^\]\s]+)?$/i.test(r=s)||function(t){return/^https?:\/\/([0-9a-z-]\.)?gyazo\.com\/[0-9a-f]{32}(\/raw)?$/.test(t)}(r)?[s,i]:[i,s],o=2,function(t){if(Array.isArray(t))return t}(n)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,a=[],i=!0,u=!1;try{for(r=r.call(t);!(i=(n=r.next()).done)&&(a.push(n.value),!e||a.length!==e);i=!0);}catch(t){u=!0,o=t}finally{try{i||null==r.return||r.return()}finally{if(u)throw o}}return a}}(n,o)||function(t,e){if(t){if("string"==typeof t)return $(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?$(t,e):void 0}}(n,o)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),l=c[0],p=c[1];return[{type:"image",raw:t,src:/^https?:\/\/([0-9a-z-]\.)?gyazo\.com\/[0-9a-f]{32}$/.test(l)?"".concat(l,"/thumb/1000"):l,link:p}]}),{parseOnNested:!0,parseOnQuoted:!0,patterns:[/\[https?:\/\/[^\s\]]+\.(?:png|jpe?g|gif|svg)(?:\?[^\]\s]+)?(?:\s+https?:\/\/[^\s\]]+)?\]/i,/\[https?:\/\/[^\s\]]+\s+https?:\/\/[^\s\]]+\.(?:png|jpe?g|gif|svg)(?:\?[^\]\s]+)?\]/i,/\[https?:\/\/(?:[0-9a-z-]+\.)?gyazo\.com\/[0-9a-f]{32}(?:\/raw)?(?:\s+https?:\/\/[^\s\]]+)?\]/,/\[https?:\/\/[^\s\]]+\s+https?:\/\/(?:[0-9a-z-]+\.)?gyazo\.com\/[0-9a-f]{32}(?:\/raw)?\]/]}),Q=i((function(t,e){if("table"===e.context)return u(t);var r=t.startsWith("[")&&t.endsWith("]")?t.substring(1,t.length-1):t,n=/^https?:\/\/[^\s\]]/.test(r),o=(n?/^https?:\/\/[^\s\]]+/:/https?:\/\/[^\s\]]+$/).exec(r);if(void 0===(null==o?void 0:o[0]))return[];var a=n?r.substring(o[0].length):r.substring(0,o.index-1);return[{type:"link",raw:t,pathType:"absolute",href:o[0],content:a.trim()}]}),{parseOnNested:!0,parseOnQuoted:!0,patterns:[/\[https?:\/\/[^\s\]]+\s+[^\]]*[^\s]\]/,/\[[^[\]]*[^\s]\s+https?:\/\/[^\s\]]+\]/,/\[https?:\/\/[^\s\]]+\]/,/https?:\/\/[^\s]+/]});function z(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,a=[],i=!0,u=!1;try{for(r=r.call(t);!(i=(n=r.next()).done)&&(a.push(n.value),!e||a.length!==e);i=!0);}catch(t){u=!0,o=t}finally{try{i||null==r.return||r.return()}finally{if(u)throw o}}return a}}(t,e)||function(t,e){if(t){if("string"==typeof t)return D(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?D(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function D(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var k=/\[([^\]]*[^\s])\s+([NS]\d+(?:\.\d+)?,[EW]\d+(?:\.\d+)?(?:,Z\d+)?)\]/,W=/\[([NS]\d+(?:\.\d+)?,[EW]\d+(?:\.\d+)?(?:,Z\d+)?)(?:\s+([^\]]*[^\s]))?\]/;function M(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function U(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function C(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?U(Object(r),!0).forEach((function(e){q(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):U(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function q(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var B=function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return function(t,r){return e.reduceRight((function(e,n){return function(){return n(t,r,e)}}),(function(){return s(t,r)}))()}}((function(t,e,r){var n;return""===t?[]:null!==(n=null==r?void 0:r())&&void 0!==n?n:[]}),f,d,I,N,j,T,P,b,v,w,E,Q,g,i((function(t,e){var r;if("table"===e.context)return u(t);var n=null!==(r=t.match(k))&&void 0!==r?r:t.match(W);if(null===n)return[];var o,a,i,s,c,l,p,f=z(t.startsWith("[N")||t.startsWith("[S")?n:[n[0],n[2],n[1]],3),d=f[1],b=void 0===d?"":d,y=f[2],g=void 0===y?"":y,v=(i=void 0===(a=(o=z(b.split(","),3))[0])?"":a,c=void 0===(s=o[1])?"":s,p=void 0===(l=o[2])?"":l,{latitude:parseFloat(i.replace(/^N/,"").replace(/^S/,"-")),longitude:parseFloat(c.replace(/^E/,"").replace(/^W/,"-")),zoom:/^Z\d+$/.test(p)?parseInt(p.replace(/^Z/,""),10):14}),m=v.latitude,h=v.longitude,O=v.zoom;return[{type:"googleMap",raw:t,latitude:m,longitude:h,zoom:O,place:g,url:""!==g?"https://www.google.com/maps/place/".concat(encodeURIComponent(g),"/@").concat(m,",").concat(h,",").concat(O,"z"):"https://www.google.com/maps/@".concat(m,",").concat(h,",").concat(O,"z")}]}),{parseOnNested:!1,parseOnQuoted:!0,patterns:[k,W]}),i((function(t){var e=t.substring(1,t.length-1);return[{type:"link",raw:t,pathType:e.startsWith("/")?"root":"relative",href:e,content:""}]}),{parseOnNested:!0,parseOnQuoted:!0,patterns:[/\[\/?[^[\]]+\]/]}),i((function(t,e){if("table"===e.context)return u(t);if(t.startsWith("#"))return[{type:"hashTag",raw:t,href:t.substring(1)}];var r,n=t.substring(0,1),o=t.substring(1);return[].concat(function(t){if(Array.isArray(t))return M(t)}(r=u(n))||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(r)||function(t,e){if(t){if("string"==typeof t)return M(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?M(t,e):void 0}}(r)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),[{type:"hashTag",raw:o,href:o.substring(1)}])}),{parseOnNested:!0,parseOnQuoted:!0,patterns:[/(?:^|\s)#\S+/]}),i((function(t,e){if("table"===e.context)return u(t);var r=t.indexOf(" "),n=t.substring(0,r-1),o=parseInt(n,10),a=t.substring(r+1,t.length);return[{type:"numberList",raw:t,rawNumber:n,number:o,nodes:B(a,C(C({},e),{},{nested:!0}))}]}),{parseOnNested:!1,parseOnQuoted:!1,patterns:[/^[0-9]+\. .*$/]}));function R(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var Z=function(t){switch(t.type){case"title":return function(t){return{type:"title",text:t.rows[0].text}}(t);case"codeBlock":return function(t){var e,n=function(t){if(Array.isArray(t))return t}(e=t.rows)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(e)||function(t,e){if(t){if("string"==typeof t)return r(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(t,e):void 0}}(e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),o=n[0],a=n.slice(1),i=null!=o?o:{},u=i.indent,s=void 0===u?0:u,c=i.text,l=(void 0===c?"":c).replace(/^\s*code:/,"");return{indent:s,type:"codeBlock",fileName:l,content:a.map((function(t){return t.text.substring(s+1)})).join("\n")}}(t);case"table":return function(t){var e,r=function(t){if(Array.isArray(t))return t}(e=t.rows)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(e)||function(t,e){if(t){if("string"==typeof t)return R(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?R(t,e):void 0}}(e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),n=r[0],o=r.slice(1),a=null!=n?n:{},i=a.indent,u=void 0===i?0:i,s=a.text,c=(void 0===s?"":s).replace(/^\s*table:/,"");return{indent:u,type:"table",fileName:c,cells:o.map((function(t){return t.text.substring(u+1)})).map((function(t){return t.split("\t").map((function(t){return B(t,{nested:!1,quoted:!1,context:"table"})}))}))}}(t);case"line":return function(t){var e=t.rows[0],r=e.indent,n=e.text;return{indent:r,type:"line",nodes:B(n.substring(r),{nested:!1,quoted:!1,context:"line"})}}(t)}},L=function(t){return t.split("\n").map((function(t){var e,r,n;return{indent:null!==(n=null===(r=null===(e=/^\s+/.exec(t))||void 0===e?void 0:e[0])||void 0===r?void 0:r.length)&&void 0!==n?n:0,text:t}}))};function _(t,e){if(t){if("string"==typeof t)return F(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?F(t,e):void 0}}function F(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function G(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}var H=function(t,e){var r=t[t.length-1];return void 0!==r&&function(t,e){var r,n;return("codeBlock"===t.type||"table"===t.type)&&e.indent>(null!==(n=null===(r=t.rows[0])||void 0===r?void 0:r.indent)&&void 0!==n?n:0)}(r,e)?(r.rows.push(e),t):(t.push({type:/^\s*code:/.test(e.text)?"codeBlock":/^\s*table:/.test(e.text)?"table":"line",rows:[e]}),t)},J=function(t,e){var r,n;if(null===(r=e.hasTitle)||void 0===r||r){var o=function(t){if(Array.isArray(t))return t}(n=t)||G(n)||_(n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),a=o[0],i=o.slice(1);return void 0===a?[]:[{type:"title",rows:[a]}].concat(function(t){return function(t){if(Array.isArray(t))return F(t)}(t)||G(t)||_(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(i.reduce(H,[])))}return t.reduce(H,[])},K=function(t,e){var r,n=L(t);return J(n,{hasTitle:null===(r=null==e?void 0:e.hasTitle)||void 0===r||r}).map(Z)},V=function(t){var e,r,n=/^\s*\S.*$/m.exec(t);return null!==(r=null===(e=null==n?void 0:n[0])||void 0===e?void 0:e.trim())&&void 0!==r?r:"Untitled"};return e})()));

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc