Socket
Socket
Sign inDemoInstall

@sanity/block-content-to-html

Package Overview
Dependencies
Maintainers
7
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sanity/block-content-to-html - npm Package Compare versions

Comparing version 1.3.5 to 1.3.6

16

package.json
{
"name": "@sanity/block-content-to-html",
"description": "Function for transforming Sanity block content to HTML",
"version": "1.3.5",
"version": "1.3.6",
"main": "lib/blocksToHtml.js",

@@ -25,3 +25,3 @@ "umd": "umd/blocksToHtml.min.js",

"dependencies": {
"@sanity/block-content-to-hyperscript": "^1.2.8"
"@sanity/block-content-to-hyperscript": "^1.3.3"
},

@@ -31,14 +31,14 @@ "devDependencies": {

"babel-cli": "^6.26.0",
"babel-eslint": "^8.1.2",
"babel-preset-env": "^1.6.0",
"babel-eslint": "^8.2.3",
"babel-preset-env": "^1.7.0",
"browserify": "^14.4.0",
"envify": "^4.1.0",
"eslint": "^4.14.0",
"eslint": "^4.19.1",
"eslint-config-prettier": "^2.4.0",
"eslint-config-sanity": "^3.0.1",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-import": "^2.12.0",
"jest": "^22.0.4",
"prettier": "^1.7.0",
"prettier": "^1.13.2",
"rimraf": "^2.6.2",
"uglify-js": "^3.3.4",
"uglify-js": "^3.3.28",
"uglifyify": "^4.0.3"

@@ -45,0 +45,0 @@ },

@@ -5,5 +5,5 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.blocksToHtml = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){

},{"@sanity/block-content-to-hyperscript":6}],2:[function(require,module,exports){
"use strict";function blocksToNodes(e,i){function r(i,s,t,o){return isList(i)?function(i){var s=i.listItem,t=i._key,n=i.children.map(r);return e(c.list,{key:t,type:s,options:p},n)}(i):isListItem(i)?function(i){var s=i._key,t=buildMarksTree(i).map(r);return e(c.listItem,{node:i,key:s,options:p},t)}(i):isSpan(i)?n(i,c,s,{serializeNode:r}):function(i,s,t){var n=buildMarksTree(i).map(function(e,i,s){return r(e,i,s,!0)}),o={key:i._key||"block-"+s,node:i,isInline:t,serializers:c,options:p};return e(c.block,o,n)}(i,s,o)}var s=getSerializers(e),t=s.defaultSerializers,n=s.serializeSpan,o=objectAssign({},defaults,i),a=Array.isArray(o.blocks)?o.blocks:[o.blocks],u=generateKeys(a),l=nestLists(u),c=mergeSerializers(t,o.serializers||{}),p=optionProps.reduce(function(e,i){var r=o[i];return isDefined(r)&&(e[i]=r),e},{}),d=l.map(r);if(d.length>1){var f=o.className?{className:o.className}:{};return e("div",f,d)}return d[0]||""}function isList(e){return"list"===e._type&&e.listItem}function isListItem(e){return"block"===e._type&&e.listItem}function isSpan(e){return"string"==typeof e||e.marks||"span"===e._type}function mergeSerializers(e,i){return Object.keys(e).reduce(function(r,s){return"function"==typeof e[s]?r[s]=isDefined(i[s])?i[s]:e[s]:r[s]=objectAssign({},e[s],i[s]),r},{})}var objectAssign=require("object-assign"),buildMarksTree=require("./buildMarksTree"),nestLists=require("./nestLists"),generateKeys=require("./generateKeys"),getSerializers=require("./serializers"),optionProps=["projectId","dataset","imageOptions"],isDefined=function(e){return void 0!==e},defaults={imageOptions:{}};module.exports=blocksToNodes;
"use strict";function blocksToNodes(e,t,r,i){function s(t,r,n,o){return isList(t)?function(t){var r=t.listItem,i=t.level,n=t._key,o=t.children.map(s);return e(l.list,{key:n,level:i,type:r,options:c},o)}(t):isListItem(t)?function(t,r){var i=t._key,n=buildMarksTree(t).map(s);return e(l.listItem,{node:t,index:r,key:i,options:c},n)}(t,function(e,t){for(var r=0,i=0;i<t.length;i++){if(t[i]===e)return r;isListItem(t[i])&&r++}return r}(t,n)):isSpan(t)?i(t,l,r,{serializeNode:s}):function(t,r,i){var n=buildMarksTree(t).map(function(e,t,r){return s(e,t,r,!0)}),o={key:t._key||"block-"+r,node:t,isInline:i,serializers:l,options:c};return e(l.block,o,n)}(t,r,o)}var n=objectAssign({},defaults,t),o=Array.isArray(n.blocks)?n.blocks:[n.blocks],a=generateKeys(o),u=nestLists(a,n.listNestMode),l=mergeSerializers(r,n.serializers||{}),c=optionProps.reduce(function(e,t){var r=n[t];return isDefined(r)&&(e[t]=r),e},{}),p=u.map(s);if(p.length>1){var m=n.className?{className:n.className}:{};return e(l.container,m,p)}return p[0]?p[0]:"function"==typeof l.empty?e(l.empty):l.empty}function isList(e){return"list"===e._type&&e.listItem}function isListItem(e){return"block"===e._type&&e.listItem}function isSpan(e){return"string"==typeof e||e.marks||"span"===e._type}var objectAssign=require("object-assign"),buildMarksTree=require("./buildMarksTree"),nestLists=require("./nestLists"),generateKeys=require("./generateKeys"),mergeSerializers=require("./mergeSerializers"),optionProps=["projectId","dataset","imageOptions"],isDefined=function(e){return void 0!==e},defaults={imageOptions:{}};module.exports=blocksToNodes;
},{"./buildMarksTree":3,"./generateKeys":4,"./nestLists":7,"./serializers":8,"object-assign":15}],3:[function(require,module,exports){
},{"./buildMarksTree":3,"./generateKeys":4,"./mergeSerializers":7,"./nestLists":8,"object-assign":21}],3:[function(require,module,exports){
"use strict";function sortMarksByOccurences(r,e,n){if(!r.marks||0===r.marks.length)return r.marks||[];var a=r.marks.reduce(function(r,a){r[a]=r[a]?r[a]+1:1;for(var t=e+1;t<n.length;t++){var i=n[t];if(!(i.marks&&Array.isArray(i.marks)&&i.marks.includes(a)))break;r[a]++}return r},{}),t=sortMarks.bind(null,a);return r.marks.slice().sort(t)}function sortMarks(r,e,n){var a=r[e]||0,t=r[n]||0;if(a!==t)return t-a;var i=defaultMarks.indexOf(e),s=defaultMarks.indexOf(n);return i!==s?i-s:e<n?-1:e>n?1:0}function isTextSpan(r){return"string"==typeof r.text&&Array.isArray(r.marks)}function findLastParentNode(r){for(var e=r.length-1;e>=0;e--){var n=r[e];if("span"===n._type&&n.children)return n}}var defaultMarks=["strong","em","code","underline","strike-through"],buildMarksTree=function(r){var e=r.children,n=r.markDefs;if(!e||!e.length)return[];var a=e.map(sortMarksByOccurences),t={_type:"span",children:[]},i=[t];return e.forEach(function(r,e){var t=a[e];if(t){var s=1;if(i.length>1)for(;s<i.length;s++){var c=i[s].markKey;if(!t.includes(c))break;var l=t.indexOf(c);t.splice(l,1)}var u=findLastParentNode(i=i.slice(0,s));if(t.forEach(function(e){var a={_type:"span",_key:r._key,children:[],mark:n.find(function(r){return r._key===e})||e,markKey:e};u.children.push(a),i.push(a),u=a}),isTextSpan(r)){for(var f=r.text.split("\n"),d=f.length;d-- >1;)f.splice(d,0,"\n");u.children=u.children.concat(f)}else u.children=u.children.concat(r)}else{i[i.length-1].children.push(r)}}),t.children};module.exports=buildMarksTree;

@@ -14,32 +14,50 @@

},{"object-assign":15}],5:[function(require,module,exports){
"use strict";var _slicedToArray=function(){return function(r,e){if(Array.isArray(r))return r;if(Symbol.iterator in Object(r))return function(r,e){var t=[],n=!0,i=!1,o=void 0;try{for(var a,l=r[Symbol.iterator]();!(n=(a=l.next()).done)&&(t.push(a.value),!e||t.length!==e);n=!0);}catch(r){i=!0,o=r}finally{try{!n&&l.return&&l.return()}finally{if(i)throw o}}return t}(r,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),generateHelpUrl=require("@sanity/generate-help-url"),enc=encodeURIComponent,materializeError="You must either:\n - Pass `projectId` and `dataset` to the block renderer\n - Materialize images to include the `url` field.\n\nFor more information, see "+generateHelpUrl("block-content-image-materializing"),getQueryString=function(r){var e=r.imageOptions,t=Object.keys(e);if(!t.length)return"";return"?"+t.map(function(r){return enc(r)+"="+enc(e[r])}).join("&")},buildUrl=function(r){var e=r.node,t=r.options,n=e.asset;if(!n)throw new Error("Image does not have required `asset` property");var i=getQueryString(t);if(n.url)return n.url+i;var o=n._ref;if(!o)throw new Error("Invalid image reference in block, no `_ref` found on `asset`");var a=t.projectId,l=t.dataset;if(!a||!l)throw new Error(materializeError);var u=o.split("-"),s=_slicedToArray(u,4);return"https://cdn.sanity.io/"+s[0]+"s/"+a+"/"+l+"/"+s[1]+"-"+s[2]+"."+s[3]+i};module.exports=buildUrl;
},{"object-assign":21}],5:[function(require,module,exports){
"use strict";var generateHelpUrl=require("@sanity/generate-help-url"),urlBuilder=require("@sanity/image-url"),objectAssign=require("object-assign"),enc=encodeURIComponent,materializeError="You must either:\n - Pass `projectId` and `dataset` to the block renderer\n - Materialize images to include the `url` field.\n\nFor more information, see "+generateHelpUrl("block-content-image-materializing"),getQueryString=function(e){var r=e.imageOptions,t=Object.keys(r);if(!t.length)return"";return"?"+t.map(function(e){return enc(e)+"="+enc(r[e])}).join("&")},buildUrl=function(e){var r=e.node,t=e.options,n=t.projectId,i=t.dataset,o=r.asset;if(!o)throw new Error("Image does not have required `asset` property");if(o.url)return o.url+getQueryString(t);if(!n||!i)throw new Error(materializeError);if(!o._ref)throw new Error("Invalid image reference in block, no `_ref` found on `asset`");return urlBuilder(objectAssign({projectId:n,dataset:i},t.imageOptions||{})).image(o).toString()};module.exports=buildUrl;
},{"@sanity/generate-help-url":9}],6:[function(require,module,exports){
"use strict";var hyperscript=require("hyperscript"),objectAssign=require("object-assign"),getImageUrl=require("./getImageUrl"),blocksToNodes=require("./blocksToNodes"),getSerializers=require("./serializers"),renderNode=function(e,r,i){var t=r||{};if("function"==typeof e)return e(objectAssign({},t,{children:i}));return hyperscript(e,t,t.children||i)},_getSerializers=getSerializers(renderNode),defaultSerializers=_getSerializers.defaultSerializers,blockContentToHyperscript=blocksToNodes.bind(null,renderNode);blockContentToHyperscript.defaultSerializers=defaultSerializers,blockContentToHyperscript.getImageUrl=getImageUrl,blockContentToHyperscript.renderNode=renderNode,module.exports=blockContentToHyperscript;
},{"@sanity/generate-help-url":10,"@sanity/image-url":11,"object-assign":21}],6:[function(require,module,exports){
"use strict";var hyperscript=require("hyperscript"),objectAssign=require("object-assign"),getImageUrl=require("./getImageUrl"),blocksToNodes=require("./blocksToNodes"),getSerializers=require("./serializers"),renderNode=function(e,r,i){var t=r||{};if("function"==typeof e)return e(objectAssign({},t,{children:i}));return hyperscript(e,t,t.children||i)},_getSerializers=getSerializers(renderNode),defaultSerializers=_getSerializers.defaultSerializers,serializeSpan=_getSerializers.serializeSpan,blockContentToHyperscript=function(e){return blocksToNodes(renderNode,e,defaultSerializers,serializeSpan)};blockContentToHyperscript.defaultSerializers=defaultSerializers,blockContentToHyperscript.getImageUrl=getImageUrl,blockContentToHyperscript.renderNode=renderNode,module.exports=blockContentToHyperscript;
},{"./blocksToNodes":2,"./getImageUrl":5,"./serializers":8,"hyperscript":13,"object-assign":15}],7:[function(require,module,exports){
"use strict";function nestLists(e){for(var t=[],l=void 0,i=0;i<e.length;i++){var s=e[i];if(isListBlock(s))if(l)if(blockMatchesList(s,l))l.children.push(s);else if(s.level>l.level){var n=listFromBlock(s),r=lastChild(l),c=objectAssign({},r,{children:r.children.concat(n)});l.children[l.children.length-1]=c,l=n}else if(s.level<l.level){var o=findListMatching(t[t.length-1],s);if(o){(l=o).children.push(s);continue}l=listFromBlock(s),t.push(l)}else if(s.listItem===l.listItem)console.warn("Unknown state encountered for block",s),t.push(s);else{var h=findListMatching(t[t.length-1],{level:s.level});if(h&&h.listItem===s.listItem){(l=h).children.push(s);continue}l=listFromBlock(s),t.push(l)}else l=listFromBlock(s),t.push(l);else t.push(s),l=null}return t}function isListBlock(e){return Boolean(e.listItem)}function blockMatchesList(e,t){return e.level===t.level&&e.listItem===t.listItem}function listFromBlock(e){return{_type:"list",_key:e._key+"-parent",level:e.level,listItem:e.listItem,children:[e]}}function lastChild(e){return e.children&&e.children[e.children.length-1]}function findListMatching(e,t){var l="string"==typeof t.listItem;if("list"===e._type&&e.level===t.level&&l&&e.listItem===t.listItem)return e;var i=lastChild(e);return!!i&&findListMatching(i,t)}var objectAssign=require("object-assign");module.exports=nestLists;
},{"./blocksToNodes":2,"./getImageUrl":5,"./serializers":9,"hyperscript":19,"object-assign":21}],7:[function(require,module,exports){
"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},objectAssign=require("object-assign"),isDefined=function(o){return void 0!==o};module.exports=function(o,t){return Object.keys(o).reduce(function(e,n){var r=_typeof(o[n]);return e[n]="function"===r?isDefined(t[n])?t[n]:o[n]:"object"===r?objectAssign({},o[n],t[n]):void 0===t[n]?o[n]:t[n],e},{})};
},{"object-assign":15}],8:[function(require,module,exports){
"use strict";var objectAssign=require("object-assign"),getImageUrl=require("./getImageUrl");module.exports=function(e){function n(n,r){return e(n,null,r.children)}return{defaultSerializers:{types:{block:function(n){var r=n.node.style||"normal";return/^h\d/.test(r)?e(r,null,n.children):e("blockquote"===r?"blockquote":"p",null,n.children)},image:function(n){var r=e("img",{src:getImageUrl(n)});return n.isInline?r:e("figure",null,r)}},marks:{strong:n.bind(null,"strong"),em:n.bind(null,"em"),code:n.bind(null,"code"),underline:function(n){return e("span",{style:{textDecoration:"underline"}},n.children)},"strike-through":function(n){return e("del",null,n.children)},link:function(n){return e("a",{href:n.mark.href},n.children)}},list:function(n){var r="bullet"===n.type?"ul":"ol";return e(r,null,n.children)},listItem:function(n){return e("li",null,n.children)},block:function(n){var r=n.node,i=n.serializers,l=n.options,t=n.isInline,o=n.children,s=r._type,u=i.types[s];if(!u)throw new Error('Unknown block type "'+s+'", please specify a serializer for it in the `serializers.types` prop');return e(u,{node:r,options:l,isInline:t},o)},span:function(n){var r=n.node,i=r.mark,l=r.children,t="string"==typeof i?i:i._type,o=n.serializers.marks[t];return o?e(o,n.node,l):(console.warn('Unknown mark type "'+t+'", please specify a serializer for it in the `serializers.marks` prop'),e("span",null,l))},hardBreak:function(){return e("br")}},serializeSpan:function(n,r,i,l){if("\n"===n&&r.hardBreak)return e(r.hardBreak,{key:"hb-"+i});if("string"==typeof n)return n;var t=void 0;n.children&&(t={children:n.children.map(function(e,r){return l.serializeNode(e,r,n.children,!0)})});var o=objectAssign({},n,t);return e(r.span,{key:n._key||"span-"+i,node:o,serializers:r})}}};
},{"object-assign":21}],8:[function(require,module,exports){
"use strict";function nestLists(e){for(var l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"html",t=[],i=void 0,s=0;s<e.length;s++){var n=e[s];if(isListBlock(n))if(i)if(blockMatchesList(n,i))i.children.push(n);else if(n.level>i.level){var r=listFromBlock(n);if("html"===l){var c=lastChild(i),o=objectAssign({},c,{children:c.children.concat(r)});i.children[i.children.length-1]=o}else i.children.push(r);i=r}else if(n.level<i.level){var h=findListMatching(t[t.length-1],n);if(h){(i=h).children.push(n);continue}i=listFromBlock(n),t.push(i)}else if(n.listItem===i.listItem)console.warn("Unknown state encountered for block",n),t.push(n);else{var u=findListMatching(t[t.length-1],{level:n.level});if(u&&u.listItem===n.listItem){(i=u).children.push(n);continue}i=listFromBlock(n),t.push(i)}else i=listFromBlock(n),t.push(i);else t.push(n),i=null}return t}function isListBlock(e){return Boolean(e.listItem)}function blockMatchesList(e,l){return e.level===l.level&&e.listItem===l.listItem}function listFromBlock(e){return{_type:"list",_key:e._key+"-parent",level:e.level,listItem:e.listItem,children:[e]}}function lastChild(e){return e.children&&e.children[e.children.length-1]}function findListMatching(e,l){var t="string"==typeof l.listItem;if("list"===e._type&&e.level===l.level&&t&&e.listItem===l.listItem)return e;var i=lastChild(e);return!!i&&findListMatching(i,l)}var objectAssign=require("object-assign");module.exports=nestLists;
},{"./getImageUrl":5,"object-assign":15}],9:[function(require,module,exports){
},{"object-assign":21}],9:[function(require,module,exports){
"use strict";var objectAssign=require("object-assign"),getImageUrl=require("./getImageUrl");module.exports=function(e){function r(r,n){return e(r,null,n.children)}return{defaultSerializers:{types:{block:function(r){var n=r.node.style||"normal";return/^h\d/.test(n)?e(n,null,r.children):e("blockquote"===n?"blockquote":"p",null,r.children)},image:function(r){var n=e("img",{src:getImageUrl(r)});return r.isInline?n:e("figure",null,n)}},marks:{strong:r.bind(null,"strong"),em:r.bind(null,"em"),code:r.bind(null,"code"),underline:function(r){return e("span",{style:{textDecoration:"underline"}},r.children)},"strike-through":function(r){return e("del",null,r.children)},link:function(r){return e("a",{href:r.mark.href},r.children)}},list:function(r){var n="bullet"===r.type?"ul":"ol";return e(n,null,r.children)},listItem:function(r){return e("li",null,r.children)},block:function(r){var n=r.node,i=r.serializers,t=r.options,l=r.isInline,o=r.children,a=n._type,s=i.types[a];if(!s)throw new Error('Unknown block type "'+a+'", please specify a serializer for it in the `serializers.types` prop');return e(s,{node:n,options:t,isInline:l},o)},span:function(r){var n=r.node,i=n.mark,t=n.children,l="string"==typeof i?i:i._type,o=r.serializers.marks[l];return o?e(o,r.node,t):(console.warn('Unknown mark type "'+l+'", please specify a serializer for it in the `serializers.marks` prop'),e(r.serializers.markFallback,null,t))},hardBreak:function(){return e("br")},container:"div",markFallback:"span",text:void 0,empty:""},serializeSpan:function(r,n,i,t){if("\n"===r&&n.hardBreak)return e(n.hardBreak,{key:"hb-"+i});if("string"==typeof r)return n.text?e(n.text,{key:"text-"+i},r):r;var l=void 0;r.children&&(l={children:r.children.map(function(e,n){return t.serializeNode(e,n,r.children,!0)})});var o=objectAssign({},r,l);return e(n.span,{key:r._key||"span-"+i,node:o,serializers:n})}}};
},{"./getImageUrl":5,"object-assign":21}],10:[function(require,module,exports){
var baseUrl="https://docs.sanity.io/help/";module.exports=function(e){return baseUrl+e};
},{}],10:[function(require,module,exports){
},{}],11:[function(require,module,exports){
module.exports=require("./lib/builder").default;
},{}],11:[function(require,module,exports){
},{"./lib/builder":12}],12:[function(require,module,exports){
"use strict";function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function urlBuilder(t){return t&&"object"===_typeof(t.clientConfig)?new ImageUrlBuilder(null,{baseUrl:t.clientConfig.apiHost.replace(/^https:\/\/api\./,"https://cdn."),projectId:t.clientConfig.projectId,dataset:t.clientConfig.dataset}):new ImageUrlBuilder(null,t)}Object.defineProperty(exports,"__esModule",{value:!0});var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_createClass=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}();exports.default=urlBuilder;var _urlForImage=require("./urlForImage"),_urlForImage2=_interopRequireDefault(_urlForImage),validFits=["clip","crop","fill","fillmax","max","scale","min"],validCrops=["top","bottom","left","right","center","focalpoint","entropy"],ImageUrlBuilder=function(){function t(e,i){_classCallCheck(this,t),this.options=e?Object.assign({},e.options,i||{}):i||{}}return _createClass(t,[{key:"withOptions",value:function(e){return new t(this,e)}},{key:"image",value:function(t){return this.withOptions({source:t})}},{key:"dataset",value:function(t){return this.withOptions({dataset:t})}},{key:"projectId",value:function(t){return this.withOptions({projectId:t})}},{key:"width",value:function(t){return this.withOptions({width:t})}},{key:"height",value:function(t){return this.withOptions({height:t})}},{key:"focalPoint",value:function(t,e){return this.withOptions({focalPoint:{x:t,y:e}})}},{key:"maxWidth",value:function(t){return this.withOptions({maxWidth:t})}},{key:"minWidth",value:function(t){return this.withOptions({minWidth:t})}},{key:"maxHeight",value:function(t){return this.withOptions({maxHeight:t})}},{key:"minHeight",value:function(t){return this.withOptions({minHeight:t})}},{key:"size",value:function(t,e){return this.withOptions({width:t,height:e})}},{key:"blur",value:function(t){return this.withOptions({blur:t})}},{key:"sharpen",value:function(t){return this.withOptions({sharpen:t})}},{key:"rect",value:function(t,e,i,n){return this.withOptions({rect:{left:t,top:e,width:i,height:n}})}},{key:"format",value:function(t){return this.withOptions({format:t})}},{key:"invert",value:function(t){return this.withOptions({invert:t})}},{key:"orientation",value:function(t){return this.withOptions({orientation:t})}},{key:"quality",value:function(t){return this.withOptions({quality:t})}},{key:"forceDownload",value:function(t){return this.withOptions({download:t})}},{key:"flipHorizontal",value:function(){return this.withOptions({flipHorizontal:!0})}},{key:"flipVertical",value:function(){return this.withOptions({flipVertical:!0})}},{key:"ignoreImageParams",value:function(){return this.withOptions({ignoreImageParams:!0})}},{key:"fit",value:function(t){if(-1===validFits.indexOf(t))throw new Error('Invalid fit mode "'+t+'"');return this.withOptions({fit:t})}},{key:"crop",value:function(t){if(-1===validCrops.indexOf(t))throw new Error('Invalid crop mode "'+t+'"');return this.withOptions({crop:t})}},{key:"url",value:function(){return(0,_urlForImage2.default)(this.options)}},{key:"toString",value:function(){return this.url()}}]),t}();
},{"./urlForImage":15}],13:[function(require,module,exports){
"use strict";function parseAssetId(r){var e=r.split("-"),t=_slicedToArray(e,4),i=t[1],a=t[2],n=t[3];if(!i||!a||!n)throw new Error("Malformed asset _ref '"+r+"'. Expected an id like \""+example+'".');var o=a.split("x"),s=_slicedToArray(o,2),l=+s[0],u=+s[1];if(!(Number.isFinite(l)&&Number.isFinite(u)))throw new Error("Malformed asset _ref '"+r+"'. Expected an id like \""+example+'".');return{id:i,width:l,height:u,format:n}}Object.defineProperty(exports,"__esModule",{value:!0});var _slicedToArray=function(){return function(r,e){if(Array.isArray(r))return r;if(Symbol.iterator in Object(r))return function(r,e){var t=[],i=!0,a=!1,n=void 0;try{for(var o,s=r[Symbol.iterator]();!(i=(o=s.next()).done)&&(t.push(o.value),!e||t.length!==e);i=!0);}catch(r){a=!0,n=r}finally{try{!i&&s.return&&s.return()}finally{if(a)throw n}}return t}(r,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();exports.default=parseAssetId;var example="image-Tb9Ew8CXIwaY6R1kjMvI0uRR-2000x3000-jpg";
},{}],14:[function(require,module,exports){
"use strict";function parseSource(t){if(!t)return null;var e=void 0;if("string"==typeof t)e={asset:{_ref:t}};else if("string"==typeof t._ref)e={asset:t};else if(t._id)e={asset:{_ref:t._id}};else{if("object"!==_typeof(t.asset))return null;e=t}return applyDefaultHotspot(e)}function applyDefaultHotspot(t){return t.crop&&t.hotspot?t:Object.assign({crop:{left:0,top:0,bottom:0,right:0},hotspot:{x:.5,y:.5,height:1,width:1}},t)}Object.defineProperty(exports,"__esModule",{value:!0});var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};exports.default=parseSource;
},{}],15:[function(require,module,exports){
"use strict";function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}function urlForImage(t){var e=Object.assign({},t||{}),r=e.source;delete e.source;var o=(0,_parseSource2.default)(r);if(!o)return null;var i=(0,_parseAssetId2.default)(o.asset._ref),h={left:Math.round(o.crop.left*i.width),top:Math.round(o.crop.top*i.height)};h.width=Math.round(i.width-o.crop.right*i.width-h.left),h.height=Math.round(i.height-o.crop.bottom*i.height-h.top);var a=o.hotspot.height*i.height/2,n=o.hotspot.width*i.width/2,s=o.hotspot.x*i.width,p=o.hotspot.y*i.height,u={left:s-n,top:p-a,right:s+n,bottom:p+n};return e.asset=i,e.rect||e.focalPoint||e.ignoreImageParams||e.crop||(e=Object.assign(e,fit({crop:h,hotspot:u},e))),specToImageUrl(e)}function specToImageUrl(t){var e=t.baseUrl||"https://cdn.sanity.io",r=t.asset.id+"-"+t.asset.width+"x"+t.asset.height+"."+t.asset.format,o=e+"/images/"+t.projectId+"/"+t.dataset+"/"+r,i=[];if(t.rect){(0!=t.rect.left||0!=t.rect.top||t.rect.height!=t.asset.height||t.rect.width!=t.asset.width)&&i.push("rect="+t.rect.left+","+t.rect.top+","+t.rect.width+","+t.rect.height)}return t.focalPoint&&(i.push("fp-x="+t.focalPoint.x),i.push("fp-x="+t.focalPoint.y)),(t.flipHorizontal||t.flipVertical)&&i.push("flip="+(t.flipHorizontal?"h":"")+(t.flipVertical?"v":"")),SPEC_NAME_TO_URL_NAME_MAPPINGS.forEach(function(e){var r=_slicedToArray(e,2),o=r[0],h=r[1];void 0!==t[o]?i.push(h+"="+encodeURIComponent(t[o])):void 0!==t[h]&&i.push(h+"="+encodeURIComponent(t[h]))}),0===i.length?o:o+"?"+i.join("&")}function fit(t,e){var r={width:e.width,height:e.height};if(!e.width||!e.height)return r.rect=t.crop,r;var o=t.crop,i=t.hotspot,h=e.width/e.height;if(o.width/o.height>h){var a=o.height,n=a*h,s=o.top,p=(i.right-i.left)/2+i.left-n/2;return p<o.left?p=o.left:p+n>o.left+o.width&&(p=o.left+o.width-n),r.rect={left:Math.round(p),top:Math.round(s),width:Math.round(n),height:Math.round(a)},r}var u=o.width,l=u/h,c=o.left,d=(i.bottom-i.top)/2+i.top-l/2;return d<o.top?d=o.top:d+l>o.top+o.height&&(d=o.top+o.height-l),r.rect={left:Math.floor(c),top:Math.floor(d),width:Math.round(u),height:Math.round(l)},r}Object.defineProperty(exports,"__esModule",{value:!0}),exports.parseSource=void 0;var _slicedToArray=function(){return function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var r=[],o=!0,i=!1,h=void 0;try{for(var a,n=t[Symbol.iterator]();!(o=(a=n.next()).done)&&(r.push(a.value),!e||r.length!==e);o=!0);}catch(t){i=!0,h=t}finally{try{!o&&n.return&&n.return()}finally{if(i)throw h}}return r}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();exports.default=urlForImage;var _parseSource=require("./parseSource"),_parseSource2=_interopRequireDefault(_parseSource),_parseAssetId=require("./parseAssetId"),_parseAssetId2=_interopRequireDefault(_parseAssetId),SPEC_NAME_TO_URL_NAME_MAPPINGS=[["width","w"],["height","h"],["format","fm"],["download","dl"],["blur","blur"],["sharpen","sharp"],["invert","invert"],["orientation","or"],["minHeight","min-h"],["maxHeight","max-h"],["minWidth","min-w"],["maxWidth","max-w"],["quality","q"],["fit","fit"],["crop","crop"]];exports.parseSource=_parseSource2.default;
},{"./parseAssetId":13,"./parseSource":14}],16:[function(require,module,exports){
},{}],17:[function(require,module,exports){
module.exports=function(e){var t=String.prototype.split,n=/()??/.exec("")[1]===e;return function(l,r,i){if("[object RegExp]"!==Object.prototype.toString.call(r))return t.call(l,r,i);var o,p,s,c,g=[],u=(r.ignoreCase?"i":"")+(r.multiline?"m":"")+(r.extended?"x":"")+(r.sticky?"y":""),x=0;r=new RegExp(r.source,u+"g");for(l+="",n||(o=new RegExp("^"+r.source+"$(?!\\s)",u)),i=i===e?-1>>>0:i>>>0;(p=r.exec(l))&&!((s=p.index+p[0].length)>x&&(g.push(l.slice(x,p.index)),!n&&p.length>1&&p[0].replace(o,function(){for(var t=1;t<arguments.length-2;t++)arguments[t]===e&&(p[t]=e)}),p.length>1&&p.index<l.length&&Array.prototype.push.apply(g,p.slice(1)),c=p[0].length,x=s,g.length>=i));)r.lastIndex===p.index&&r.lastIndex++;return x===l.length?!c&&r.test("")||g.push(""):g.push(l.slice(x)),g.length>i?g.slice(0,i):g}}();
},{}],12:[function(require,module,exports){
},{}],18:[function(require,module,exports){
function ClassList(n){function t(n){var t=i();indexof(t,n)>-1||(t.push(n),u(t))}function r(n){var t=i(),r=indexof(t,n);-1!==r&&(t.splice(r,1),u(t))}function e(n){return indexof(i(),n)>-1}function i(){return filter(n.className.split(" "),isTruthy)}function u(t){var r=t.length;n.className=t.join(" "),s.length=r;for(var e=0;e<t.length;e++)s[e]=t[e];delete t[r]}var o=n.classList;if(o)return o;var s={add:t,remove:r,contains:e,toggle:function(n){return e(n)?(r(n),!1):(t(n),!0)},toString:function(){return n.className},length:0,item:function(n){return i()[n]||null}};return s}function filter(n,t){for(var r=[],e=0;e<n.length;e++)t(n[e])&&r.push(n[e]);return r}function isTruthy(n){return!!n}var indexof=require("indexof");module.exports=ClassList;
},{"indexof":14}],13:[function(require,module,exports){
},{"indexof":20}],19:[function(require,module,exports){
function context(){function e(){function e(n){var o;if(null==n);else if("string"==typeof n)r?r.appendChild(o=document.createTextNode(n)):function(e){var t=split(e,/([\.#]?[^\s#.]+)/);/^\.|#/.test(t[1])&&(r=document.createElement("div")),forEach(t,function(e){var t=e.substring(1,e.length);e&&(r?"."===e[0]?ClassList(r).add(t):"#"===e[0]&&r.setAttribute("id",t):r=document.createElement(e))})}(n);else if("number"==typeof n||"boolean"==typeof n||n instanceof Date||n instanceof RegExp)r.appendChild(o=document.createTextNode(n.toString()));else if(isArray(n))forEach(n,e);else if(isNode(n))r.appendChild(o=n);else if(n instanceof Text)r.appendChild(o=n);else if("object"==typeof n)for(var i in n)if("function"==typeof n[i])/^on\w+/.test(i)?function(e,n){r.addEventListener?(r.addEventListener(e.substring(2),n[e],!1),t.push(function(){r.removeEventListener(e.substring(2),n[e],!1)})):(r.attachEvent(e,n[e]),t.push(function(){r.detachEvent(e,n[e])}))}(i,n):(r[i]=n[i](),t.push(n[i](function(e){r[i]=e})));else if("style"===i)if("string"==typeof n[i])r.style.cssText=n[i];else for(var s in n[i])!function(e,o){if("function"==typeof o)r.style.setProperty(e,o()),t.push(o(function(t){r.style.setProperty(e,t)}));else var s=n[i][e].match(/(.*)\W+!important\W*$/);s?r.style.setProperty(e,s[1],"important"):r.style.setProperty(e,n[i][e])}(s,n[i][s]);else if("attrs"===i)for(var f in n[i])r.setAttribute(f,n[i][f]);else"data-"===i.substr(0,5)?r.setAttribute(i,n[i]):r[i]=n[i];else if("function"==typeof n){f=n();r.appendChild(o=isNode(f)?f:document.createTextNode(f)),t.push(n(function(e){isNode(e)&&o.parentElement?(o.parentElement.replaceChild(e,o),o=e):o.textContent=e}))}return o}for(var n=[].slice.call(arguments),r=null;n.length;)e(n.shift());return r}var t=[];return e.cleanup=function(){for(var e=0;e<t.length;e++)t[e]();t.length=0},e}function isNode(e){return e&&e.nodeName&&e.nodeType}function forEach(e,t){if(e.forEach)return e.forEach(t);for(var n=0;n<e.length;n++)t(e[n],n)}function isArray(e){return"[object Array]"==Object.prototype.toString.call(e)}var split=require("browser-split"),ClassList=require("class-list"),w="undefined"==typeof window?require("html-element"):window,document=w.document,Text=w.Text,h=module.exports=context();h.context=context;
},{"browser-split":11,"class-list":12,"html-element":10}],14:[function(require,module,exports){
},{"browser-split":17,"class-list":18,"html-element":16}],20:[function(require,module,exports){
var indexOf=[].indexOf;module.exports=function(e,n){if(indexOf)return e.indexOf(n);for(var r=0;r<e.length;++r)if(e[r]===n)return r;return-1};
},{}],15:[function(require,module,exports){
},{}],21:[function(require,module,exports){
"use strict";function toObject(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}function shouldUseNative(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var r={},t=0;t<10;t++)r["_"+String.fromCharCode(t)]=t;if("0123456789"!==Object.getOwnPropertyNames(r).map(function(e){return r[e]}).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach(function(e){n[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(e){return!1}}var getOwnPropertySymbols=Object.getOwnPropertySymbols,hasOwnProperty=Object.prototype.hasOwnProperty,propIsEnumerable=Object.prototype.propertyIsEnumerable;module.exports=shouldUseNative()?Object.assign:function(e,r){for(var t,n,o=toObject(e),a=1;a<arguments.length;a++){t=Object(arguments[a]);for(var s in t)hasOwnProperty.call(t,s)&&(o[s]=t[s]);if(getOwnPropertySymbols){n=getOwnPropertySymbols(t);for(var c=0;c<n.length;c++)propIsEnumerable.call(t,n[c])&&(o[n[c]]=t[n[c]])}}return o};

@@ -46,0 +64,0 @@

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

!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).blocksToHtml=e()}}(function(){return function e(n,t,r){function i(s,l){if(!t[s]){if(!n[s]){var a="function"==typeof require&&require;if(!l&&a)return a(s,!0);if(o)return o(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var c=t[s]={exports:{}};n[s][0].call(c.exports,function(e){var t=n[s][1][e];return i(t||e)},c,c.exports,e,n,t,r)}return t[s].exports}for(var o="function"==typeof require&&require,s=0;s<r.length;s++)i(r[s]);return i}({1:[function(e,n,t){"use strict";var r=e("@sanity/block-content-to-hyperscript"),i=r.renderNode,o=function(e){var n=r(e);return n.outerHTML||n};o.defaultSerializers=r.defaultSerializers,o.getImageUrl=r.getImageUrl,o.renderNode=i,o.h=i,n.exports=o},{"@sanity/block-content-to-hyperscript":6}],2:[function(e,n,t){"use strict";var r=e("object-assign"),i=e("./buildMarksTree"),o=e("./nestLists"),s=e("./generateKeys"),l=e("./serializers"),a=["projectId","dataset","imageOptions"],u=function(e){return void 0!==e},c={imageOptions:{}};n.exports=function(e,n){function t(n,r,o,s){return function(e){return"list"===e._type&&e.listItem}(n)?function(n){var r=n.listItem,i=n._key,o=n.children.map(t);return e(m.list,{key:i,type:r,options:b},o)}(n):function(e){return"block"===e._type&&e.listItem}(n)?function(n){var r=n._key,o=i(n).map(t);return e(m.listItem,{node:n,key:r,options:b},o)}(n):function(e){return"string"==typeof e||e.marks||"span"===e._type}(n)?d(n,m,r,{serializeNode:t}):function(n,r,o){var s=i(n).map(function(e,n,r){return t(e,n,0,!0)}),l={key:n._key||"block-"+r,node:n,isInline:o,serializers:m,options:b};return e(m.block,l,s)}(n,r,s)}var f=l(e),p=f.defaultSerializers,d=f.serializeSpan,h=r({},c,n),v=Array.isArray(h.blocks)?h.blocks:[h.blocks],y=s(v),g=o(y),m=function(e,n){return Object.keys(e).reduce(function(t,i){return"function"==typeof e[i]?t[i]=u(n[i])?n[i]:e[i]:t[i]=r({},e[i],n[i]),t},{})}(p,h.serializers||{}),b=a.reduce(function(e,n){var t=h[n];return u(t)&&(e[n]=t),e},{}),k=g.map(t);if(k.length>1){var x=h.className?{className:h.className}:{};return e("div",x,k)}return k[0]||""}},{"./buildMarksTree":3,"./generateKeys":4,"./nestLists":7,"./serializers":8,"object-assign":15}],3:[function(e,n,t){"use strict";function r(e,n,t){if(!e.marks||0===e.marks.length)return e.marks||[];var r=e.marks.reduce(function(e,r){e[r]=e[r]?e[r]+1:1;for(var i=n+1;i<t.length;i++){var o=t[i];if(!(o.marks&&Array.isArray(o.marks)&&o.marks.includes(r)))break;e[r]++}return e},{}),o=function(e,n,t){var r=e[n]||0,o=e[t]||0;if(r!==o)return o-r;var s=i.indexOf(n),l=i.indexOf(t);return s!==l?s-l:n<t?-1:n>t?1:0}.bind(null,r);return e.marks.slice().sort(o)}var i=["strong","em","code","underline","strike-through"];n.exports=function(e){var n=e.children,t=e.markDefs;if(!n||!n.length)return[];var i=n.map(r),o={_type:"span",children:[]},s=[o];return n.forEach(function(e,n){var r=i[n];if(r){var o=1;if(s.length>1)for(;o<s.length;o++){var l=s[o].markKey;if(!r.includes(l))break;var a=r.indexOf(l);r.splice(a,1)}var u=function(e){for(var n=e.length-1;n>=0;n--){var t=e[n];if("span"===t._type&&t.children)return t}}(s=s.slice(0,o));if(r.forEach(function(n){var r={_type:"span",_key:e._key,children:[],mark:t.find(function(e){return e._key===n})||n,markKey:n};u.children.push(r),s.push(r),u=r}),function(e){return"string"==typeof e.text&&Array.isArray(e.marks)}(e)){for(var c=e.text.split("\n"),f=c.length;f-- >1;)c.splice(f,0,"\n");u.children=u.children.concat(c)}else u.children=u.children.concat(e)}else s[s.length-1].children.push(e)}),o.children}},{}],4:[function(e,n,t){"use strict";var r=e("object-assign");n.exports=function(e){return e.map(function(e){return e._key?e:r({_key:function(e){return function(e){var n=0,t=e.length;if(0===t)return n;for(var r=0;r<t;r++)n=(n<<5)-n+e.charCodeAt(r),n&=n;return n}(JSON.stringify(e)).toString(36).replace(/[^A-Za-z0-9]/g,"")}(e)},e)})}},{"object-assign":15}],5:[function(e,n,t){"use strict";var r=function(e,n){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,n){var t=[],r=!0,i=!1,o=void 0;try{for(var s,l=e[Symbol.iterator]();!(r=(s=l.next()).done)&&(t.push(s.value),!n||t.length!==n);r=!0);}catch(e){i=!0,o=e}finally{try{!r&&l.return&&l.return()}finally{if(i)throw o}}return t}(e,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")},i=e("@sanity/generate-help-url"),o=encodeURIComponent,s="You must either:\n - Pass `projectId` and `dataset` to the block renderer\n - Materialize images to include the `url` field.\n\nFor more information, see "+i("block-content-image-materializing");n.exports=function(e){var n=e.node,t=e.options,i=n.asset;if(!i)throw new Error("Image does not have required `asset` property");var l=function(e){var n=e.imageOptions,t=Object.keys(n);return t.length?"?"+t.map(function(e){return o(e)+"="+o(n[e])}).join("&"):""}(t);if(i.url)return i.url+l;var a=i._ref;if(!a)throw new Error("Invalid image reference in block, no `_ref` found on `asset`");var u=t.projectId,c=t.dataset;if(!u||!c)throw new Error(s);var f=a.split("-"),p=r(f,4);return"https://cdn.sanity.io/"+p[0]+"s/"+u+"/"+c+"/"+p[1]+"-"+p[2]+"."+p[3]+l}},{"@sanity/generate-help-url":9}],6:[function(e,n,t){"use strict";var r=e("hyperscript"),i=e("object-assign"),o=e("./getImageUrl"),s=e("./blocksToNodes"),l=function(e,n,t){var o=n||{};return"function"==typeof e?e(i({},o,{children:t})):r(e,o,o.children||t)},a=e("./serializers")(l).defaultSerializers,u=s.bind(null,l);u.defaultSerializers=a,u.getImageUrl=o,u.renderNode=l,n.exports=u},{"./blocksToNodes":2,"./getImageUrl":5,"./serializers":8,hyperscript:13,"object-assign":15}],7:[function(e,n,t){"use strict";function r(e){return{_type:"list",_key:e._key+"-parent",level:e.level,listItem:e.listItem,children:[e]}}function i(e){return e.children&&e.children[e.children.length-1]}function o(e,n){var t="string"==typeof n.listItem;if("list"===e._type&&e.level===n.level&&t&&e.listItem===n.listItem)return e;var r=i(e);return!!r&&o(r,n)}var s=e("object-assign");n.exports=function(e){for(var n=[],t=void 0,l=0;l<e.length;l++){var a=e[l];if(function(e){return Boolean(e.listItem)}(a))if(t)if(function(e,n){return e.level===n.level&&e.listItem===n.listItem}(a,t))t.children.push(a);else if(a.level>t.level){var u=r(a),c=i(t),f=s({},c,{children:c.children.concat(u)});t.children[t.children.length-1]=f,t=u}else if(a.level<t.level){var p=o(n[n.length-1],a);if(p){(t=p).children.push(a);continue}t=r(a),n.push(t)}else if(a.listItem===t.listItem)console.warn("Unknown state encountered for block",a),n.push(a);else{var d=o(n[n.length-1],{level:a.level});if(d&&d.listItem===a.listItem){(t=d).children.push(a);continue}t=r(a),n.push(t)}else t=r(a),n.push(t);else n.push(a),t=null}return n}},{"object-assign":15}],8:[function(e,n,t){"use strict";var r=e("object-assign"),i=e("./getImageUrl");n.exports=function(e){function n(n,t){return e(n,null,t.children)}return{defaultSerializers:{types:{block:function(n){var t=n.node.style||"normal";return/^h\d/.test(t)?e(t,null,n.children):e("blockquote"===t?"blockquote":"p",null,n.children)},image:function(n){var t=e("img",{src:i(n)});return n.isInline?t:e("figure",null,t)}},marks:{strong:n.bind(null,"strong"),em:n.bind(null,"em"),code:n.bind(null,"code"),underline:function(n){return e("span",{style:{textDecoration:"underline"}},n.children)},"strike-through":function(n){return e("del",null,n.children)},link:function(n){return e("a",{href:n.mark.href},n.children)}},list:function(n){var t="bullet"===n.type?"ul":"ol";return e(t,null,n.children)},listItem:function(n){return e("li",null,n.children)},block:function(n){var t=n.node,r=n.serializers,i=n.options,o=n.isInline,s=n.children,l=t._type,a=r.types[l];if(!a)throw new Error('Unknown block type "'+l+'", please specify a serializer for it in the `serializers.types` prop');return e(a,{node:t,options:i,isInline:o},s)},span:function(n){var t=n.node,r=t.mark,i=t.children,o="string"==typeof r?r:r._type,s=n.serializers.marks[o];return s?e(s,n.node,i):(console.warn('Unknown mark type "'+o+'", please specify a serializer for it in the `serializers.marks` prop'),e("span",null,i))},hardBreak:function(){return e("br")}},serializeSpan:function(n,t,i,o){if("\n"===n&&t.hardBreak)return e(t.hardBreak,{key:"hb-"+i});if("string"==typeof n)return n;var s=void 0;n.children&&(s={children:n.children.map(function(e,t){return o.serializeNode(e,t,n.children,!0)})});var l=r({},n,s);return e(t.span,{key:n._key||"span-"+i,node:l,serializers:t})}}}},{"./getImageUrl":5,"object-assign":15}],9:[function(e,n,t){n.exports=function(e){return"https://docs.sanity.io/help/"+e}},{}],10:[function(e,n,t){},{}],11:[function(e,n,t){n.exports=function(e){var n=String.prototype.split,t=void 0===/()??/.exec("")[1];return function(e,r,i){if("[object RegExp]"!==Object.prototype.toString.call(r))return n.call(e,r,i);var o,s,l,a,u=[],c=(r.ignoreCase?"i":"")+(r.multiline?"m":"")+(r.extended?"x":"")+(r.sticky?"y":""),f=0;for(r=new RegExp(r.source,c+"g"),e+="",t||(o=new RegExp("^"+r.source+"$(?!\\s)",c)),i=void 0===i?-1>>>0:i>>>0;(s=r.exec(e))&&!((l=s.index+s[0].length)>f&&(u.push(e.slice(f,s.index)),!t&&s.length>1&&s[0].replace(o,function(){for(var e=1;e<arguments.length-2;e++)void 0===arguments[e]&&(s[e]=void 0)}),s.length>1&&s.index<e.length&&Array.prototype.push.apply(u,s.slice(1)),a=s[0].length,f=l,u.length>=i));)r.lastIndex===s.index&&r.lastIndex++;return f===e.length?!a&&r.test("")||u.push(""):u.push(e.slice(f)),u.length>i?u.slice(0,i):u}}()},{}],12:[function(e,n,t){function r(e){return!!e}var i=e("indexof");n.exports=function(e){function n(e){var n=s();i(n,e)>-1||(n.push(e),l(n))}function t(e){var n=s(),t=i(n,e);-1!==t&&(n.splice(t,1),l(n))}function o(e){return i(s(),e)>-1}function s(){return function(e,n){for(var t=[],r=0;r<e.length;r++)n(e[r])&&t.push(e[r]);return t}(e.className.split(" "),r)}function l(n){var t=n.length;e.className=n.join(" "),u.length=t;for(var r=0;r<n.length;r++)u[r]=n[r];delete n[t]}var a=e.classList;if(a)return a;var u={add:n,remove:t,contains:o,toggle:function(e){return o(e)?(t(e),!1):(n(e),!0)},toString:function(){return e.className},length:0,item:function(e){return s()[e]||null}};return u}},{indexof:14}],13:[function(e,n,t){function r(){function e(){function e(t){var a;if(null==t);else if("string"==typeof t)r?r.appendChild(a=u.createTextNode(t)):function(e){var n=s(t,/([\.#]?[^\s#.]+)/);/^\.|#/.test(n[1])&&(r=u.createElement("div")),o(n,function(e){var n=e.substring(1,e.length);e&&(r?"."===e[0]?l(r).add(n):"#"===e[0]&&r.setAttribute("id",n):r=u.createElement(e))})}();else if("number"==typeof t||"boolean"==typeof t||t instanceof Date||t instanceof RegExp)r.appendChild(a=u.createTextNode(t.toString()));else if(function(e){return"[object Array]"==Object.prototype.toString.call(e)}(t))o(t,e);else if(i(t))r.appendChild(a=t);else if(t instanceof c)r.appendChild(a=t);else if("object"==typeof t)for(var f in t)if("function"==typeof t[f])/^on\w+/.test(f)?function(e,t){r.addEventListener?(r.addEventListener(e.substring(2),t[e],!1),n.push(function(){r.removeEventListener(e.substring(2),t[e],!1)})):(r.attachEvent(e,t[e]),n.push(function(){r.detachEvent(e,t[e])}))}(f,t):(r[f]=t[f](),n.push(t[f](function(e){r[f]=e})));else if("style"===f)if("string"==typeof t[f])r.style.cssText=t[f];else for(var p in t[f])!function(e,i){if("function"==typeof i)r.style.setProperty(e,i()),n.push(i(function(n){r.style.setProperty(e,n)}));else var o=t[f][e].match(/(.*)\W+!important\W*$/);o?r.style.setProperty(e,o[1],"important"):r.style.setProperty(e,t[f][e])}(p,t[f][p]);else if("attrs"===f)for(var d in t[f])r.setAttribute(d,t[f][d]);else"data-"===f.substr(0,5)?r.setAttribute(f,t[f]):r[f]=t[f];else"function"==typeof t&&(d=t(),r.appendChild(a=i(d)?d:u.createTextNode(d)),n.push(t(function(e){i(e)&&a.parentElement?(a.parentElement.replaceChild(e,a),a=e):a.textContent=e})));return a}for(var t=[].slice.call(arguments),r=null;t.length;)e(t.shift());return r}var n=[];return e.cleanup=function(){for(var e=0;e<n.length;e++)n[e]();n.length=0},e}function i(e){return e&&e.nodeName&&e.nodeType}function o(e,n){if(e.forEach)return e.forEach(n);for(var t=0;t<e.length;t++)n(e[t],t)}var s=e("browser-split"),l=e("class-list"),a="undefined"==typeof window?e("html-element"):window,u=a.document,c=a.Text;(n.exports=r()).context=r},{"browser-split":11,"class-list":12,"html-element":10}],14:[function(e,n,t){var r=[].indexOf;n.exports=function(e,n){if(r)return e.indexOf(n);for(var t=0;t<e.length;++t)if(e[t]===n)return t;return-1}},{}],15:[function(e,n,t){"use strict";var r=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable;n.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var n={},t=0;t<10;t++)n["_"+String.fromCharCode(t)]=t;if("0123456789"!==Object.getOwnPropertyNames(n).map(function(e){return n[e]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,n){for(var t,s,l=function(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),a=1;a<arguments.length;a++){t=Object(arguments[a]);for(var u in t)i.call(t,u)&&(l[u]=t[u]);if(r){s=r(t);for(var c=0;c<s.length;c++)o.call(t,s[c])&&(l[s[c]]=t[s[c]])}}return l}},{}]},{},[1])(1)});
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).blocksToHtml=e()}}(function(){return function o(l,s,a){function u(n,e){if(!s[n]){if(!l[n]){var t="function"==typeof require&&require;if(!e&&t)return t(n,!0);if(c)return c(n,!0);var r=new Error("Cannot find module '"+n+"'");throw r.code="MODULE_NOT_FOUND",r}var i=s[n]={exports:{}};l[n][0].call(i.exports,function(e){var t=l[n][1][e];return u(t||e)},i,i.exports,o,l,s,a)}return s[n].exports}for(var c="function"==typeof require&&require,e=0;e<a.length;e++)u(a[e]);return u}({1:[function(e,t,n){"use strict";var r=e("@sanity/block-content-to-hyperscript"),i=r.renderNode,o=function(e){var t=r(e);return t.outerHTML||t};o.defaultSerializers=r.defaultSerializers,o.getImageUrl=r.getImageUrl,o.renderNode=i,o.h=i,t.exports=o},{"@sanity/block-content-to-hyperscript":6}],2:[function(e,t,n){"use strict";function I(e){return"block"===e._type&&e.listItem}var a=e("object-assign"),_=e("./buildMarksTree"),u=e("./nestLists"),c=e("./generateKeys"),f=e("./mergeSerializers"),h=["projectId","dataset","imageOptions"],p={imageOptions:{}};t.exports=function(k,e,t,x){var r=a({},p,e),n=Array.isArray(r.blocks)?r.blocks:[r.blocks],i=c(n),o=u(i,r.listNestMode),O=f(t,r.serializers||{}),j=h.reduce(function(e,t){var n=r[t];return void 0!==n&&(e[t]=n),e},{}),l=o.map(function r(e,t,n,i){return"list"===(w=e)._type&&w.listItem?(g=(y=e).listItem,m=y.level,v=y._key,b=y.children.map(r),k(O.list,{key:v,level:m,type:g,options:j},b)):I(e)?(h=function(e,t){for(var n=0,r=0;r<t.length;r++){if(t[r]===e)return n;I(t[r])&&n++}return n}(f=e,n),p=f._key,d=_(f).map(r),k(O.listItem,{node:f,index:h,key:p,options:j},d)):"string"==typeof(c=e)||c.marks||"span"===c._type?x(e,O,t,{serializeNode:r}):(l=t,s=i,a=_(o=e).map(function(e,t,n){return r(e,t,n,!0)}),u={key:o._key||"block-"+l,node:o,isInline:s,serializers:O,options:j},k(O.block,u,a));var o,l,s,a,u,c,f,h,p,d,y,g,m,v,b,w});if(1<l.length){var s=r.className?{className:r.className}:{};return k(O.container,s,l)}return l[0]?l[0]:"function"==typeof O.empty?k(O.empty):O.empty}},{"./buildMarksTree":3,"./generateKeys":4,"./mergeSerializers":7,"./nestLists":8,"object-assign":21}],3:[function(e,t,n){"use strict";function r(e,i,o){if(!e.marks||0===e.marks.length)return e.marks||[];var t=e.marks.reduce(function(e,t){e[t]=e[t]?e[t]+1:1;for(var n=i+1;n<o.length;n++){var r=o[n];if(!(r.marks&&Array.isArray(r.marks)&&r.marks.includes(t)))break;e[t]++}return e},{}),n=function(e,t,n){var r=e[t]||0,i=e[n]||0;if(r!==i)return i-r;var o=s.indexOf(t),l=s.indexOf(n);return o!==l?o-l:t<n?-1:n<t?1:0}.bind(null,t);return e.marks.slice().sort(n)}var s=["strong","em","code","underline","strike-through"];t.exports=function(e){var t=e.children,c=e.markDefs;if(!t||!t.length)return[];var f=t.map(r),n={_type:"span",children:[]},h=[n];return t.forEach(function(n,e){var t,r=f[e];if(r){var i=1;if(1<h.length)for(;i<h.length;i++){var o=h[i].markKey;if(!r.includes(o))break;var l=r.indexOf(o);r.splice(l,1)}var s=function(e){for(var t=e.length-1;0<=t;t--){var n=e[t];if("span"===n._type&&n.children)return n}}(h=h.slice(0,i));if(r.forEach(function(t){var e={_type:"span",_key:n._key,children:[],mark:c.find(function(e){return e._key===t})||t,markKey:t};s.children.push(e),h.push(e),s=e}),"string"==typeof(t=n).text&&Array.isArray(t.marks)){for(var a=n.text.split("\n"),u=a.length;1<u--;)a.splice(u,0,"\n");s.children=s.children.concat(a)}else s.children=s.children.concat(n)}else h[h.length-1].children.push(n)}),n.children}},{}],4:[function(e,t,n){"use strict";var r=e("object-assign");t.exports=function(e){return e.map(function(e){return e._key?e:r({_key:(t=e,function(e){var t=0,n=e.length;if(0===n)return t;for(var r=0;r<n;r++)t=(t<<5)-t+e.charCodeAt(r),t&=t;return t}(JSON.stringify(t)).toString(36).replace(/[^A-Za-z0-9]/g,""))},e);var t})}},{"object-assign":21}],5:[function(e,t,n){"use strict";var r=e("@sanity/generate-help-url"),a=e("@sanity/image-url"),u=e("object-assign"),c=encodeURIComponent,f="You must either:\n - Pass `projectId` and `dataset` to the block renderer\n - Materialize images to include the `url` field.\n\nFor more information, see "+r("block-content-image-materializing");t.exports=function(e){var t,n,r=e.node,i=e.options,o=i.projectId,l=i.dataset,s=r.asset;if(!s)throw new Error("Image does not have required `asset` property");if(s.url)return s.url+(t=i.imageOptions,(n=Object.keys(t)).length?"?"+n.map(function(e){return c(e)+"="+c(t[e])}).join("&"):"");if(!o||!l)throw new Error(f);if(!s._ref)throw new Error("Invalid image reference in block, no `_ref` found on `asset`");return a(u({projectId:o,dataset:l},i.imageOptions||{})).image(s).toString()}},{"@sanity/generate-help-url":10,"@sanity/image-url":11,"object-assign":21}],6:[function(e,t,n){"use strict";var i=e("hyperscript"),o=e("object-assign"),r=e("./getImageUrl"),l=e("./blocksToNodes"),s=e("./serializers"),a=function(e,t,n){var r=t||{};return"function"==typeof e?e(o({},r,{children:n})):i(e,r,r.children||n)},u=s(a),c=u.defaultSerializers,f=u.serializeSpan,h=function(e){return l(a,e,c,f)};h.defaultSerializers=c,h.getImageUrl=r,h.renderNode=a,t.exports=h},{"./blocksToNodes":2,"./getImageUrl":5,"./serializers":9,hyperscript:19,"object-assign":21}],7:[function(e,t,n){"use strict";var o="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},l=e("object-assign");t.exports=function(r,i){return Object.keys(r).reduce(function(e,t){var n=o(r[t]);return e[t]="function"===n?void 0!==i[t]?i[t]:r[t]:"object"===n?l({},r[t],i[t]):void 0===i[t]?r[t]:i[t],e},{})}},{"object-assign":21}],8:[function(e,t,n){"use strict";function p(e){return{_type:"list",_key:e._key+"-parent",level:e.level,listItem:e.listItem,children:[e]}}function d(e){return e.children&&e.children[e.children.length-1]}function y(e,t){var n="string"==typeof t.listItem;if("list"===e._type&&e.level===t.level&&n&&e.listItem===t.listItem)return e;var r=d(e);return!!r&&y(r,t)}var g=e("object-assign");t.exports=function(e){for(var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"html",n=[],r=void 0,i=0;i<e.length;i++){var o=e[i];if(Boolean(o.listItem))if(r)if(h=r,(f=o).level===h.level&&f.listItem===h.listItem)r.children.push(o);else if(o.level>r.level){var l=p(o);if("html"===t){var s=d(r),a=g({},s,{children:s.children.concat(l)});r.children[r.children.length-1]=a}else r.children.push(l);r=l}else if(o.level<r.level){var u=y(n[n.length-1],o);if(u){(r=u).children.push(o);continue}r=p(o),n.push(r)}else if(o.listItem===r.listItem)console.warn("Unknown state encountered for block",o),n.push(o);else{var c=y(n[n.length-1],{level:o.level});if(c&&c.listItem===o.listItem){(r=c).children.push(o);continue}r=p(o),n.push(r)}else r=p(o),n.push(r);else n.push(o),r=null}var f,h;return n}},{"object-assign":21}],9:[function(e,t,n){"use strict";var l=e("object-assign"),r=e("./getImageUrl");t.exports=function(a){function e(e,t){return a(e,null,t.children)}return{defaultSerializers:{types:{block:function(e){var t=e.node.style||"normal";return/^h\d/.test(t)?a(t,null,e.children):a("blockquote"===t?"blockquote":"p",null,e.children)},image:function(e){var t=a("img",{src:r(e)});return e.isInline?t:a("figure",null,t)}},marks:{strong:e.bind(null,"strong"),em:e.bind(null,"em"),code:e.bind(null,"code"),underline:function(e){return a("span",{style:{textDecoration:"underline"}},e.children)},"strike-through":function(e){return a("del",null,e.children)},link:function(e){return a("a",{href:e.mark.href},e.children)}},list:function(e){var t="bullet"===e.type?"ul":"ol";return a(t,null,e.children)},listItem:function(e){return a("li",null,e.children)},block:function(e){var t=e.node,n=e.serializers,r=e.options,i=e.isInline,o=e.children,l=t._type,s=n.types[l];if(!s)throw new Error('Unknown block type "'+l+'", please specify a serializer for it in the `serializers.types` prop');return a(s,{node:t,options:r,isInline:i},o)},span:function(e){var t=e.node,n=t.mark,r=t.children,i="string"==typeof n?n:n._type,o=e.serializers.marks[i];return o?a(o,e.node,r):(console.warn('Unknown mark type "'+i+'", please specify a serializer for it in the `serializers.marks` prop'),a(e.serializers.markFallback,null,r))},hardBreak:function(){return a("br")},container:"div",markFallback:"span",text:void 0,empty:""},serializeSpan:function(n,e,t,r){if("\n"===n&&e.hardBreak)return a(e.hardBreak,{key:"hb-"+t});if("string"==typeof n)return e.text?a(e.text,{key:"text-"+t},n):n;var i=void 0;n.children&&(i={children:n.children.map(function(e,t){return r.serializeNode(e,t,n.children,!0)})});var o=l({},n,i);return a(e.span,{key:n._key||"span-"+t,node:o,serializers:e})}}}},{"./getImageUrl":5,"object-assign":21}],10:[function(e,t,n){t.exports=function(e){return"https://docs.sanity.io/help/"+e}},{}],11:[function(e,t,n){t.exports=e("./lib/builder").default},{"./lib/builder":12}],12:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r="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},i=function(){function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}();n.default=function(e){return e&&"object"===r(e.clientConfig)?new c(null,{baseUrl:e.clientConfig.apiHost.replace(/^https:\/\/api\./,"https://cdn."),projectId:e.clientConfig.projectId,dataset:e.clientConfig.dataset}):new c(null,e)};var o,l=e("./urlForImage"),s=(o=l)&&o.__esModule?o:{default:o},a=["clip","crop","fill","fillmax","max","scale","min"],u=["top","bottom","left","right","center","focalpoint","entropy"],c=function(){function n(e,t){(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,n),this.options=e?Object.assign({},e.options,t||{}):t||{}}return i(n,[{key:"withOptions",value:function(e){return new n(this,e)}},{key:"image",value:function(e){return this.withOptions({source:e})}},{key:"dataset",value:function(e){return this.withOptions({dataset:e})}},{key:"projectId",value:function(e){return this.withOptions({projectId:e})}},{key:"width",value:function(e){return this.withOptions({width:e})}},{key:"height",value:function(e){return this.withOptions({height:e})}},{key:"focalPoint",value:function(e,t){return this.withOptions({focalPoint:{x:e,y:t}})}},{key:"maxWidth",value:function(e){return this.withOptions({maxWidth:e})}},{key:"minWidth",value:function(e){return this.withOptions({minWidth:e})}},{key:"maxHeight",value:function(e){return this.withOptions({maxHeight:e})}},{key:"minHeight",value:function(e){return this.withOptions({minHeight:e})}},{key:"size",value:function(e,t){return this.withOptions({width:e,height:t})}},{key:"blur",value:function(e){return this.withOptions({blur:e})}},{key:"sharpen",value:function(e){return this.withOptions({sharpen:e})}},{key:"rect",value:function(e,t,n,r){return this.withOptions({rect:{left:e,top:t,width:n,height:r}})}},{key:"format",value:function(e){return this.withOptions({format:e})}},{key:"invert",value:function(e){return this.withOptions({invert:e})}},{key:"orientation",value:function(e){return this.withOptions({orientation:e})}},{key:"quality",value:function(e){return this.withOptions({quality:e})}},{key:"forceDownload",value:function(e){return this.withOptions({download:e})}},{key:"flipHorizontal",value:function(){return this.withOptions({flipHorizontal:!0})}},{key:"flipVertical",value:function(){return this.withOptions({flipVertical:!0})}},{key:"ignoreImageParams",value:function(){return this.withOptions({ignoreImageParams:!0})}},{key:"fit",value:function(e){if(-1===a.indexOf(e))throw new Error('Invalid fit mode "'+e+'"');return this.withOptions({fit:e})}},{key:"crop",value:function(e){if(-1===u.indexOf(e))throw new Error('Invalid crop mode "'+e+'"');return this.withOptions({crop:e})}},{key:"url",value:function(){return(0,s.default)(this.options)}},{key:"toString",value:function(){return this.url()}}]),n}()},{"./urlForImage":15}],13:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var c=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,i=!1,o=void 0;try{for(var l,s=e[Symbol.iterator]();!(r=(l=s.next()).done)&&(n.push(l.value),!t||n.length!==t);r=!0);}catch(e){i=!0,o=e}finally{try{!r&&s.return&&s.return()}finally{if(i)throw o}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")};n.default=function(e){var t=e.split("-"),n=c(t,4),r=n[1],i=n[2],o=n[3];if(!r||!i||!o)throw new Error("Malformed asset _ref '"+e+"'. Expected an id like \""+f+'".');var l=i.split("x"),s=c(l,2),a=+s[0],u=+s[1];if(!Number.isFinite(a)||!Number.isFinite(u))throw new Error("Malformed asset _ref '"+e+"'. Expected an id like \""+f+'".');return{id:r,width:a,height:u,format:o}};var f="image-Tb9Ew8CXIwaY6R1kjMvI0uRR-2000x3000-jpg"},{}],14:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r="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};n.default=function(e){if(!e)return null;var t,n=void 0;if("string"==typeof e)n={asset:{_ref:e}};else if("string"==typeof e._ref)n={asset:e};else if(e._id)n={asset:{_ref:e._id}};else{if("object"!==r(e.asset))return null;n=e}return(t=n).crop&&t.hotspot?t:Object.assign({crop:{left:0,top:0,bottom:0,right:0},hotspot:{x:.5,y:.5,height:1,width:1}},t)}},{}],15:[function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(n,"__esModule",{value:!0}),n.parseSource=void 0;var g=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,i=!1,o=void 0;try{for(var l,s=e[Symbol.iterator]();!(r=(l=s.next()).done)&&(n.push(l.value),!t||n.length!==t);r=!0);}catch(e){i=!0,o=e}finally{try{!r&&s.return&&s.return()}finally{if(i)throw o}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")};n.default=function(e){var t=Object.assign({},e||{}),n=t.source;delete t.source;var r=(0,m.default)(n);if(!r)return null;var i=(0,v.default)(r.asset._ref),o={left:Math.round(r.crop.left*i.width),top:Math.round(r.crop.top*i.height)};o.width=Math.round(i.width-r.crop.right*i.width-o.left),o.height=Math.round(i.height-r.crop.bottom*i.height-o.top);var l=r.hotspot.height*i.height/2,s=r.hotspot.width*i.width/2,a=r.hotspot.x*i.width,u=r.hotspot.y*i.height,c={left:a-s,top:u-l,right:a+s,bottom:u+s};return t.asset=i,t.rect||t.focalPoint||t.ignoreImageParams||t.crop||(t=Object.assign(t,function(e,t){var n={width:t.width,height:t.height};if(!t.width||!t.height)return n.rect=e.crop,n;var r=e.crop,i=e.hotspot,o=t.width/t.height;if(r.width/r.height>o){var l=r.height,s=l*o,a=r.top,u=(i.right-i.left)/2+i.left-s/2;return u<r.left?u=r.left:u+s>r.left+r.width&&(u=r.left+r.width-s),n.rect={left:Math.round(u),top:Math.round(a),width:Math.round(s),height:Math.round(l)},n}var c=r.width,f=c/o,h=r.left,p=(i.bottom-i.top)/2+i.top-f/2;return p<r.top?p=r.top:p+f>r.top+r.height&&(p=r.top+r.height-f),n.rect={left:Math.floor(h),top:Math.floor(p),width:Math.round(c),height:Math.round(f)},n}({crop:o,hotspot:c},t))),f=t,h=f.baseUrl||"https://cdn.sanity.io",p=f.asset.id+"-"+f.asset.width+"x"+f.asset.height+"."+f.asset.format,d=h+"/images/"+f.projectId+"/"+f.dataset+"/"+p,y=[],f.rect&&(0!=f.rect.left||0!=f.rect.top||f.rect.height!=f.asset.height||f.rect.width!=f.asset.width)&&y.push("rect="+f.rect.left+","+f.rect.top+","+f.rect.width+","+f.rect.height),f.focalPoint&&(y.push("fp-x="+f.focalPoint.x),y.push("fp-x="+f.focalPoint.y)),(f.flipHorizontal||f.flipVertical)&&y.push("flip="+(f.flipHorizontal?"h":"")+(f.flipVertical?"v":"")),b.forEach(function(e){var t=g(e,2),n=t[0],r=t[1];void 0!==f[n]?y.push(r+"="+encodeURIComponent(f[n])):void 0!==f[r]&&y.push(r+"="+encodeURIComponent(f[r]))}),0===y.length?d:d+"?"+y.join("&");var f,h,p,d,y};var m=r(e("./parseSource")),v=r(e("./parseAssetId")),b=[["width","w"],["height","h"],["format","fm"],["download","dl"],["blur","blur"],["sharpen","sharp"],["invert","invert"],["orientation","or"],["minHeight","min-h"],["maxHeight","max-h"],["minWidth","min-w"],["maxWidth","max-w"],["quality","q"],["fit","fit"],["crop","crop"]];n.parseSource=m.default},{"./parseAssetId":13,"./parseSource":14}],16:[function(e,t,n){},{}],17:[function(e,t,n){var c,f,h;t.exports=(f=String.prototype.split,h=/()??/.exec("")[1]===c,function(e,t,n){if("[object RegExp]"!==Object.prototype.toString.call(t))return f.call(e,t,n);var r,i,o,l,s=[],a=(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.extended?"x":"")+(t.sticky?"y":""),u=0;for(t=new RegExp(t.source,a+"g"),e+="",h||(r=new RegExp("^"+t.source+"$(?!\\s)",a)),n=n===c?-1>>>0:n>>>0;(i=t.exec(e))&&!((o=i.index+i[0].length)>u&&(s.push(e.slice(u,i.index)),!h&&1<i.length&&i[0].replace(r,function(){for(var e=1;e<arguments.length-2;e++)arguments[e]===c&&(i[e]=c)}),1<i.length&&i.index<e.length&&Array.prototype.push.apply(s,i.slice(1)),l=i[0].length,u=o,s.length>=n));)t.lastIndex===i.index&&t.lastIndex++;return u===e.length?!l&&t.test("")||s.push(""):s.push(e.slice(u)),s.length>n?s.slice(0,n):s})},{}],18:[function(e,t,n){function a(e){return!!e}var u=e("indexof");t.exports=function(r){function t(e){var t=o();-1<u(t,e)||(t.push(e),l(t))}function n(e){var t=o(),n=u(t,e);-1!==n&&(t.splice(n,1),l(t))}function i(e){return-1<u(o(),e)}function o(){return function(e,t){for(var n=[],r=0;r<e.length;r++)t(e[r])&&n.push(e[r]);return n}(r.className.split(" "),a)}function l(e){var t=e.length;r.className=e.join(" "),s.length=t;for(var n=0;n<e.length;n++)s[n]=e[n];delete e[t]}var e=r.classList;if(e)return e;var s={add:t,remove:n,contains:i,toggle:function(e){return i(e)?(n(e),!1):(t(e),!0)},toString:function(){return r.className},length:0,item:function(e){return o()[e]||null}};return s}},{indexof:20}],19:[function(e,t,n){function r(){function e(){function s(r){var t,e,n;if(null==r);else if("string"==typeof r)a?a.appendChild(t=d.createTextNode(r)):(n=h(r,/([\.#]?[^\s#.]+)/),/^\.|#/.test(n[1])&&(a=d.createElement("div")),f(n,function(e){var t=e.substring(1,e.length);e&&(a?"."===e[0]?p(a).add(t):"#"===e[0]&&a.setAttribute("id",t):a=d.createElement(e))}));else if("number"==typeof r||"boolean"==typeof r||r instanceof Date||r instanceof RegExp)a.appendChild(t=d.createTextNode(r.toString()));else if(e=r,"[object Array]"==Object.prototype.toString.call(e))f(r,s);else if(c(r))a.appendChild(t=r);else if(r instanceof y)a.appendChild(t=r);else if("object"==typeof r)for(var i in r)if("function"==typeof r[i])/^on\w+/.test(i)?function(e,t){a.addEventListener?(a.addEventListener(e.substring(2),t[e],!1),u.push(function(){a.removeEventListener(e.substring(2),t[e],!1)})):(a.attachEvent(e,t[e]),u.push(function(){a.detachEvent(e,t[e])}))}(i,r):(a[i]=r[i](),u.push(r[i](function(e){a[i]=e})));else if("style"===i)if("string"==typeof r[i])a.style.cssText=r[i];else for(var o in r[i])!function(t,e){if("function"==typeof e)a.style.setProperty(t,e()),u.push(e(function(e){a.style.setProperty(t,e)}));else var n=r[i][t].match(/(.*)\W+!important\W*$/);n?a.style.setProperty(t,n[1],"important"):a.style.setProperty(t,r[i][t])}(o,r[i][o]);else if("attrs"===i)for(var l in r[i])a.setAttribute(l,r[i][l]);else"data-"===i.substr(0,5)?a.setAttribute(i,r[i]):a[i]=r[i];else"function"==typeof r&&(l=r(),a.appendChild(t=c(l)?l:d.createTextNode(l)),u.push(r(function(e){c(e)&&t.parentElement?(t.parentElement.replaceChild(e,t),t=e):t.textContent=e})));return t}for(var e=[].slice.call(arguments),a=null;e.length;)s(e.shift());return a}var u=[];return e.cleanup=function(){for(var e=0;e<u.length;e++)u[e]();u.length=0},e}function c(e){return e&&e.nodeName&&e.nodeType}function f(e,t){if(e.forEach)return e.forEach(t);for(var n=0;n<e.length;n++)t(e[n],n)}var h=e("browser-split"),p=e("class-list"),i="undefined"==typeof window?e("html-element"):window,d=i.document,y=i.Text;(t.exports=r()).context=r},{"browser-split":17,"class-list":18,"html-element":16}],20:[function(e,t,n){var r=[].indexOf;t.exports=function(e,t){if(r)return e.indexOf(t);for(var n=0;n<e.length;++n)if(e[n]===t)return n;return-1}},{}],21:[function(e,t,n){"use strict";var a=Object.getOwnPropertySymbols,u=Object.prototype.hasOwnProperty,c=Object.prototype.propertyIsEnumerable;t.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,r,i=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),o=1;o<arguments.length;o++){for(var l in n=Object(arguments[o]))u.call(n,l)&&(i[l]=n[l]);if(a){r=a(n);for(var s=0;s<r.length;s++)c.call(n,r[s])&&(i[r[s]]=n[r[s]])}}return i}},{}]},{},[1])(1)});

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