@sanity/block-content-to-markdown
Version:
Transforming Sanity block content to markdown
48 lines (32 loc) • 23.2 kB
JavaScript
(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.SanityBlockContentToMarkdown = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
module.exports=require("./lib/toMarkdown");
},{"./lib/toMarkdown":3}],2:[function(require,module,exports){
;var _require=require("@sanity/block-content-to-hyperscript/internals"),getImageUrl=_require.getImageUrl;function renderChildren(r){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return Array.isArray(r.children)?r.children.join(e):r.children}function block(r){var e=r.node.style||"normal";return/^h\d$/.test(e)?new Array(parseInt(e[1],10)+1).join("#")+" "+renderChildren(r):"blockquote"===e?"> "+renderChildren(r):renderChildren(r)}function RawMarkSerializer(r,e,n){var i=renderChildren(n);if(e){var t=i.search(/\S/),l=i.search(/\S(?=\s*$)/);if(-1==l||-1==t)return i;var a=i.substring(0,t),d=i.substring(l+1);return""+a+r+i.substring(t,l+1)+r+d}return""+r+i+r}function link(r){var e=r.mark,n=e.href,i=e.title,t=i?" "+JSON.stringify(i):"";return"["+renderChildren(r)+"]("+n+t+")"}function list(r){var e=new Array(r.level||1).join(" ");return e+renderChildren(r,"\n"+e)}function listItem(r){return("bullet"===r.node.listItem?"*":r.index+1+".")+" "+renderChildren(r)}function image(r){var e=r.title;return"+(e?" "+JSON.stringify(e):"")+")"}function container(r){return renderChildren(r,"\n\n")}function hardBreak(){return" \n"}module.exports={types:{block:block,image:image},marks:{"strike-through":RawMarkSerializer.bind(null,"~~",!0),em:RawMarkSerializer.bind(null,"_",!0),code:RawMarkSerializer.bind(null,"`",!1),strong:RawMarkSerializer.bind(null,"**",!0),underline:renderChildren,link:link},list:list,listItem:listItem,container:container,hardBreak:hardBreak,markFallback:renderChildren};
},{"@sanity/block-content-to-hyperscript/internals":4}],3:[function(require,module,exports){
;var _require=require("@sanity/block-content-to-hyperscript/internals"),getImageUrl=_require.getImageUrl,getSerializers=_require.getSerializers,blocksToNodes=_require.blocksToNodes,mergeSerializers=_require.mergeSerializers,mdSerializers=require("./serializers"),disallowedEmptyMarks=["strike-through","em","strong","underline"],sanitizeEmptyMarkedSpans=function e(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i=function(r){if("block"===r._type&&Array.isArray(r.children)){var i=Object.assign({},r);return i.children=e(r.children),i}if("span"===r._type&&0==r.text.length&&Array.isArray(r.marks)){var a=r.marks.filter(function(e){return!disallowedEmptyMarks.includes(e)});return 0==a.length?null:Object.assign({},r,{marks:a})}return r};return Array.isArray(r)?r.map(i).filter(function(e){return!!e}):i(r)},renderNode=function(e,r,i){var a=i||r.node&&r.node.children;return e(Object.assign({},r,{children:a}))},_getSerializers=getSerializers(renderNode),defaultSerializers=_getSerializers.defaultSerializers,serializeSpan=_getSerializers.serializeSpan,markdownSerializers=mergeSerializers(defaultSerializers,mdSerializers),toMarkdown=function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=sanitizeEmptyMarkedSpans(e||[]),a=mergeSerializers(markdownSerializers,r.serializers||{}),s=Object.assign({},r,{blocks:i,serializers:a,listNestMode:"last-child"});return blocksToNodes(renderNode,s,defaultSerializers,serializeSpan).trim()};toMarkdown.defaultSerializers=defaultSerializers,toMarkdown.getImageUrl=getImageUrl,module.exports=toMarkdown;
},{"./serializers":2,"@sanity/block-content-to-hyperscript/internals":4}],4:[function(require,module,exports){
module.exports=require("./lib/internals");
},{"./lib/internals":9}],5:[function(require,module,exports){
;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:{}};function blocksToNodes(e,r,i,t){var s=objectAssign({},defaults,r),n=Array.isArray(s.blocks)?s.blocks:[s.blocks],o=generateKeys(n),a=nestLists(o,s.listNestMode),l=mergeSerializers(i,s.serializers||{}),u=optionProps.reduce(function(e,r){var i=s[r];return isDefined(i)&&(e[r]=i),e},{});function c(r,i,s,n){return isList(r)?(a=(o=r).listItem,p=o.level,m=o._key,d=o.children.map(c),e(l.list,{key:m,level:p,type:a,options:u},d)):isListItem(r)?function(r,i){var t=r._key,s=buildMarksTree(r).map(c);return e(l.listItem,{node:r,serializers:l,index:i,key:t,options:u},s)}(r,function(e,r){for(var i=0,t=0;t<r.length;t++){if(r[t]===e)return i;isListItem(r[t])&&i++}return i}(r,s)):isSpan(r)?t(r,l,i,{serializeNode:c}):function(r,i,t){var s=buildMarksTree(r).map(function(e,r,i){return c(e,r,i,!0)}),n={key:r._key||"block-".concat(i),node:r,isInline:t,serializers:l,options:u};return e(l.block,n,s)}(r,i,n);var o,a,p,m,d}var p=Boolean(s.renderContainerOnSingleChild),m=a.map(c);if(p||m.length>1){var d=s.className?{className:s.className}:{};return e(l.container,d,m)}return m[0]?m[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}module.exports=blocksToNodes;
},{"./buildMarksTree":6,"./generateKeys":7,"./mergeSerializers":10,"./nestLists":11,"object-assign":15}],6:[function(require,module,exports){
;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,f=t.indexOf(c);if(-1===f)break;t.splice(f,1)}var l=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};l.children.push(a),i.push(a),l=a}),isTextSpan(r)){for(var u=r.text.split("\n"),d=u.length;d-- >1;)u.splice(d,0,"\n");l.children=l.children.concat(u)}else l.children=l.children.concat(r)}else{i[i.length-1].children.push(r)}}),t.children};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)||-1===i.marks.indexOf(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"span"===r._type&&"string"==typeof r.text&&(Array.isArray(r.marks)||void 0===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}}module.exports=buildMarksTree;
},{}],7:[function(require,module,exports){
;var objectAssign=require("object-assign");function getStaticKey(t){return checksum(JSON.stringify(t)).toString(36).replace(/[^A-Za-z0-9]/g,"")}function checksum(t){var e=0,r=t.length;if(0===r)return e;for(var n=0;n<r;n++)e=(e<<5)-e+t.charCodeAt(n),e&=e;return e}module.exports=function(t){return t.map(function(t){return t._key?t:objectAssign({_key:getStaticKey(t)},t)})};
},{"object-assign":15}],8:[function(require,module,exports){
;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 ".concat(generateHelpUrl("block-content-image-materializing")),getQueryString=function(e){var r=e.imageOptions,t=Object.keys(r);if(!t.length)return"";var n=t.map(function(e){return"".concat(enc(e),"=").concat(enc(r[e]))});return"?".concat(n.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(r).toString()};module.exports=buildUrl;
},{"@sanity/generate-help-url":13,"@sanity/image-url":14,"object-assign":15}],9:[function(require,module,exports){
;var getSerializers=require("./serializers"),_blocksToNodes=require("./blocksToNodes"),getImageUrl=require("./getImageUrl"),mergeSerializers=require("./mergeSerializers");module.exports={blocksToNodes:function(e,r,i,s){if(i)return _blocksToNodes(e,r,i,s);var l=getSerializers(e);return _blocksToNodes(e,r,l.defaultSerializers,l.serializeSpan)},getSerializers:getSerializers,getImageUrl:getImageUrl,mergeSerializers:mergeSerializers};
},{"./blocksToNodes":5,"./getImageUrl":8,"./mergeSerializers":10,"./serializers":12}],10:[function(require,module,exports){
;function _typeof(o){return(_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})(o)}var 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}],11:[function(require,module,exports){
;var objectAssign=require("object-assign");function nestLists(e){for(var l,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"html",i=[],s=0;s<e.length;s++){var n=e[s];if(isListBlock(n))if(l)if(blockMatchesList(n,l))l.children.push(n);else if(n.level>l.level){var r=listFromBlock(n);if("html"===t){var c=lastChild(l),o=objectAssign({},c,{children:c.children.concat(r)});l.children[l.children.length-1]=o}else l.children.push(r);l=r}else if(n.level<l.level){var h=findListMatching(i[i.length-1],n);if(h){(l=h).children.push(n);continue}l=listFromBlock(n),i.push(l)}else if(n.listItem===l.listItem)console.warn("Unknown state encountered for block",n),i.push(n);else{var u=findListMatching(i[i.length-1],{level:n.level});if(u&&u.listItem===n.listItem){(l=u).children.push(n);continue}l=listFromBlock(n),i.push(l)}else l=listFromBlock(n),i.push(l);else i.push(n),l=null}return i}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:"".concat(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)}module.exports=nestLists;
},{"object-assign":15}],12:[function(require,module,exports){
;var objectAssign=require("object-assign"),getImageUrl=require("./getImageUrl");module.exports=function(e,n){var r=n||{useDashedStyles:!1};function t(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){if(!n.node.asset)return null;var r=e("img",{src:getImageUrl(n)});return n.isInline?r:e("figure",null,r)}},marks:{strong:t.bind(null,"strong"),em:t.bind(null,"em"),code:t.bind(null,"code"),underline:function(n){var t=r.useDashedStyles?{"text-decoration":"underline"}:{textDecoration:"underline"};return e("span",{style:t},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){var r=n.node.style&&"normal"!==n.node.style?e(n.serializers.types.block,n,n.children):n.children;return e("li",null,r)},block:function(n){var r=n.node,t=n.serializers,i=n.options,l=n.isInline,a=n.children,o=r._type,s=t.types[o];if(!s)throw new Error('Unknown block type "'.concat(o,'", please specify a serializer for it in the `serializers.types` prop'));return e(s,{node:r,options:i,isInline:l},a)},span:function(n){var r=n.node,t=r.mark,i=r.children,l="string"==typeof t?t:t._type,a=n.serializers.marks[l];return a?e(a,n.node,i):(console.warn('Unknown mark type "'.concat(l,'", please specify a serializer for it in the `serializers.marks` prop')),e(n.serializers.markFallback,null,i))},hardBreak:function(){return e("br")},container:"div",markFallback:"span",text:void 0,empty:""},serializeSpan:function(n,r,t,i){if("\n"===n&&r.hardBreak)return e(r.hardBreak,{key:"hb-".concat(t)});if("string"==typeof n)return r.text?e(r.text,{key:"text-".concat(t)},n):n;var l;n.children&&(l={children:n.children.map(function(e,r){return i.serializeNode(e,r,n.children,!0)})});var a=objectAssign({},n,l);return e(r.span,{key:n._key||"span-".concat(t),node:a,serializers:r})}}};
},{"./getImageUrl":8,"object-assign":15}],13:[function(require,module,exports){
var baseUrl="https://docs.sanity.io/help/";module.exports=function(e){return baseUrl+e};
},{}],14:[function(require,module,exports){
!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?module.exports=i():"function"==typeof define&&define.amd?define(i):(t=t||self).SanityImageUrlBuilder=i()}(this,function(){function t(){return(t=Object.assign||function(t){for(var i=1;i<arguments.length;i++){var r=arguments[i];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}function i(t,i){(null==i||i>t.length)&&(i=t.length);for(var r=0,n=new Array(i);r<i;r++)n[r]=t[r];return n}function r(t){var r=0;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(t=function(t,r){if(t){if("string"==typeof t)return i(t,r);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)?i(t,r):void 0}}(t)))return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(r=t[Symbol.iterator]()).next.bind(r)}var n="image-Tb9Ew8CXIwaY6R1kjMvI0uRR-2000x3000-jpg";var o=function(t){return!!t&&"string"==typeof t._ref},e=function(t){return!!t&&"string"==typeof t._id},h=function(t){var i=t;return!(!i||!i.asset)&&"string"==typeof i.asset.url};function a(i){if(!i)return null;var r;if("string"==typeof i&&/^https?:\/\//.test(""+i))r={asset:{_ref:s(i)}};else if("string"==typeof i)r={asset:{_ref:i}};else if(o(i))r={asset:i};else if(e(i))r={asset:{_ref:i._id||""}};else if(h(i))r={asset:{_ref:s(i.asset.url)}};else{if("object"!=typeof i.asset)return null;r=i}var n=i;return n.crop&&(r.crop=n.crop),n.hotspot&&(r.hotspot=n.hotspot),function(i){if(i.crop&&i.hotspot)return i;var r=t({},i);r.crop||(r.crop={left:0,top:0,bottom:0,right:0});r.hotspot||(r.hotspot={x:.5,y:.5,height:1,width:1});return r}(r)}function s(t){return("image-"+t.split("/").slice(-1)[0]).replace(/\.([a-z]+)$/,"-$1")}var u=[["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"],["saturation","sat"],["auto","auto"],["dpr","dpr"],["pad","pad"]];function f(i){var r=t({},i||{}),o=r.source;delete r.source;var e=a(o);if(!e)return null;var h=function(t){var i=t.split("-"),r=i[1],o=i[2],e=i[3];if(!r||!o||!e)throw new Error("Malformed asset _ref '"+t+"'. Expected an id like \""+n+'".');var h=o.split("x"),a=+h[0],s=+h[1];if(!isFinite(a)||!isFinite(s))throw new Error("Malformed asset _ref '"+t+"'. Expected an id like \""+n+'".');return{id:r,width:a,height:s,format:e}}(e.asset._ref||e.asset._id||""),s=Math.round(e.crop.left*h.width),f=Math.round(e.crop.top*h.height),p={left:s,top:f,width:Math.round(h.width-e.crop.right*h.width-s),height:Math.round(h.height-e.crop.bottom*h.height-f)},c=e.hotspot.height*h.height/2,l=e.hotspot.width*h.width/2,d=e.hotspot.x*h.width,w=e.hotspot.y*h.height,g={left:d-l,top:w-c,right:d+l,bottom:w+c};return r.rect||r.focalPoint||r.ignoreImageParams||r.crop||(r=t(t({},r),function(t,i){var r,n=i.width,o=i.height;if(!n||!o)return{width:n,height:o,rect:t.crop};var e=t.crop,h=t.hotspot,a=n/o;if(e.width/e.height>a){var s=e.height,u=s*a,f=e.top,p=(h.right-h.left)/2+h.left,c=p-u/2;c<e.left?c=e.left:c+u>e.left+e.width&&(c=e.left+e.width-u),r={left:Math.round(c),top:Math.round(f),width:Math.round(u),height:Math.round(s)}}else{var l=e.width,d=l/a,w=e.left,g=(h.bottom-h.top)/2+h.top,m=g-d/2;m<e.top?m=e.top:m+d>e.top+e.height&&(m=e.top+e.height-d),r={left:Math.max(0,Math.floor(w)),top:Math.max(0,Math.floor(m)),width:Math.round(l),height:Math.round(d)}}return{width:n,height:o,rect:r}}({crop:p,hotspot:g},r))),function(t){var i=t.baseUrl||"https://cdn.sanity.io",r=t.asset.id+"-"+t.asset.width+"x"+t.asset.height+"."+t.asset.format,n=i+"/images/"+t.projectId+"/"+t.dataset+"/"+r,o=[];if(t.rect){var e=t.rect,h=e.left,a=e.top,s=e.width,f=e.height,p=0!==h||0!==a||f!==t.asset.height||s!==t.asset.width;p&&o.push("rect="+h+","+a+","+s+","+f)}t.bg&&o.push("bg="+t.bg);t.focalPoint&&(o.push("fp-x="+t.focalPoint.x),o.push("fp-y="+t.focalPoint.y));var c=[t.flipHorizontal&&"h",t.flipVertical&&"v"].filter(Boolean).join("");c&&o.push("flip="+c);if(u.forEach(function(i){var r=i[0],n=i[1];void 0!==t[r]?o.push(n+"="+encodeURIComponent(t[r])):void 0!==t[n]&&o.push(n+"="+encodeURIComponent(t[n]))}),0===o.length)return n;return n+"?"+o.join("&")}(t(t({},r),{},{asset:h}))}var p=["clip","crop","fill","fillmax","max","scale","min"],c=["top","bottom","left","right","center","focalpoint","entropy"],l=["format"];function d(t){for(var i,n=r(u);!(i=n()).done;){var o=i.value,e=o[0],h=o[1];if(t===e||t===h)return e}return t}var w=function(){function i(i,r){this.options=t(i?t({},i.options||{}):{},r||{})}var r=i.prototype;return r.withOptions=function(r){var n=r.baseUrl||this.options.baseUrl,o={baseUrl:n};for(var e in r){if(r.hasOwnProperty(e))o[d(e)]=r[e]}return new i(this,t({baseUrl:n},o))},r.image=function(t){return this.withOptions({source:t})},r.dataset=function(t){return this.withOptions({dataset:t})},r.projectId=function(t){return this.withOptions({projectId:t})},r.bg=function(t){return this.withOptions({bg:t})},r.dpr=function(t){return this.withOptions({dpr:t})},r.width=function(t){return this.withOptions({width:t})},r.height=function(t){return this.withOptions({height:t})},r.focalPoint=function(t,i){return this.withOptions({focalPoint:{x:t,y:i}})},r.maxWidth=function(t){return this.withOptions({maxWidth:t})},r.minWidth=function(t){return this.withOptions({minWidth:t})},r.maxHeight=function(t){return this.withOptions({maxHeight:t})},r.minHeight=function(t){return this.withOptions({minHeight:t})},r.size=function(t,i){return this.withOptions({width:t,height:i})},r.blur=function(t){return this.withOptions({blur:t})},r.sharpen=function(t){return this.withOptions({sharpen:t})},r.rect=function(t,i,r,n){return this.withOptions({rect:{left:t,top:i,width:r,height:n}})},r.format=function(t){return this.withOptions({format:t})},r.invert=function(t){return this.withOptions({invert:t})},r.orientation=function(t){return this.withOptions({orientation:t})},r.quality=function(t){return this.withOptions({quality:t})},r.forceDownload=function(t){return this.withOptions({download:t})},r.flipHorizontal=function(){return this.withOptions({flipHorizontal:!0})},r.flipVertical=function(){return this.withOptions({flipVertical:!0})},r.ignoreImageParams=function(){return this.withOptions({ignoreImageParams:!0})},r.fit=function(t){if(-1===p.indexOf(t))throw new Error('Invalid fit mode "'+t+'"');return this.withOptions({fit:t})},r.crop=function(t){if(-1===c.indexOf(t))throw new Error('Invalid crop mode "'+t+'"');return this.withOptions({crop:t})},r.saturation=function(t){return this.withOptions({saturation:t})},r.auto=function(t){if(-1===l.indexOf(t))throw new Error('Invalid auto mode "'+t+'"');return this.withOptions({auto:t})},r.pad=function(t){return this.withOptions({pad:t})},r.url=function(){return f(this.options)},r.toString=function(){return this.url()},i}();return function(t){var i=t;if(function(t){return!!t&&"object"==typeof t.clientConfig}(i)){var r=i.clientConfig,n=r.apiHost,o=r.projectId,e=r.dataset;return new w(null,{baseUrl:(n||"https://api.sanity.io").replace(/^https:\/\/api\./,"https://cdn."),projectId:o,dataset:e})}return new w(null,t)}});
},{}],15:[function(require,module,exports){
;var getOwnPropertySymbols=Object.getOwnPropertySymbols,hasOwnProperty=Object.prototype.hasOwnProperty,propIsEnumerable=Object.prototype.propertyIsEnumerable;function toObject(e){if(null==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}}module.exports=shouldUseNative()?Object.assign:function(e,r){for(var t,n,o=toObject(e),a=1;a<arguments.length;a++){for(var s in t=Object(arguments[a]))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};
},{}]},{},[1])(1)
});