microcms-js-sdk 2.7.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +158 -32
- package/dist/esm/microcms-js-sdk.js +1 -1
- package/dist/esm/microcms-js-sdk.js.map +1 -1
- package/dist/iife/microcms-js-sdk.js +1 -1
- package/dist/iife/microcms-js-sdk.js.map +1 -1
- package/dist/microcms-js-sdk.d.mts +36 -3
- package/dist/microcms-js-sdk.d.ts +36 -3
- package/dist/microcms-js-sdk.js +1 -1
- package/dist/microcms-js-sdk.js.map +1 -1
- package/dist/umd/microcms-js-sdk.js +1 -1
- package/dist/umd/microcms-js-sdk.js.map +1 -1
- package/package.json +20 -21
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function t(t,e){if(e==null||e>t.length)e=t.length;for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function e(e){if(Array.isArray(e))return t(e)}function r(t,e,r,n,o,i,a){try{var u=t[i](a);var s=u.value}catch(t){r(t);return}if(u.done){e(s)}else{Promise.resolve(s).then(n,o)}}function n(t){return function(){var e=this,n=arguments;return new Promise(function(o,i){var a=t.apply(e,n);function u(t){r(a,o,i,u,s,"next",t)}function s(t){r(a,o,i,u,s,"throw",t)}u(undefined)})}}function o(t,e,r){if(e in t){Object.defineProperty(t,e,{value:r,enumerable:true,configurable:true,writable:true})}else{t[e]=r}return t}function i(t,e){if(e!=null&&typeof Symbol!=="undefined"&&e[Symbol.hasInstance]){return!!e[Symbol.hasInstance](t)}else{return t instanceof e}}function a(t){if(typeof Symbol!=="undefined"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function u(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function s(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};var n=Object.keys(r);if(typeof Object.getOwnPropertySymbols==="function"){n=n.concat(Object.getOwnPropertySymbols(r).filter(function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable}))}n.forEach(function(e){o(t,e,r[e])})}return t}function c(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);if(e){n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})}r.push.apply(r,n)}return r}function f(t,e){e=e!=null?e:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(t,Object.getOwnPropertyDescriptors(e))}else{c(Object(e)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))})}return t}function p(t){return e(t)||a(t)||y(t)||u()}function l(t){"@swc/helpers - typeof";return t&&typeof Symbol!=="undefined"&&t.constructor===Symbol?"symbol":typeof t}function y(e,r){if(!e)return;if(typeof e==="string")return t(e,r);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor)n=e.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return t(e,r)}function d(t,e){var r,n,o,i,a={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]};return(i={next:u(0),"throw":u(1),"return":u(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i);function u(t){return function(e){return s([t,e])}}function s(i){if(r)throw new TypeError("Generator is already executing.");while(a)try{if(r=1,n&&(o=i[0]&2?n["return"]:i[0]?n["throw"]||((o=n["return"])&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;if(n=0,o)i=[i[0]&2,o.value];switch(i[0]){case 0:case 1:o=i;break;case 4:a.label++;return{value:i[1],done:false};case 5:a.label++;n=i[1];i=[0];continue;case 7:i=a.ops.pop();a.trys.pop();continue;default:if(!(o=a.trys,o=o.length>0&&o[o.length-1])&&(i[0]===6||i[0]===2)){a=0;continue}if(i[0]===3&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(i[0]===6&&a.label<o[1]){a.label=o[1];o=i;break}if(o&&a.label<o[2]){a.label=o[2];a.ops.push(i);break}if(o[2])a.ops.pop();a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t];n=0}finally{r=o=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:true}}}var microcms=function(){var t=Object.create;var e=Object.defineProperty;var r=Object.getOwnPropertyDescriptor;var o=Object.getOwnPropertyNames;var a=Object.getPrototypeOf,u=Object.prototype.hasOwnProperty;var c=function(t,e){return function(){return e||t((e={exports:{}}).exports,e),e.exports}},y=function(t,r){for(var n in r)e(t,n,{get:r[n],enumerable:!0})},h=function(t,n,i,a){var s=true,c=false,f=undefined;if(n&&typeof n=="object"||typeof n=="function")try{var p=function(){var o=y.value;!u.call(t,o)&&o!==i&&e(t,o,{get:function(){return n[o]},enumerable:!(a=r(n,o))||a.enumerable})};for(var l=o(n)[Symbol.iterator](),y;!(s=(y=l.next()).done);s=true)p()}catch(t){c=true;f=t}finally{try{if(!s&&l.return!=null){l.return()}}finally{if(c){throw f}}}return t};var m=function(r,n,o){return o=r!=null?t(a(r)):{},h(n||!r||!r.__esModule?e(o,"default",{value:r,enumerable:!0}):o,r)},b=function(t){return h(e({},"__esModule",{value:!0}),t)};var v=c(function(t,e){"use strict";e.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(l(Symbol.iterator)=="symbol")return!0;var t={},e=Symbol("test"),r=Object(e);if(typeof e=="string"||Object.prototype.toString.call(e)!=="[object Symbol]"||Object.prototype.toString.call(r)!=="[object Symbol]")return!1;var n=42;t[e]=n;for(e in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var o=Object.getOwnPropertySymbols(t);if(o.length!==1||o[0]!==e||!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var i=Object.getOwnPropertyDescriptor(t,e);if(i.value!==n||i.enumerable!==!0)return!1}return!0}});var g=c(function(t,e){"use strict";var r=(typeof Symbol==="undefined"?"undefined":l(Symbol))<"u"&&Symbol,n=v();e.exports=function(){return typeof r!="function"||typeof Symbol!="function"||l(r("foo"))!="symbol"||l(Symbol("bar"))!="symbol"?!1:n()}});var w=c(function(t,e){"use strict";var r={foo:{}},n=Object;e.exports=function(){return({__proto__:r}).foo===r.foo&&!i({__proto__:null},n)}});var A=c(function(t,e){"use strict";var r="Function.prototype.bind called on incompatible ",n=Array.prototype.slice,o=Object.prototype.toString,a="[object Function]";e.exports=function(t){var e=this;if(typeof e!="function"||o.call(e)!==a)throw new TypeError(r+e);for(var u=n.call(arguments,1),s,c=function r(){if(i(this,s)){var r=e.apply(this,u.concat(n.call(arguments)));return Object(r)===r?r:this}else return e.apply(t,u.concat(n.call(arguments)))},f=Math.max(0,e.length-u.length),p=[],l=0;l<f;l++)p.push("$"+l);if(s=Function("binder","return function ("+p.join(",")+"){ return binder.apply(this,arguments); }")(c),e.prototype){var y=function t(){};y.prototype=e.prototype,s.prototype=new y,y.prototype=null}return s}});var O=c(function(t,e){"use strict";var r=A();e.exports=Function.prototype.bind||r});var j=c(function(t,e){"use strict";var r=O();e.exports=r.call(Function.call,Object.prototype.hasOwnProperty)});var S=c(function(t,e){"use strict";var r,n=SyntaxError,o=Function,i=TypeError,a=function t(t){try{return o('"use strict"; return ('+t+").constructor;")()}catch(t){}},u=Object.getOwnPropertyDescriptor;if(u)try{u({},"")}catch(t){u=null}var s=function t(){throw new i},c=u?function(){try{return arguments.callee,s}catch(t){try{return u(arguments,"callee").get}catch(t){return s}}}():s,f=g()(),p=w()(),y=Object.getPrototypeOf||(p?function(t){return t.__proto__}:null),d={},h=(typeof Uint8Array==="undefined"?"undefined":l(Uint8Array))>"u"||!y?r:y(Uint8Array),m={"%AggregateError%":(typeof AggregateError==="undefined"?"undefined":l(AggregateError))>"u"?r:AggregateError,"%Array%":Array,"%ArrayBuffer%":(typeof ArrayBuffer==="undefined"?"undefined":l(ArrayBuffer))>"u"?r:ArrayBuffer,"%ArrayIteratorPrototype%":f&&y?y([][Symbol.iterator]()):r,"%AsyncFromSyncIteratorPrototype%":r,"%AsyncFunction%":d,"%AsyncGenerator%":d,"%AsyncGeneratorFunction%":d,"%AsyncIteratorPrototype%":d,"%Atomics%":(typeof Atomics==="undefined"?"undefined":l(Atomics))>"u"?r:Atomics,"%BigInt%":(typeof BigInt==="undefined"?"undefined":l(BigInt))>"u"?r:BigInt,"%BigInt64Array%":(typeof BigInt64Array==="undefined"?"undefined":l(BigInt64Array))>"u"?r:BigInt64Array,"%BigUint64Array%":(typeof BigUint64Array==="undefined"?"undefined":l(BigUint64Array))>"u"?r:BigUint64Array,"%Boolean%":Boolean,"%DataView%":(typeof DataView==="undefined"?"undefined":l(DataView))>"u"?r:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":(typeof Float32Array==="undefined"?"undefined":l(Float32Array))>"u"?r:Float32Array,"%Float64Array%":(typeof Float64Array==="undefined"?"undefined":l(Float64Array))>"u"?r:Float64Array,"%FinalizationRegistry%":(typeof FinalizationRegistry==="undefined"?"undefined":l(FinalizationRegistry))>"u"?r:FinalizationRegistry,"%Function%":o,"%GeneratorFunction%":d,"%Int8Array%":(typeof Int8Array==="undefined"?"undefined":l(Int8Array))>"u"?r:Int8Array,"%Int16Array%":(typeof Int16Array==="undefined"?"undefined":l(Int16Array))>"u"?r:Int16Array,"%Int32Array%":(typeof Int32Array==="undefined"?"undefined":l(Int32Array))>"u"?r:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":f&&y?y(y([][Symbol.iterator]())):r,"%JSON%":typeof JSON=="object"?JSON:r,"%Map%":(typeof Map==="undefined"?"undefined":l(Map))>"u"?r:Map,"%MapIteratorPrototype%":(typeof Map==="undefined"?"undefined":l(Map))>"u"||!f||!y?r:y(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":(typeof Promise==="undefined"?"undefined":l(Promise))>"u"?r:Promise,"%Proxy%":(typeof Proxy==="undefined"?"undefined":l(Proxy))>"u"?r:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":(typeof Reflect==="undefined"?"undefined":l(Reflect))>"u"?r:Reflect,"%RegExp%":RegExp,"%Set%":(typeof Set==="undefined"?"undefined":l(Set))>"u"?r:Set,"%SetIteratorPrototype%":(typeof Set==="undefined"?"undefined":l(Set))>"u"||!f||!y?r:y(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":(typeof SharedArrayBuffer==="undefined"?"undefined":l(SharedArrayBuffer))>"u"?r:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":f&&y?y(""[Symbol.iterator]()):r,"%Symbol%":f?Symbol:r,"%SyntaxError%":n,"%ThrowTypeError%":c,"%TypedArray%":h,"%TypeError%":i,"%Uint8Array%":(typeof Uint8Array==="undefined"?"undefined":l(Uint8Array))>"u"?r:Uint8Array,"%Uint8ClampedArray%":(typeof Uint8ClampedArray==="undefined"?"undefined":l(Uint8ClampedArray))>"u"?r:Uint8ClampedArray,"%Uint16Array%":(typeof Uint16Array==="undefined"?"undefined":l(Uint16Array))>"u"?r:Uint16Array,"%Uint32Array%":(typeof Uint32Array==="undefined"?"undefined":l(Uint32Array))>"u"?r:Uint32Array,"%URIError%":URIError,"%WeakMap%":(typeof WeakMap==="undefined"?"undefined":l(WeakMap))>"u"?r:WeakMap,"%WeakRef%":(typeof WeakRef==="undefined"?"undefined":l(WeakRef))>"u"?r:WeakRef,"%WeakSet%":(typeof WeakSet==="undefined"?"undefined":l(WeakSet))>"u"?r:WeakSet};if(y)try{null.error}catch(t){b=y(y(t)),m["%Error.prototype%"]=b}var b,v=function t(e){var r;if(e==="%AsyncFunction%")r=a("async function () {}");else if(e==="%GeneratorFunction%")r=a("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=a("async function* () {}");else if(e==="%AsyncGenerator%"){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var o=t("%AsyncGenerator%");o&&y&&(r=y(o.prototype))}return m[e]=r,r},A={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},S=O(),P=j(),E=S.call(Function.call,Array.prototype.concat),x=S.call(Function.apply,Array.prototype.splice),_=S.call(Function.call,String.prototype.replace),I=S.call(Function.call,String.prototype.slice),T=S.call(Function.call,RegExp.prototype.exec),R=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,F=/\\(\\)?/g,D=function t(t){var e=I(t,0,1),r=I(t,-1);if(e==="%"&&r!=="%")throw new n("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&e!=="%")throw new n("invalid intrinsic syntax, expected opening `%`");var o=[];return _(t,R,function(t,e,r,n){o[o.length]=r?_(n,F,"$1"):e||t}),o},k=function t(t,e){var r=t,o;if(P(A,r)&&(o=A[r],r="%"+o[0]+"%"),P(m,r)){var a=m[r];if(a===d&&(a=v(r)),(typeof a==="undefined"?"undefined":l(a))>"u"&&!e)throw new i("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:o,name:r,value:a}}throw new n("intrinsic "+t+" does not exist!")};e.exports=function(t,e){if(typeof t!="string"||t.length===0)throw new i("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new i('"allowMissing" argument must be a boolean');if(T(/^%?[^%]*%?$/,t)===null)throw new n("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=D(t),o=r.length>0?r[0]:"",a=k("%"+o+"%",e),s=a.name,c=a.value,f=!1,p=a.alias;p&&(o=p[0],x(r,E([0,1],p)));for(var l=1,y=!0;l<r.length;l+=1){var d=r[l],h=I(d,0,1),b=I(d,-1);if((h==='"'||h==="'"||h==="`"||b==='"'||b==="'"||b==="`")&&h!==b)throw new n("property names with quotes must have matching quotes");if((d==="constructor"||!y)&&(f=!0),o+="."+d,s="%"+o+"%",P(m,s))c=m[s];else if(c!=null){if(!(d in c)){if(!e)throw new i("base intrinsic for "+t+" exists, but the property is not available.");return}if(u&&l+1>=r.length){var v=u(c,d);y=!!v,y&&"get"in v&&!("originalValue"in v.get)?c=v.get:c=c[d]}else y=P(c,d),c=c[d];y&&!f&&(m[s]=c)}}return c}});var P=c(function(t,e){"use strict";var r=O(),n=S(),o=n("%Function.prototype.apply%"),i=n("%Function.prototype.call%"),a=n("%Reflect.apply%",!0)||r.call(i,o),u=n("%Object.getOwnPropertyDescriptor%",!0),s=n("%Object.defineProperty%",!0),c=n("%Math.max%");if(s)try{s({},"a",{value:1})}catch(t){s=null}e.exports=function(t){var e=a(r,i,arguments);if(u&&s){var n=u(e,"length");n.configurable&&s(e,"length",{value:1+c(0,t.length-(arguments.length-1))})}return e};var f=function t(){return a(r,o,arguments)};s?s(e.exports,"apply",{value:f}):e.exports.apply=f});var E=c(function(t,e){"use strict";var r=S(),n=P(),o=n(r("String.prototype.indexOf"));e.exports=function(t,e){var i=r(t,!!e);return typeof i=="function"&&o(t,".prototype.")>-1?n(i):i}});var x=c(function(){"use strict"});var _=c(function(t,e){"use strict";var r=function t(t,e,r){var n=(r.quoteStyle||e)==="double"?'"':"'";return n+t+n};var n=function t(t){return String(t).replace(/"/g,""")};var o=function t(t){return m(t)==="[object Array]"&&(!ti||!(typeof t=="object"&&ti in t))};var a=function t(t){return m(t)==="[object Date]"&&(!ti||!(typeof t=="object"&&ti in t))};var u=function t(t){return m(t)==="[object RegExp]"&&(!ti||!(typeof t=="object"&&ti in t))};var s=function t(t){return m(t)==="[object Error]"&&(!ti||!(typeof t=="object"&&ti in t))};var c=function t(t){return m(t)==="[object String]"&&(!ti||!(typeof t=="object"&&ti in t))};var f=function t(t){return m(t)==="[object Number]"&&(!ti||!(typeof t=="object"&&ti in t))};var p=function t(t){return m(t)==="[object Boolean]"&&(!ti||!(typeof t=="object"&&ti in t))};var y=function t(t){if((typeof t==="undefined"?"undefined":l(t))=="symbol")return!0;if(!t||typeof t!="object"||!tt)return!1;try{return tt.call(t),!0}catch(t){}return!1};var d=function t(t){if(!t||typeof t!="object"||!Y)return!1;try{return Y.call(t),!0}catch(t){}return!1};var h=function t(t,e){return ta.call(t,e)};var m=function t(t){return $.call(t)};var b=function t(t){if(t.name)return t.name;var e=X.call(K.call(t),/^function\s*([\w$]+)/);return e?e[1]:null};var v=function t(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0,n=t.length;r<n;r++)if(t[r]===e)return r;return-1};var g=function t(t){if(!U||!t||typeof t!="object")return!1;try{U.call(t);try{N.call(t)}catch(t){return!0}return i(t,Map)}catch(t){}return!1};var w=function t(t){if(!H||!t||typeof t!="object")return!1;try{H.call(t,H);try{z.call(t,z)}catch(t){return!0}return i(t,WeakMap)}catch(t){}return!1};var A=function t(t){if(!J||!t||typeof t!="object")return!1;try{return J.call(t),!0}catch(t){}return!1};var O=function t(t){if(!N||!t||typeof t!="object")return!1;try{N.call(t);try{U.call(t)}catch(t){return!0}return i(t,Set)}catch(t){}return!1};var j=function t(t){if(!z||!t||typeof t!="object")return!1;try{z.call(t,z);try{H.call(t,H)}catch(t){return!0}return i(t,WeakSet)}catch(t){}return!1};var S=function t(t){return!t||typeof t!="object"?!1:(typeof HTMLElement==="undefined"?"undefined":l(HTMLElement))<"u"&&i(t,HTMLElement)?!0:typeof t.nodeName=="string"&&typeof t.getAttribute=="function"};var P=function t(t){var e=t.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return r?"\\"+r:"\\x"+(e<16?"0":"")+e.toString(16).toUpperCase()};var E=function t(t){return"Object("+t+")"};var _=function t(t){return t+" { ? }"};var I=function t(t,e,r,n){var o=n?F(r,n):r.join(", ");return t+" ("+e+") {"+o+"}"};var T=function t(t){for(var e=0;e<t.length;e++)if(v(t[e],"\n")>=0)return!1;return!0};var R=function t(t,e){var r;if(t.indent===" ")r=" ";else if(typeof t.indent=="number"&&t.indent>0)r=Array(t.indent+1).join(" ");else return null;return{base:r,prev:Array(e+1).join(r)}};var F=function t(t,e){if(t.length===0)return"";var r="\n"+e.prev+e.base;return r+t.join(","+r)+"\n"+e.prev};var D=function t(t,e){var r=o(t),n=[];if(r){n.length=t.length;for(var i=0;i<t.length;i++)n[i]=h(t,i)?e(t[i],t):""}for(var a in t)h(t,a)&&(r&&String(Number(a))===a&&a<t.length||(/[^\w$]/.test(a)?n.push(e(a,t)+": "+e(t[a],t)):n.push(a+": "+e(t[a],t))));if(typeof Z=="function")for(var u=Z(t),s=0;s<u.length;s++)te.call(t,u[s])&&n.push("["+e(u[s])+"]: "+e(t[u[s]],t));return n};var k=typeof Map=="function"&&Map.prototype,B=Object.getOwnPropertyDescriptor&&k?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,U=k&&B&&typeof B.get=="function"?B.get:null,M=k&&Map.prototype.forEach,q=typeof Set=="function"&&Set.prototype,C=Object.getOwnPropertyDescriptor&&q?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,N=q&&C&&typeof C.get=="function"?C.get:null,L=q&&Set.prototype.forEach,W=typeof WeakMap=="function"&&WeakMap.prototype,H=W?WeakMap.prototype.has:null,G=typeof WeakSet=="function"&&WeakSet.prototype,z=G?WeakSet.prototype.has:null,V=typeof WeakRef=="function"&&WeakRef.prototype,J=V?WeakRef.prototype.deref:null,Q=Boolean.prototype.valueOf,$=Object.prototype.toString,K=Function.prototype.toString,X=String.prototype.match,Y=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Z=Object.getOwnPropertySymbols,tt=typeof Symbol=="function"&&l(Symbol.iterator)=="symbol"?Symbol.prototype.toString:null,te=Object.prototype.propertyIsEnumerable,tr=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null),tn=x().custom,to=tn&&y(tn)?tn:null,ti=typeof Symbol=="function"&&l(Symbol.toStringTag)=="symbol"?Symbol.toStringTag:null;e.exports=function t(e,P,x,k){var B=function e(e,r,n){if(r&&(k=k.slice(),k.push(r)),n){var o={depth:q.depth};return h(q,"quoteStyle")&&(o.quoteStyle=q.quoteStyle),t(e,o,x+1,k)}return t(e,q,x+1,k)};var q=P||{};if(h(q,"quoteStyle")&&q.quoteStyle!=="single"&&q.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(h(q,"maxStringLength")&&(typeof q.maxStringLength=="number"?q.maxStringLength<0&&q.maxStringLength!==1/0:q.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var C=h(q,"customInspect")?q.customInspect:!0;if(typeof C!="boolean")throw new TypeError('option "customInspect", if provided, must be `true` or `false`');if(h(q,"indent")&&q.indent!==null&&q.indent!==" "&&!(parseInt(q.indent,10)===q.indent&&q.indent>0))throw new TypeError('options "indent" must be "\\t", an integer > 0, or `null`');if((typeof e==="undefined"?"undefined":l(e))>"u")return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return tu(e,q);if(typeof e=="number")return e===0?1/0/e>0?"0":"-0":String(e);if((typeof e==="undefined"?"undefined":l(e))=="bigint")return String(e)+"n";var W=l(q.depth)>"u"?5:q.depth;if((typeof x==="undefined"?"undefined":l(x))>"u"&&(x=0),x>=W&&W>0&&typeof e=="object")return o(e)?"[Array]":"[Object]";var H=R(q,x);if((typeof k==="undefined"?"undefined":l(k))>"u")k=[];else if(v(k,e)>=0)return"[Circular]";if(typeof e=="function"){var G=b(e),z=D(e,B);return"[Function"+(G?": "+G:" (anonymous)")+"]"+(z.length>0?" { "+z.join(", ")+" }":"")}if(y(e)){var V=tt.call(e);return typeof e=="object"?E(V):V}if(S(e)){for(var J="<"+String(e.nodeName).toLowerCase(),$=e.attributes||[],K=0;K<$.length;K++)J+=" "+$[K].name+"="+r(n($[K].value),"double",q);return J+=">",e.childNodes&&e.childNodes.length&&(J+="..."),J+="</"+String(e.nodeName).toLowerCase()+">",J}if(o(e)){if(e.length===0)return"[]";var X=D(e,B);return H&&!T(X)?"["+F(X,H)+"]":"[ "+X.join(", ")+" ]"}if(s(e)){var Z=D(e,B);return Z.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+Z.join(", ")+" }"}if(typeof e=="object"&&C){if(to&&typeof e[to]=="function")return e[to]();if(typeof e.inspect=="function")return e.inspect()}if(g(e)){var te=[];return M.call(e,function(t,r){te.push(B(r,e,!0)+" => "+B(t,e))}),I("Map",U.call(e),te,H)}if(O(e)){var tn=[];return L.call(e,function(t){tn.push(B(t,e))}),I("Set",N.call(e),tn,H)}if(w(e))return _("WeakMap");if(j(e))return _("WeakSet");if(A(e))return _("WeakRef");if(f(e))return E(B(Number(e)));if(d(e))return E(B(Y.call(e)));if(p(e))return E(Q.call(e));if(c(e))return E(B(String(e)));if(!a(e)&&!u(e)){var ta=D(e,B),ts=tr?tr(e)===Object.prototype:i(e,Object)||e.constructor===Object,tc=i(e,Object)?"":"null prototype",tf=!ts&&ti&&Object(e)===e&&ti in e?m(e).slice(8,-1):tc?"Object":"",tp=ts||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",tl=tp+(tf||tc?"["+[].concat(tf||[],tc||[]).join(": ")+"] ":"");return ta.length===0?tl+"{}":H?tl+"{"+F(ta,H)+"}":tl+"{ "+ta.join(", ")+" }"}return String(e)};var ta=Object.prototype.hasOwnProperty||function(t){return t in this};function tu(t,e){if(t.length>e.maxStringLength){var n=t.length-e.maxStringLength,o="... "+n+" more character"+(n>1?"s":"");return tu(t.slice(0,e.maxStringLength),e)+o}var i=t.replace(/(['\\])/g,"\\$1").replace(/[\x00-\x1f]/g,P);return r(i,"single",e)}});var I=c(function(t,e){"use strict";var r=S(),n=E(),o=_(),i=r("%TypeError%"),a=r("%WeakMap%",!0),u=r("%Map%",!0),s=n("WeakMap.prototype.get",!0),c=n("WeakMap.prototype.set",!0),f=n("WeakMap.prototype.has",!0),p=n("Map.prototype.get",!0),l=n("Map.prototype.set",!0),y=n("Map.prototype.has",!0),d=function t(t,e){for(var r=t,n;(n=r.next)!==null;r=n)if(n.key===e)return r.next=n.next,n.next=t.next,t.next=n,n},h=function t(t,e){var r=d(t,e);return r&&r.value},m=function t(t,e,r){var n=d(t,e);n?n.value=r:t.next={key:e,next:t.next,value:r}},b=function t(t,e){return!!d(t,e)};e.exports=function(){var t,e,r,n={assert:function t(t){if(!n.has(t))throw new i("Side channel does not contain "+o(t))},get:function n(n){if(a&&n&&(typeof n=="object"||typeof n=="function")){if(t)return s(t,n)}else if(u){if(e)return p(e,n)}else if(r)return h(r,n)},has:function n(n){if(a&&n&&(typeof n=="object"||typeof n=="function")){if(t)return f(t,n)}else if(u){if(e)return y(e,n)}else if(r)return b(r,n);return!1},set:function n(n,o){a&&n&&(typeof n=="object"||typeof n=="function")?(t||(t=new a),c(t,n,o)):u?(e||(e=new u),l(e,n,o)):(r||(r={key:{},next:null}),m(r,n,o))}};return n}});var T=c(function(t,e){"use strict";var r=String.prototype.replace,n=/%20/g,o={RFC1738:"RFC1738",RFC3986:"RFC3986"};e.exports={default:o.RFC3986,formatters:{RFC1738:function t(t){return r.call(t,n,"+")},RFC3986:function t(t){return String(t)}},RFC1738:o.RFC1738,RFC3986:o.RFC3986}});var R=c(function(t,e){"use strict";var r=T(),n=Object.prototype.hasOwnProperty,o=Array.isArray,i=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),a=function t(t){for(;t.length>1;){var e=t.pop(),r=e.obj[e.prop];if(o(r)){for(var n=[],i=0;i<r.length;++i)l(r[i])<"u"&&n.push(r[i]);e.obj[e.prop]=n}}},u=function t(t,e){for(var r=e&&e.plainObjects?Object.create(null):{},n=0;n<t.length;++n)l(t[n])<"u"&&(r[n]=t[n]);return r},s=function t(e,r,i){if(!r)return e;if(typeof r!="object"){if(o(e))e.push(r);else if(e&&typeof e=="object")(i&&(i.plainObjects||i.allowPrototypes)||!n.call(Object.prototype,r))&&(e[r]=!0);else return[e,r];return e}if(!e||typeof e!="object")return[e].concat(r);var a=e;return o(e)&&!o(r)&&(a=u(e,i)),o(e)&&o(r)?(r.forEach(function(r,o){if(n.call(e,o)){var a=e[o];a&&typeof a=="object"&&r&&typeof r=="object"?e[o]=t(a,r,i):e.push(r)}else e[o]=r}),e):Object.keys(r).reduce(function(e,o){var a=r[o];return n.call(e,o)?e[o]=t(e[o],a,i):e[o]=a,e},a)},c=function t(t,e){return Object.keys(e).reduce(function(t,r){return t[r]=e[r],t},t)},f=function t(t,e,r){var n=t.replace(/\+/g," ");if(r==="iso-8859-1")return n.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(n)}catch(t){return n}},p=function t(t,e,n,o,a){if(t.length===0)return t;var u=t;if((typeof t==="undefined"?"undefined":l(t))=="symbol"?u=Symbol.prototype.toString.call(t):typeof t!="string"&&(u=String(t)),n==="iso-8859-1")return escape(u).replace(/%u[0-9a-f]{4}/gi,function(t){return"%26%23"+parseInt(t.slice(2),16)+"%3B"});for(var s="",c=0;c<u.length;++c){var f=u.charCodeAt(c);if(f===45||f===46||f===95||f===126||f>=48&&f<=57||f>=65&&f<=90||f>=97&&f<=122||a===r.RFC1738&&(f===40||f===41)){s+=u.charAt(c);continue}if(f<128){s=s+i[f];continue}if(f<2048){s=s+(i[192|f>>6]+i[128|f&63]);continue}if(f<55296||f>=57344){s=s+(i[224|f>>12]+i[128|f>>6&63]+i[128|f&63]);continue}c+=1,f=65536+((f&1023)<<10|u.charCodeAt(c)&1023),s+=i[240|f>>18]+i[128|f>>12&63]+i[128|f>>6&63]+i[128|f&63]}return s},y=function t(t){for(var e=[{obj:{o:t},prop:"o"}],r=[],n=0;n<e.length;++n)for(var o=e[n],i=o.obj[o.prop],u=Object.keys(i),s=0;s<u.length;++s){var c=u[s],f=i[c];typeof f=="object"&&f!==null&&r.indexOf(f)===-1&&(e.push({obj:i,prop:c}),r.push(f))}return a(e),t},d=function t(t){return Object.prototype.toString.call(t)==="[object RegExp]"},h=function t(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},m=function t(t,e){return[].concat(t,e)},b=function t(t,e){if(o(t)){for(var r=[],n=0;n<t.length;n+=1)r.push(e(t[n]));return r}return e(t)};e.exports={arrayToObject:u,assign:c,combine:m,compact:y,decode:f,encode:p,isBuffer:h,isRegExp:d,maybeMap:b,merge:s}});var F=c(function(t,e){"use strict";var r=I(),n=R(),o=T(),a=Object.prototype.hasOwnProperty,u={brackets:function t(t){return t+"[]"},comma:"comma",indices:function t(t,e){return t+"["+e+"]"},repeat:function t(t){return t}},s=Array.isArray,c=Array.prototype.push,f=function t(t,e){c.apply(t,s(e)?e:[e])},p=Date.prototype.toISOString,y=o.default,d={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:n.encode,encodeValuesOnly:!1,format:y,formatter:o.formatters[y],indices:!1,serializeDate:function t(t){return p.call(t)},skipNulls:!1,strictNullHandling:!1},h=function t(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||(typeof t==="undefined"?"undefined":l(t))=="symbol"||(typeof t==="undefined"?"undefined":l(t))=="bigint"},m=function t(e,o,a,u,c,p,y,m,b,v,g,w,A,O,j){var S=e;if(j.has(e))throw new RangeError("Cyclic object value");if(typeof y=="function"?S=y(o,S):i(S,Date)?S=v(S):a==="comma"&&s(S)&&(S=n.maybeMap(S,function(t){return i(t,Date)?v(t):t})),S===null){if(u)return p&&!A?p(o,d.encoder,O,"key",g):o;S=""}if(h(S)||n.isBuffer(S)){if(p){var P=A?o:p(o,d.encoder,O,"key",g);return[w(P)+"="+w(p(S,d.encoder,O,"value",g))]}return[w(o)+"="+w(String(S))]}var E=[];if((typeof S==="undefined"?"undefined":l(S))>"u")return E;var x;if(a==="comma"&&s(S))x=[{value:S.length>0?S.join(",")||null:void 0}];else if(s(y))x=y;else{var _=Object.keys(S);x=m?_.sort(m):_}for(var I=0;I<x.length;++I){var T=x[I],R=typeof T=="object"&&T.value!==void 0?T.value:S[T];if(!(c&&R===null)){var F=s(S)?typeof a=="function"?a(o,T):o:o+(b?"."+T:"["+T+"]");j.set(e,!0);var D=r();f(E,t(R,F,a,u,c,p,y,m,b,v,g,w,A,O,D))}}return E},b=function t(t){if(!t)return d;if(t.encoder!==null&&t.encoder!==void 0&&typeof t.encoder!="function")throw new TypeError("Encoder has to be a function.");var e=t.charset||d.charset;if(l(t.charset)<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var r=o.default;if(l(t.format)<"u"){if(!a.call(o.formatters,t.format))throw new TypeError("Unknown format option provided.");r=t.format}var n=o.formatters[r],i=d.filter;return(typeof t.filter=="function"||s(t.filter))&&(i=t.filter),{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:d.addQueryPrefix,allowDots:l(t.allowDots)>"u"?d.allowDots:!!t.allowDots,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:d.charsetSentinel,delimiter:l(t.delimiter)>"u"?d.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:d.encode,encoder:typeof t.encoder=="function"?t.encoder:d.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:d.encodeValuesOnly,filter:i,format:r,formatter:n,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:d.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:d.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:d.strictNullHandling}};e.exports=function(t,e){var n=t,o=b(e),i,a;typeof o.filter=="function"?(a=o.filter,n=a("",n)):s(o.filter)&&(a=o.filter,i=a);var c=[];if(typeof n!="object"||n===null)return"";var p;e&&e.arrayFormat in u?p=e.arrayFormat:e&&"indices"in e?p=e.indices?"indices":"repeat":p="indices";var l=u[p];i||(i=Object.keys(n)),o.sort&&i.sort(o.sort);for(var y=r(),d=0;d<i.length;++d){var h=i[d];o.skipNulls&&n[h]===null||f(c,m(n[h],h,l,o.strictNullHandling,o.skipNulls,o.encode?o.encoder:null,o.filter,o.sort,o.allowDots,o.serializeDate,o.format,o.formatter,o.encodeValuesOnly,o.charset,y))}var v=c.join(o.delimiter),g=o.addQueryPrefix===!0?"?":"";return o.charsetSentinel&&(o.charset==="iso-8859-1"?g+="utf8=%26%2310003%3B&":g+="utf8=%E2%9C%93&"),v.length>0?g+v:""}});var D=c(function(t,e){"use strict";var r=R(),n=Object.prototype.hasOwnProperty,o=Array.isArray,i={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:r.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},a=function t(t){return t.replace(/&#(\d+);/g,function(t,e){return String.fromCharCode(parseInt(e,10))})},u=function t(t,e){return t&&typeof t=="string"&&e.comma&&t.indexOf(",")>-1?t.split(","):t},s="utf8=%26%2310003%3B",c="utf8=%E2%9C%93",f=function t(t,e){var f={},p=e.ignoreQueryPrefix?t.replace(/^\?/,""):t,l=e.parameterLimit===1/0?void 0:e.parameterLimit,y=p.split(e.delimiter,l),d=-1,h,m=e.charset;if(e.charsetSentinel)for(h=0;h<y.length;++h)y[h].indexOf("utf8=")===0&&(y[h]===c?m="utf-8":y[h]===s&&(m="iso-8859-1"),d=h,h=y.length);for(h=0;h<y.length;++h)if(h!==d){var b=y[h],v=b.indexOf("]="),g=v===-1?b.indexOf("="):v+1,w,A;g===-1?(w=e.decoder(b,i.decoder,m,"key"),A=e.strictNullHandling?null:""):(w=e.decoder(b.slice(0,g),i.decoder,m,"key"),A=r.maybeMap(u(b.slice(g+1),e),function(t){return e.decoder(t,i.decoder,m,"value")})),A&&e.interpretNumericEntities&&m==="iso-8859-1"&&(A=a(A)),b.indexOf("[]=")>-1&&(A=o(A)?[A]:A),n.call(f,w)?f[w]=r.combine(f[w],A):f[w]=A}return f},p=function t(t,e,r,n){for(var o=n?e:u(e,r),i=t.length-1;i>=0;--i){var a,s=t[i];if(s==="[]"&&r.parseArrays)a=[].concat(o);else{a=r.plainObjects?Object.create(null):{};var c=s.charAt(0)==="["&&s.charAt(s.length-1)==="]"?s.slice(1,-1):s,f=parseInt(c,10);!r.parseArrays&&c===""?a={0:o}:!isNaN(f)&&s!==c&&String(f)===c&&f>=0&&r.parseArrays&&f<=r.arrayLimit?(a=[],a[f]=o):a[c]=o}o=a}return o},y=function t(t,e,r,o){if(t){var i=r.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,a=/(\[[^[\]]*])/,u=/(\[[^[\]]*])/g,s=r.depth>0&&a.exec(i),c=s?i.slice(0,s.index):i,f=[];if(c){if(!r.plainObjects&&n.call(Object.prototype,c)&&!r.allowPrototypes)return;f.push(c)}for(var l=0;r.depth>0&&(s=u.exec(i))!==null&&l<r.depth;){if(l+=1,!r.plainObjects&&n.call(Object.prototype,s[1].slice(1,-1))&&!r.allowPrototypes)return;f.push(s[1])}return s&&f.push("["+i.slice(s.index)+"]"),p(f,e,r,o)}},d=function t(t){if(!t)return i;if(t.decoder!==null&&t.decoder!==void 0&&typeof t.decoder!="function")throw new TypeError("Decoder has to be a function.");if(l(t.charset)<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var e=l(t.charset)>"u"?i.charset:t.charset;return{allowDots:l(t.allowDots)>"u"?i.allowDots:!!t.allowDots,allowPrototypes:typeof t.allowPrototypes=="boolean"?t.allowPrototypes:i.allowPrototypes,allowSparse:typeof t.allowSparse=="boolean"?t.allowSparse:i.allowSparse,arrayLimit:typeof t.arrayLimit=="number"?t.arrayLimit:i.arrayLimit,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:i.charsetSentinel,comma:typeof t.comma=="boolean"?t.comma:i.comma,decoder:typeof t.decoder=="function"?t.decoder:i.decoder,delimiter:typeof t.delimiter=="string"||r.isRegExp(t.delimiter)?t.delimiter:i.delimiter,depth:typeof t.depth=="number"||t.depth===!1?+t.depth:i.depth,ignoreQueryPrefix:t.ignoreQueryPrefix===!0,interpretNumericEntities:typeof t.interpretNumericEntities=="boolean"?t.interpretNumericEntities:i.interpretNumericEntities,parameterLimit:typeof t.parameterLimit=="number"?t.parameterLimit:i.parameterLimit,parseArrays:t.parseArrays!==!1,plainObjects:typeof t.plainObjects=="boolean"?t.plainObjects:i.plainObjects,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:i.strictNullHandling}};e.exports=function(t,e){var n=d(e);if(t===""||t===null||(typeof t==="undefined"?"undefined":l(t))>"u")return n.plainObjects?Object.create(null):{};for(var o=typeof t=="string"?f(t,n):t,i=n.plainObjects?Object.create(null):{},a=Object.keys(o),u=0;u<a.length;++u){var s=a[u],c=y(s,o[s],n,typeof t=="string");i=r.merge(i,c,n)}return n.allowSparse===!0?i:r.compact(i)}});var k=c(function(t,e){"use strict";var r=F(),n=D(),o=T();e.exports={formats:o,parse:n,stringify:r}});var B=c(function(t,e){"use strict";var r=(typeof self==="undefined"?"undefined":l(self))<"u"?self:t,n=function(){var t=function t(){this.fetch=!1,this.DOMException=r.DOMException};return t.prototype=r,new t}();(function(t){var e=function(e){var r=function t(t){return t&&DataView.prototype.isPrototypeOf(t)};var n=function t(t){if(typeof t!="string"&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()};var o=function t(t){return typeof t!="string"&&(t=String(t)),t};var a=function t(t){var e={next:function e(){var e=t.shift();return{done:e===void 0,value:e}}};return w.iterable&&(e[Symbol.iterator]=function(){return e}),e};var u=function t(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0};var s=function t(t){return new Promise(function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}})};var c=function t(t){var e=new FileReader,r=s(e);return e.readAsArrayBuffer(t),r};var f=function t(t){var e=new FileReader,r=s(e);return e.readAsText(t),r};var p=function t(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n<e.length;n++)r[n]=String.fromCharCode(e[n]);return r.join("")};var y=function t(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer};var d=function t(){return this.bodyUsed=!1,this._initBody=function(t){this._bodyInit=t,t?typeof t=="string"?this._bodyText=t:w.blob&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:w.formData&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:w.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():w.arrayBuffer&&w.blob&&r(t)?(this._bodyArrayBuffer=y(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):w.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(t)||O(t))?this._bodyArrayBuffer=y(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||(typeof t=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):w.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},w.blob&&(this.blob=function(){var t=u(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?u(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(c)}),this.text=function(){var t=u(this);if(t)return t;if(this._bodyBlob)return f(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(p(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},w.formData&&(this.formData=function(){return this.text().then(m)}),this.json=function(){return this.text().then(JSON.parse)},this};var h=function t(t){var e=t.toUpperCase();return S.indexOf(e)>-1?e:t};var m=function t(t){var e=new FormData;return t.trim().split("&").forEach(function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),o=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(o))}}),e};var b=function t(t){var e=new j,r=t.replace(/\r?\n[\t ]+/g," ");return r.split(/\r?\n/).forEach(function(t){var r=t.split(":"),n=r.shift().trim();if(n){var o=r.join(":").trim();e.append(n,o)}}),e};var v=function t(t,e){e||(e={}),this.type="default",this.status=e.status===void 0?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new j(e.headers),this.url=e.url||"",this._initBody(t)};var g=function t(t,r){return new Promise(function(n,o){var i=new P(t,r);if(i.signal&&i.signal.aborted)return o(new e.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function u(){a.abort()}a.onload=function(){var t={status:a.status,statusText:a.statusText,headers:b(a.getAllResponseHeaders()||"")};t.url="responseURL"in a?a.responseURL:t.headers.get("X-Request-URL");var e="response"in a?a.response:a.responseText;n(new v(e,t))},a.onerror=function(){o(new TypeError("Network request failed"))},a.ontimeout=function(){o(new TypeError("Network request failed"))},a.onabort=function(){o(new e.DOMException("Aborted","AbortError"))},a.open(i.method,i.url,!0),i.credentials==="include"?a.withCredentials=!0:i.credentials==="omit"&&(a.withCredentials=!1),"responseType"in a&&w.blob&&(a.responseType="blob"),i.headers.forEach(function(t,e){a.setRequestHeader(e,t)}),i.signal&&(i.signal.addEventListener("abort",u),a.onreadystatechange=function(){a.readyState===4&&i.signal.removeEventListener("abort",u)}),a.send(l(i._bodyInit)>"u"?null:i._bodyInit)})};var w={searchParams:"URLSearchParams"in t,iterable:"Symbol"in t&&"iterator"in Symbol,blob:"FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in t,arrayBuffer:"ArrayBuffer"in t};if(w.arrayBuffer)var A=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],O=ArrayBuffer.isView||function(t){return t&&A.indexOf(Object.prototype.toString.call(t))>-1};function j(t){this.map={},i(t,j)?t.forEach(function(t,e){this.append(e,t)},this):Array.isArray(t)?t.forEach(function(t){this.append(t[0],t[1])},this):t&&Object.getOwnPropertyNames(t).forEach(function(e){this.append(e,t[e])},this)}j.prototype.append=function(t,e){t=n(t),e=o(e);var r=this.map[t];this.map[t]=r?r+", "+e:e},j.prototype.delete=function(t){delete this.map[n(t)]},j.prototype.get=function(t){return t=n(t),this.has(t)?this.map[t]:null},j.prototype.has=function(t){return this.map.hasOwnProperty(n(t))},j.prototype.set=function(t,e){this.map[n(t)]=o(e)},j.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},j.prototype.keys=function(){var t=[];return this.forEach(function(e,r){t.push(r)}),a(t)},j.prototype.values=function(){var t=[];return this.forEach(function(e){t.push(e)}),a(t)},j.prototype.entries=function(){var t=[];return this.forEach(function(e,r){t.push([r,e])}),a(t)},w.iterable&&(j.prototype[Symbol.iterator]=j.prototype.entries);var S=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function P(t,e){e=e||{};var r=e.body;if(i(t,P)){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new j(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,!r&&t._bodyInit!=null&&(r=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",(e.headers||!this.headers)&&(this.headers=new j(e.headers)),this.method=h(e.method||this.method||"GET"),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&r)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(r)}P.prototype.clone=function(){return new P(this,{body:this._bodyInit})};d.call(P.prototype);d.call(v.prototype),v.prototype.clone=function(){return new v(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new j(this.headers),url:this.url})},v.error=function(){var t=new v(null,{status:0,statusText:""});return t.type="error",t};var E=[301,302,303,307,308];v.redirect=function(t,e){if(E.indexOf(e)===-1)throw new RangeError("Invalid status code");return new v(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}return g.polyfill=!0,t.fetch||(t.fetch=g,t.Headers=j,t.Request=P,t.Response=v),e.Headers=j,e.Request=P,e.Response=v,e.fetch=g,Object.defineProperty(e,"__esModule",{value:!0}),e}({})})(n);n.fetch.ponyfill=!0;delete n.fetch.polyfill;var o=n;t=o.fetch;t.default=o.fetch;t.fetch=o.fetch;t.Headers=o.Headers;t.Request=o.Request;t.Response=o.Response;e.exports=t});var U=c(function(t,e){"use strict";var r=function t(t,e){typeof e=="boolean"&&(e={forever:e}),this._originalTimeouts=JSON.parse(JSON.stringify(t)),this._timeouts=t,this._options=e||{},this._maxRetryTime=e&&e.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))};e.exports=r;r.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};r.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null};r.prototype.retry=function(t){if(this._timeout&&clearTimeout(this._timeout),!t)return!1;var e=new Date().getTime();if(t&&e-this._operationStart>=this._maxRetryTime)return this._errors.push(t),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(t);var r=this._timeouts.shift();if(r===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),r=this._cachedTimeouts.slice(-1);else return!1;var n=this;return this._timer=setTimeout(function(){n._attempts++,n._operationTimeoutCb&&(n._timeout=setTimeout(function(){n._operationTimeoutCb(n._attempts)},n._operationTimeout),n._options.unref&&n._timeout.unref()),n._fn(n._attempts)},r),this._options.unref&&this._timer.unref(),!0};r.prototype.attempt=function(t,e){this._fn=t,e&&(e.timeout&&(this._operationTimeout=e.timeout),e.cb&&(this._operationTimeoutCb=e.cb));var r=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){r._operationTimeoutCb()},r._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};r.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)};r.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)};r.prototype.start=r.prototype.try;r.prototype.errors=function(){return this._errors};r.prototype.attempts=function(){return this._attempts};r.prototype.mainError=function(){if(this._errors.length===0)return null;for(var t={},e=null,r=0,n=0;n<this._errors.length;n++){var o=this._errors[n],i=o.message,a=(t[i]||0)+1;t[i]=a,a>=r&&(e=o,r=a)}return e}});var M=c(function(t){"use strict";var e=U();t.operation=function(r){var n=t.timeouts(r);return new e(n,{forever:r&&(r.forever||r.retries===1/0),unref:r&&r.unref,maxRetryTime:r&&r.maxRetryTime})};t.timeouts=function(t){if(i(t,Array))return[].concat(t);var e={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var r in t)e[r]=t[r];if(e.minTimeout>e.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var n=[],o=0;o<e.retries;o++)n.push(this.createTimeout(o,e));return t&&t.forever&&!n.length&&n.push(this.createTimeout(o,e)),n.sort(function(t,e){return t-e}),n};t.createTimeout=function(t,e){var r=e.randomize?Math.random()+1:1,n=Math.round(r*Math.max(e.minTimeout,1)*Math.pow(e.factor,t));return n=Math.min(n,e.maxTimeout),n};t.wrap=function(e,r,n){if(i(r,Array)&&(n=r,r=null),!n){n=[];for(var o in e)typeof e[o]=="function"&&n.push(o)}for(var a=0;a<n.length;a++){var u=n[a],s=e[u];e[u]=(function(n){var o=t.operation(r),i=Array.prototype.slice.call(arguments,1),a=i.pop();i.push(function(t){o.retry(t)||(t&&(arguments[0]=o.mainError()),a.apply(this,arguments))}),o.attempt(function(){n.apply(e,i)})}).bind(e,s),e[u].options=r}}});var q=c(function(t,e){"use strict";e.exports=M()});var C=c(function(t,e){"use strict";var r=function t(t,e){function r(r,o){var i=e||{},a;"randomize"in i||(i.randomize=!0),a=n.operation(i);function u(t){o(t||new Error("Aborted"))}function s(t,e){if(t.bail){u(t);return}a.retry(t)?i.onRetry&&i.onRetry(t,e):o(a.mainError())}function c(e){var n;try{n=t(u,e)}catch(t){s(t,e);return}Promise.resolve(n).then(r).catch(function(t){s(t,e)})}a.attempt(c)}return new Promise(r)};var n=q();e.exports=r});var N={};y(N,{createClient:function(){return Y}});var L=m(k());var W=function(t){return t!==null&&typeof t=="object"},H=function(t){return typeof t=="string"};var G=function(t){if(!W(t))throw new Error("queries is not object");return L.default.stringify(t,{arrayFormat:"comma"})};var z="microcms.io",V="v1";var J=m(B()),Q=function(t){var e;return t?e=t:(typeof fetch==="undefined"?"undefined":l(fetch))>"u"?e=J.default:e=fetch,function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++){r[n]=arguments[n]}return e.apply(void 0,p(r))}},$=function(){return(typeof Headers==="undefined"?"undefined":l(Headers))>"u"?J.Headers:Headers},K=function(t,e){var r=Q(e),o=$();return function(){var e=n(function(e,n){var i,a;return d(this,function(u){a=new o((i=n)===null||i===void 0?void 0:i.headers);return[2,(a.has("X-MICROCMS-API-KEY")||a.set("X-MICROCMS-API-KEY",t),r(e,f(s({},n),{headers:a})))]})});return function(t,r){return e.apply(this,arguments)}}()};var X=m(C()),Y=function(t){var e=t.serviceDomain,r=t.apiKey,o=t.customFetch,i=t.retry;if(!e||!r)throw new Error("parameter is required (check serviceDomain and apiKey)");if(!H(e)||!H(r))throw new Error("parameter is not string");var a="https://".concat(e,".").concat(z,"/api/").concat(V),u=function(){var t=n(function(t){var e,u,c,p,l,y,h,m,b;return d(this,function(v){switch(v.label){case 0:e=t.endpoint,u=t.contentId,c=t.queries,p=c===void 0?{}:c,l=t.requestInit;y=K(r,o),h=G(p),m="".concat(a,"/").concat(e).concat(u?"/".concat(u):"").concat(h?"?".concat(h):""),b=function(){var t=n(function(t){var e,r,n;return d(this,function(o){switch(o.label){case 0:o.trys.push([0,2,,3]);return[4,t.json()];case 1:e=o.sent(),r=e.message;return[2,r!==null&&r!==void 0?r:null];case 2:n=o.sent();return[2,null];case 3:return[2]}})});return function e(e){return t.apply(this,arguments)}}();return[4,(0,X.default)(function(){var t=n(function(t){var e,r,n,o,i,a,u,c;return d(this,function(p){switch(p.label){case 0:p.trys.push([0,6,,7]);return[4,y(m,f(s({},l),{method:(n=(e=l)===null||e===void 0?void 0:e.method)!==null&&n!==void 0?n:"GET"}))];case 1:o=p.sent();if(!(o.status!==429&&o.status>=400&&o.status<500))return[3,3];return[4,b(o)];case 2:i=p.sent();return[2,t(new Error("fetch API response status: ".concat(o.status).concat(i?"\n message is `".concat(i,"`"):"")))];case 3:if(!!o.ok)return[3,5];return[4,b(o)];case 4:a=p.sent();return[2,Promise.reject(new Error("fetch API response status: ".concat(o.status).concat(a?"\n message is `".concat(a,"`"):"")))];case 5:return[2,((r=l)===null||r===void 0?void 0:r.method)==="DELETE"?void 0:o.json()];case 6:u=p.sent();if(u.data)throw u.data;if((c=u.response)===null||c===void 0?void 0:c.data)throw u.response.data;return[2,Promise.reject(new Error("Network Error.\n Details: ".concat(u)))];case 7:return[2]}})});return function(e){return t.apply(this,arguments)}}(),{retries:i?2:0,onRetry:function(t,e){console.log(t),console.log("Waiting for retry (".concat(e,"/",2,")"))},minTimeout:5e3})];case 1:return[2,v.sent()]}})});return function e(e){return t.apply(this,arguments)}}();return{get:function(){var t=n(function(t){var e,r,n,o,i,a;return d(this,function(s){switch(s.label){case 0:e=t.endpoint,r=t.contentId,n=t.queries,o=n===void 0?{}:n,i=t.customRequestInit;if(!e)return[3,2];return[4,u({endpoint:e,contentId:r,queries:o,requestInit:i})];case 1:a=s.sent();return[3,3];case 2:a=Promise.reject(new Error("endpoint is required"));s.label=3;case 3:return[2,a]}})});return function(e){return t.apply(this,arguments)}}(),getList:function(){var t=n(function(t){var e,r,n,o,i;return d(this,function(a){switch(a.label){case 0:e=t.endpoint,r=t.queries,n=r===void 0?{}:r,o=t.customRequestInit;if(!e)return[3,2];return[4,u({endpoint:e,queries:n,requestInit:o})];case 1:i=a.sent();return[3,3];case 2:i=Promise.reject(new Error("endpoint is required"));a.label=3;case 3:return[2,i]}})});return function(e){return t.apply(this,arguments)}}(),getListDetail:function(){var t=n(function(t){var e,r,n,o,i,a;return d(this,function(s){switch(s.label){case 0:e=t.endpoint,r=t.contentId,n=t.queries,o=n===void 0?{}:n,i=t.customRequestInit;if(!e)return[3,2];return[4,u({endpoint:e,contentId:r,queries:o,requestInit:i})];case 1:a=s.sent();return[3,3];case 2:a=Promise.reject(new Error("endpoint is required"));s.label=3;case 3:return[2,a]}})});return function(e){return t.apply(this,arguments)}}(),getObject:function(){var t=n(function(t){var e,r,n,o,i;return d(this,function(a){switch(a.label){case 0:e=t.endpoint,r=t.queries,n=r===void 0?{}:r,o=t.customRequestInit;if(!e)return[3,2];return[4,u({endpoint:e,queries:n,requestInit:o})];case 1:i=a.sent();return[3,3];case 2:i=Promise.reject(new Error("endpoint is required"));a.label=3;case 3:return[2,i]}})});return function(e){return t.apply(this,arguments)}}(),getAllContentIds:function(){var t=n(function(t){var e,r,n,o,i,a,c,l,y,h,m,b,v,g,w,A,O;return d(this,function(d){switch(d.label){case 0:e=t.endpoint,r=t.alternateField,n=t.draftKey,o=t.filters,i=t.orders,a=t.customRequestInit;c={draftKey:n,filters:o,orders:i,limit:100,fields:r!==null&&r!==void 0?r:"id",depth:0};return[4,u({endpoint:e,queries:f(s({},c),{limit:0}),requestInit:a})];case 1:l=d.sent(),y=l.totalCount,h=[],m=0,b=function(t){return new Promise(function(e){return setTimeout(e,t)})},v=function(t){return t.every(function(t){return typeof t=="string"})};d.label=2;case 2:if(!(h.length<y))return[3,7];return[4,u({endpoint:e,queries:f(s({},c),{offset:m}),requestInit:a})];case 3:g=d.sent(),w=g.contents,A=w.map(function(t){return t[r!==null&&r!==void 0?r:"id"]});if(!v(A))throw new Error("The value of the field specified by `alternateField` is not a string.");h=p(h).concat(p(A)),m+=100;O=h.length<y;if(!O)return[3,5];return[4,b(1e3)];case 4:O=d.sent();d.label=5;case 5:O;d.label=6;case 6:return[3,2];case 7:return[2,h]}})});return function(e){return t.apply(this,arguments)}}(),getAllContents:function(){var t=n(function(t){var e,r,n,o,i,a,c,p,l,y,h,m;return d(this,function(d){switch(d.label){case 0:e=t.endpoint,r=t.queries,n=r===void 0?{}:r,o=t.customRequestInit;return[4,u({endpoint:e,queries:f(s({},n),{limit:0}),requestInit:o})];case 1:i=d.sent(),a=i.totalCount,c=[],p=0,l=function(t){return new Promise(function(e){return setTimeout(e,t)})};d.label=2;case 2:if(!(c.length<a))return[3,7];return[4,u({endpoint:e,queries:f(s({},n),{limit:100,offset:p}),requestInit:o})];case 3:y=d.sent(),h=y.contents;c=c.concat(h),p+=100;m=c.length<a;if(!m)return[3,5];return[4,l(1e3)];case 4:m=d.sent();d.label=5;case 5:m;d.label=6;case 6:return[3,2];case 7:return[2,c]}})});return function(e){return t.apply(this,arguments)}}(),create:function(){var t=n(function(t){var e,r,n,o,i,a,c,p;return d(this,function(l){e=t.endpoint,r=t.contentId,n=t.content,o=t.isDraft,i=o===void 0?!1:o,a=t.customRequestInit;if(!e)return[2,Promise.reject(new Error("endpoint is required"))];c=i?{status:"draft"}:{},p=f(s({},a),{method:r?"PUT":"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});return[2,u({endpoint:e,contentId:r,queries:c,requestInit:p})]})});return function(e){return t.apply(this,arguments)}}(),update:function(){var t=n(function(t){var e,r,n,o,i;return d(this,function(a){e=t.endpoint,r=t.contentId,n=t.content,o=t.customRequestInit;if(!e)return[2,Promise.reject(new Error("endpoint is required"))];i=f(s({},o),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});return[2,u({endpoint:e,contentId:r,requestInit:i})]})});return function(e){return t.apply(this,arguments)}}(),delete:function(){var t=n(function(t){var e,r,n,o;return d(this,function(i){switch(i.label){case 0:e=t.endpoint,r=t.contentId,n=t.customRequestInit;if(!e)return[2,Promise.reject(new Error("endpoint is required"))];if(!r)return[2,Promise.reject(new Error("contentId is required"))];o=f(s({},n),{method:"DELETE",headers:{},body:void 0});return[4,u({endpoint:e,contentId:r,requestInit:o})];case 1:i.sent();return[2]}})});return function(e){return t.apply(this,arguments)}}()}};return b(N)}();//# sourceMappingURL=microcms-js-sdk.js.map
|
|
1
|
+
"use strict";function t(t,e){if(e==null||e>t.length)e=t.length;for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function e(t){if(Array.isArray(t))return t}function r(e){if(Array.isArray(e))return t(e)}function n(t,e,r,n,i,o,u){try{var a=t[o](u);var s=a.value}catch(t){r(t);return}if(a.done){e(s)}else{Promise.resolve(s).then(n,i)}}function i(t){return function(){var e=this,r=arguments;return new Promise(function(i,o){var u=t.apply(e,r);function a(t){n(u,i,o,a,s,"next",t)}function s(t){n(u,i,o,a,s,"throw",t)}a(undefined)})}}function o(t,e,r){if(e in t){Object.defineProperty(t,e,{value:r,enumerable:true,configurable:true,writable:true})}else{t[e]=r}return t}function u(t,e){if(e!=null&&typeof Symbol!=="undefined"&&e[Symbol.hasInstance]){return!!e[Symbol.hasInstance](t)}else{return t instanceof e}}function a(t){if(typeof Symbol!=="undefined"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function s(t,e){var r=t==null?null:typeof Symbol!=="undefined"&&t[Symbol.iterator]||t["@@iterator"];if(r==null)return;var n=[];var i=true;var o=false;var u,a;try{for(r=r.call(t);!(i=(u=r.next()).done);i=true){n.push(u.value);if(e&&n.length===e)break}}catch(t){o=true;a=t}finally{try{if(!i&&r["return"]!=null)r["return"]()}finally{if(o)throw a}}return n}function c(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function l(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function f(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};var n=Object.keys(r);if(typeof Object.getOwnPropertySymbols==="function"){n=n.concat(Object.getOwnPropertySymbols(r).filter(function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable}))}n.forEach(function(e){o(t,e,r[e])})}return t}function p(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);if(e){n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})}r.push.apply(r,n)}return r}function h(t,e){e=e!=null?e:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(t,Object.getOwnPropertyDescriptors(e))}else{p(Object(e)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))})}return t}function m(t,r){return e(t)||s(t,r)||v(t,r)||c()}function d(t){return r(t)||a(t)||v(t)||l()}function v(e,r){if(!e)return;if(typeof e==="string")return t(e,r);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor)n=e.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return t(e,r)}function y(t,e){var r,n,i,o,u={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),"throw":a(1),"return":a(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(t){return function(e){return s([t,e])}}function s(o){if(r)throw new TypeError("Generator is already executing.");while(u)try{if(r=1,n&&(i=o[0]&2?n["return"]:o[0]?n["throw"]||((i=n["return"])&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;if(n=0,i)o=[o[0]&2,i.value];switch(o[0]){case 0:case 1:i=o;break;case 4:u.label++;return{value:o[1],done:false};case 5:u.label++;n=o[1];o=[0];continue;case 7:o=u.ops.pop();u.trys.pop();continue;default:if(!(i=u.trys,i=i.length>0&&i[i.length-1])&&(o[0]===6||o[0]===2)){u=0;continue}if(o[0]===3&&(!i||o[1]>i[0]&&o[1]<i[3])){u.label=o[1];break}if(o[0]===6&&u.label<i[1]){u.label=i[1];i=o;break}if(i&&u.label<i[2]){u.label=i[2];u.ops.push(o);break}if(i[2])u.ops.pop();u.trys.pop();continue}o=e.call(t,u)}catch(t){o=[6,t];n=0}finally{r=i=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:true}}}var microcms=function(){var t=Object.create;var e=Object.defineProperty;var r=Object.getOwnPropertyDescriptor;var n=Object.getOwnPropertyNames;var o=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty;var s=function(t,e){return function(){return e||t((e={exports:{}}).exports,e),e.exports}},c=function(t,r){for(var n in r)e(t,n,{get:r[n],enumerable:!0})},l=function(t,i,o,u){var s=true,c=false,l=undefined;if(i&&typeof i=="object"||typeof i=="function")try{var f=function(){var n=h.value;!a.call(t,n)&&n!==o&&e(t,n,{get:function(){return i[n]},enumerable:!(u=r(i,n))||u.enumerable})};for(var p=n(i)[Symbol.iterator](),h;!(s=(h=p.next()).done);s=true)f()}catch(t){c=true;l=t}finally{try{if(!s&&p.return!=null){p.return()}}finally{if(c){throw l}}}return t};var p=function(r,n,i){return i=r!=null?t(o(r)):{},l(n||!r||!r.__esModule?e(i,"default",{value:r,enumerable:!0}):i,r)},v=function(t){return l(e({},"__esModule",{value:!0}),t)};var b=s(function(t,e){"use strict";var r=function t(t,e){typeof e=="boolean"&&(e={forever:e}),this._originalTimeouts=JSON.parse(JSON.stringify(t)),this._timeouts=t,this._options=e||{},this._maxRetryTime=e&&e.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))};e.exports=r;r.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};r.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null};r.prototype.retry=function(t){if(this._timeout&&clearTimeout(this._timeout),!t)return!1;var e=new Date().getTime();if(t&&e-this._operationStart>=this._maxRetryTime)return this._errors.push(t),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(t);var r=this._timeouts.shift();if(r===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),r=this._cachedTimeouts.slice(-1);else return!1;var n=this;return this._timer=setTimeout(function(){n._attempts++,n._operationTimeoutCb&&(n._timeout=setTimeout(function(){n._operationTimeoutCb(n._attempts)},n._operationTimeout),n._options.unref&&n._timeout.unref()),n._fn(n._attempts)},r),this._options.unref&&this._timer.unref(),!0};r.prototype.attempt=function(t,e){this._fn=t,e&&(e.timeout&&(this._operationTimeout=e.timeout),e.cb&&(this._operationTimeoutCb=e.cb));var r=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){r._operationTimeoutCb()},r._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};r.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)};r.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)};r.prototype.start=r.prototype.try;r.prototype.errors=function(){return this._errors};r.prototype.attempts=function(){return this._attempts};r.prototype.mainError=function(){if(this._errors.length===0)return null;for(var t={},e=null,r=0,n=0;n<this._errors.length;n++){var i=this._errors[n],o=i.message,u=(t[o]||0)+1;t[o]=u,u>=r&&(e=i,r=u)}return e}});var w=s(function(t){"use strict";var e=b();t.operation=function(r){var n=t.timeouts(r);return new e(n,{forever:r&&(r.forever||r.retries===1/0),unref:r&&r.unref,maxRetryTime:r&&r.maxRetryTime})};t.timeouts=function(t){if(u(t,Array))return[].concat(t);var e={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var r in t)e[r]=t[r];if(e.minTimeout>e.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var n=[],i=0;i<e.retries;i++)n.push(this.createTimeout(i,e));return t&&t.forever&&!n.length&&n.push(this.createTimeout(i,e)),n.sort(function(t,e){return t-e}),n};t.createTimeout=function(t,e){var r=e.randomize?Math.random()+1:1,n=Math.round(r*Math.max(e.minTimeout,1)*Math.pow(e.factor,t));return n=Math.min(n,e.maxTimeout),n};t.wrap=function(e,r,n){if(u(r,Array)&&(n=r,r=null),!n){n=[];for(var i in e)typeof e[i]=="function"&&n.push(i)}for(var o=0;o<n.length;o++){var a=n[o],s=e[a];e[a]=(function(n){var i=t.operation(r),o=Array.prototype.slice.call(arguments,1),u=o.pop();o.push(function(t){i.retry(t)||(t&&(arguments[0]=i.mainError()),u.apply(this,arguments))}),i.attempt(function(){n.apply(e,o)})}).bind(e,s),e[a].options=r}}});var g=s(function(t,e){"use strict";e.exports=w()});var _=s(function(t,e){"use strict";var r=function t(t,e){function r(r,i){var o=e||{},u;"randomize"in o||(o.randomize=!0),u=n.operation(o);function a(t){i(t||new Error("Aborted"))}function s(t,e){if(t.bail){a(t);return}u.retry(t)?o.onRetry&&o.onRetry(t,e):i(u.mainError())}function c(e){var n;try{n=t(a,e)}catch(t){s(t,e);return}Promise.resolve(n).then(r).catch(function(t){s(t,e)})}u.attempt(c)}return new Promise(r)};var n=g();e.exports=r});var T={};c(T,{createClient:function(){return x},createManagementClient:function(){return A}});var q=p(_());var I=function(t){return function(){var e=i(function(e,r){var n;return y(this,function(i){n=new Headers(r===null||r===void 0?void 0:r.headers);return[2,(n.has("X-MICROCMS-API-KEY")||n.set("X-MICROCMS-API-KEY",t),fetch(e,h(f({},r),{headers:n})))]})});return function(t,r){return e.apply(this,arguments)}}()};var O="microcms.io",j="microcms-management.io",E="v1";var P=function(t){return t!==null&&typeof t=="object"},S=function(t){return typeof t=="string"};var R=function(t){if(!P(t))throw new Error("queries is not object");return new URLSearchParams(Object.entries(t).reduce(function(t,e){var r=m(e,2),n=r[0],i=r[1];return t[n]=String(i),t},{})).toString()};var x=function(t){var e=t.serviceDomain,r=t.apiKey,n=t.retry;if(!e||!r)throw new Error("parameter is required (check serviceDomain and apiKey)");if(!S(e)||!S(r))throw new Error("parameter is not string");var o="https://".concat(e,".").concat(O,"/api/").concat(E),u=function(){var t=i(function(t){var e,u,a,s,c,l,p,m,d;return y(this,function(v){switch(v.label){case 0:e=t.endpoint,u=t.contentId,a=t.queries,s=a===void 0?{}:a,c=t.requestInit;l=I(r),p=R(s),m="".concat(o,"/").concat(e).concat(u?"/".concat(u):"").concat(p?"?".concat(p):""),d=function(){var t=i(function(t){var e,r,n;return y(this,function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);return[4,t.json()];case 1:e=i.sent(),r=e.message;return[2,r!==null&&r!==void 0?r:null];case 2:n=i.sent();return[2,null];case 3:return[2]}})});return function e(e){return t.apply(this,arguments)}}();return[4,(0,q.default)(function(){var t=i(function(t){var e,r,n,i,o,u,a;return y(this,function(s){switch(s.label){case 0:s.trys.push([0,6,,7]);return[4,l(m,h(f({},c),{method:(r=c===null||c===void 0?void 0:c.method)!==null&&r!==void 0?r:"GET"}))];case 1:if(!(e=s.sent(),e.status!==429&&e.status>=400&&e.status<500))return[3,3];return[4,d(e)];case 2:n=s.sent();return[2,t(new Error("fetch API response status: ".concat(e.status).concat(n?"\n message is `".concat(n,"`"):"")))];case 3:if(!!e.ok)return[3,5];return[4,d(e)];case 4:i=s.sent();return[2,Promise.reject(new Error("fetch API response status: ".concat(e.status).concat(i?"\n message is `".concat(i,"`"):"")))];case 5:return[2,(c===null||c===void 0?void 0:c.method)==="DELETE"?void 0:e.json()];case 6:o=s.sent();if(o.data)throw o.data;if((u=o.response)===null||u===void 0?void 0:u.data)throw o.response.data;return[2,Promise.reject(new Error("Network Error.\n Details: ".concat((a=o.message)!==null&&a!==void 0?a:"")))];case 7:return[2]}})});return function(e){return t.apply(this,arguments)}}(),{retries:n?2:0,onRetry:function(t,e){console.log(t),console.log("Waiting for retry (".concat(e,"/",2,")"))},minTimeout:5e3})];case 1:return[2,v.sent()]}})});return function e(e){return t.apply(this,arguments)}}();return{get:function(){var t=i(function(t){var e,r,n,i,o,a;return y(this,function(s){switch(s.label){case 0:e=t.endpoint,r=t.contentId,n=t.queries,i=n===void 0?{}:n,o=t.customRequestInit;if(!e)return[3,2];return[4,u({endpoint:e,contentId:r,queries:i,requestInit:o})];case 1:a=s.sent();return[3,3];case 2:a=Promise.reject(new Error("endpoint is required"));s.label=3;case 3:return[2,a]}})});return function(e){return t.apply(this,arguments)}}(),getList:function(){var t=i(function(t){var e,r,n,i,o;return y(this,function(a){switch(a.label){case 0:e=t.endpoint,r=t.queries,n=r===void 0?{}:r,i=t.customRequestInit;if(!e)return[3,2];return[4,u({endpoint:e,queries:n,requestInit:i})];case 1:o=a.sent();return[3,3];case 2:o=Promise.reject(new Error("endpoint is required"));a.label=3;case 3:return[2,o]}})});return function(e){return t.apply(this,arguments)}}(),getListDetail:function(){var t=i(function(t){var e,r,n,i,o,a;return y(this,function(s){switch(s.label){case 0:e=t.endpoint,r=t.contentId,n=t.queries,i=n===void 0?{}:n,o=t.customRequestInit;if(!e)return[3,2];return[4,u({endpoint:e,contentId:r,queries:i,requestInit:o})];case 1:a=s.sent();return[3,3];case 2:a=Promise.reject(new Error("endpoint is required"));s.label=3;case 3:return[2,a]}})});return function(e){return t.apply(this,arguments)}}(),getObject:function(){var t=i(function(t){var e,r,n,i,o;return y(this,function(a){switch(a.label){case 0:e=t.endpoint,r=t.queries,n=r===void 0?{}:r,i=t.customRequestInit;if(!e)return[3,2];return[4,u({endpoint:e,queries:n,requestInit:i})];case 1:o=a.sent();return[3,3];case 2:o=Promise.reject(new Error("endpoint is required"));a.label=3;case 3:return[2,o]}})});return function(e){return t.apply(this,arguments)}}(),getAllContentIds:function(){var t=i(function(t){var e,r,n,i,o,a,s,c,l,p,m,v,b,w,g,_,T;return y(this,function(y){switch(y.label){case 0:e=t.endpoint,r=t.alternateField,n=t.draftKey,i=t.filters,o=t.orders,a=t.customRequestInit;s={draftKey:n,filters:i,orders:o,limit:100,fields:r!==null&&r!==void 0?r:"id",depth:0};return[4,u({endpoint:e,queries:h(f({},s),{limit:0}),requestInit:a})];case 1:c=y.sent(),l=c.totalCount,p=[],m=0,v=function(t){return new Promise(function(e){return setTimeout(e,t)})},b=function(t){return t.every(function(t){return typeof t=="string"})};y.label=2;case 2:if(!(p.length<l))return[3,7];return[4,u({endpoint:e,queries:h(f({},s),{offset:m}),requestInit:a})];case 3:w=y.sent(),g=w.contents,_=g.map(function(t){return t[r!==null&&r!==void 0?r:"id"]});if(!b(_))throw new Error("The value of the field specified by `alternateField` is not a string.");p=d(p).concat(d(_)),m+=100;T=p.length<l;if(!T)return[3,5];return[4,v(1e3)];case 4:T=y.sent();y.label=5;case 5:T;y.label=6;case 6:return[3,2];case 7:return[2,p]}})});return function(e){return t.apply(this,arguments)}}(),getAllContents:function(){var t=i(function(t){var e,r,n,i,o,a,s,c,l,p,m,d;return y(this,function(v){switch(v.label){case 0:e=t.endpoint,r=t.queries,n=r===void 0?{}:r,i=t.customRequestInit;return[4,u({endpoint:e,queries:h(f({},n),{limit:0}),requestInit:i})];case 1:o=v.sent(),a=o.totalCount,s=[],c=0,l=function(t){return new Promise(function(e){return setTimeout(e,t)})};v.label=2;case 2:if(!(s.length<a))return[3,7];return[4,u({endpoint:e,queries:h(f({},n),{limit:100,offset:c}),requestInit:i})];case 3:p=v.sent(),m=p.contents;s=s.concat(m),c+=100;d=s.length<a;if(!d)return[3,5];return[4,l(1e3)];case 4:d=v.sent();v.label=5;case 5:d;v.label=6;case 6:return[3,2];case 7:return[2,s]}})});return function(e){return t.apply(this,arguments)}}(),create:function(){var t=i(function(t){var e,r,n,i,o,a,s,c;return y(this,function(l){e=t.endpoint,r=t.contentId,n=t.content,i=t.isDraft,o=i===void 0?!1:i,a=t.customRequestInit;if(!e)return[2,Promise.reject(new Error("endpoint is required"))];s=o?{status:"draft"}:{},c=h(f({},a),{method:r?"PUT":"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});return[2,u({endpoint:e,contentId:r,queries:s,requestInit:c})]})});return function(e){return t.apply(this,arguments)}}(),update:function(){var t=i(function(t){var e,r,n,i,o;return y(this,function(a){e=t.endpoint,r=t.contentId,n=t.content,i=t.customRequestInit;if(!e)return[2,Promise.reject(new Error("endpoint is required"))];o=h(f({},i),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});return[2,u({endpoint:e,contentId:r,requestInit:o})]})});return function(e){return t.apply(this,arguments)}}(),delete:function(){var t=i(function(t){var e,r,n,i;return y(this,function(o){switch(o.label){case 0:e=t.endpoint,r=t.contentId,n=t.customRequestInit;if(!e)return[2,Promise.reject(new Error("endpoint is required"))];if(!r)return[2,Promise.reject(new Error("contentId is required"))];i=h(f({},n),{method:"DELETE",headers:{},body:void 0});return[4,u({endpoint:e,contentId:r,requestInit:i})];case 1:o.sent();return[2]}})});return function(e){return t.apply(this,arguments)}}()}};var A=function(t){var e=t.serviceDomain,r=t.apiKey;if(!e||!r)throw new Error("parameter is required (check serviceDomain and apiKey)");if(!S(e)||!S(r))throw new Error("parameter is not string");var n=function(){var t=i(function(t){var n,o,u,a,s,c,l,p,m,d,v,b,w,g,_,T;return y(this,function(q){switch(q.label){case 0:n=t.path,o=t.apiVersion,u=t.queries,a=u===void 0?{}:u,s=t.requestInit;c="https://".concat(e,".").concat(j,"/api/").concat(o),l=I(r),p=R(a),m="".concat(c,"/").concat(n).concat(p?"?".concat(p):""),d=function(){var t=i(function(t){var e,r,n;return y(this,function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);return[4,t.json()];case 1:e=i.sent(),r=e.message;return[2,r!==null&&r!==void 0?r:null];case 2:n=i.sent();return[2,null];case 3:return[2]}})});return function e(e){return t.apply(this,arguments)}}();q.label=1;case 1:q.trys.push([1,3,,4]);return[4,l(m,h(f({},s),{method:(b=s===null||s===void 0?void 0:s.method)!==null&&b!==void 0?b:"GET"}))];case 2:v=q.sent();return[3,4];case 3:w=q.sent();if(w.data)throw w.data;if((g=w.response)===null||g===void 0?void 0:g.data)throw w.response.data;return[2,Promise.reject(new Error("Network Error.\n Details: ".concat((_=w.message)!==null&&_!==void 0?_:"")))];case 4:if(!!v.ok)return[3,6];return[4,d(v)];case 5:T=q.sent();return[2,Promise.reject(new Error("fetch API response status: ".concat(v.status).concat(T?"\n message is `".concat(T,"`"):"")))];case 6:return[2,v.json()]}})});return function e(e){return t.apply(this,arguments)}}();return{uploadMedia:function(){var t=i(function(t){var e,r,i,o,a,s,c,l,f,p,h,m;return y(this,function(d){switch(d.label){case 0:e=t.data,r=t.name,i=t.type,o=t.customRequestHeaders;a=new FormData;if(!u(e,Blob))return[3,1];if(e.name)a.set("file",e,e.name);else{if(!r)throw new Error("name is required when data is a Blob");a.set("file",e,r)}return[3,9];case 1:if(!u(e,ReadableStream))return[3,6];if(!r)throw new Error("name is required when data is a ReadableStream");if(!i)throw new Error("type is required when data is a ReadableStream");s=[],c=e.getReader();d.label=2;case 2:return[4,c.read()];case 3:if(!!(l=d.sent()).done)return[3,5];s.push(l.value);d.label=4;case 4:return[3,2];case 5:a.set("file",new Blob(s,{type:i}),r);return[3,9];case 6:if(!(typeof e=="string"||u(e,URL)))return[3,9];f=u(e,URL)?e:new URL(e);return[4,fetch(f.toString(),o?{headers:o}:void 0)];case 7:p=d.sent();return[4,p.blob()];case 8:h=d.sent(),m=new URL(p.url).pathname.split("/").pop();a.set("file",h,r!==null&&r!==void 0?r:m);d.label=9;case 9:return[2,n({path:"media",apiVersion:E,requestInit:{method:"POST",body:a}})]}})});return function(e){return t.apply(this,arguments)}}()}};return v(T)}();//# sourceMappingURL=microcms-js-sdk.js.map
|