/*! For license information please see sdk.js.LICENSE.txt */!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("liff",[],t):"object"==typeof exports?exports.liff=t():e.liff=t()}(window,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="https://static.line-scdn.net/liff/edge/2/",n(n.s=9)}([function(e,t,n){"use strict";t.a=function(e){var t=this.constructor;return this.then((function(n){return t.resolve(e()).then((function(){return n}))}),(function(n){return t.resolve(e()).then((function(){return t.reject(n)}))}))}},function(e,t,n){"use strict";t.a=function(e){return new this((function(t,n){if(!e||void 0===e.length)return n(new TypeError(typeof e+" "+e+" is not iterable(cannot read property Symbol(Symbol.iterator))"));var r=Array.prototype.slice.call(e);if(0===r.length)return t([]);var i=r.length;function o(e,n){if(n&&("object"==typeof n||"function"==typeof n)){var a=n.then;if("function"==typeof a)return void a.call(n,(function(t){o(e,t)}),(function(n){r[e]={status:"rejected",reason:n},0==--i&&t(r)}))}r[e]={status:"fulfilled",value:n},0==--i&&t(r)}for(var a=0;a>>t|e<<32-t}for(var r,i,o=Math.pow,a=o(2,32),s="",u=[],c=8*t.length,l=e.h=e.h||[],f=e.k=e.k||[],d=f.length,h={},p=2;d<64;p++)if(!h[p]){for(r=0;r<313;r+=p)h[r]=p;l[d]=o(p,.5)*a|0,f[d++]=o(p,1/3)*a|0}for(t+="€";t.length%64-56;)t+="\0";for(r=0;r>8)return;u[r>>2]|=i<<(3-r)%4*8}for(u[u.length]=c/a|0,u[u.length]=c,i=0;i>>3)+v[r-7]+(n(b,17)^n(b,19)^b>>>10)|0);(l=[I+((n(m,2)^n(m,13)^n(m,22))+(m&l[1]^m&l[2]^l[1]&l[2]))|0].concat(l))[4]=l[4]+I|0}for(r=0;r<8;r++)l[r]=l[r]+y[r]|0}for(r=0;r<8;r++)for(i=3;i+1;i--){var E=l[r]>>8*i&255;s+=(E<16?0:"")+E.toString(16)}return s};return e.code='var sha256=function a(b){function c(a,b){return a>>>b|a<<32-b}for(var d,e,f=Math.pow,g=f(2,32),h="length",i="",j=[],k=8*b[h],l=a.h=a.h||[],m=a.k=a.k||[],n=m[h],o={},p=2;64>n;p++)if(!o[p]){for(d=0;313>d;d+=p)o[d]=p;l[n]=f(p,.5)*g|0,m[n++]=f(p,1/3)*g|0}for(b+="\\x80";b[h]%64-56;)b+="\\x00";for(d=0;d>8)return;j[d>>2]|=e<<(3-d)%4*8}for(j[j[h]]=k/g|0,j[j[h]]=k,e=0;ed;d++){var s=q[d-15],t=q[d-2],u=l[0],v=l[4],w=l[7]+(c(v,6)^c(v,11)^c(v,25))+(v&l[5]^~v&l[6])+m[d]+(q[d]=16>d?q[d]:q[d-16]+(c(s,7)^c(s,18)^s>>>3)+q[d-7]+(c(t,17)^c(t,19)^t>>>10)|0),x=(c(u,2)^c(u,13)^c(u,22))+(u&l[1]^u&l[2]^l[1]&l[2]);l=[w+x|0].concat(l),l[4]=l[4]+w|0}for(d=0;8>d;d++)l[d]=l[d]+r[d]|0}for(d=0;8>d;d++)for(e=3;e+1;e--){var y=l[d]>>8*e&255;i+=(16>y?0:"")+y.toString(16)}return i};',e})?r.apply(t,i):r)||(e.exports=o)},function(e,t,n){"use strict";(function(e){var t=n(3),r=n(0),i=n(1),o=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==e)return e;throw new Error("unable to locate global object")}();"function"!=typeof o.Promise?o.Promise=t.a:o.Promise.prototype.finally?o.Promise.allSettled||(o.Promise.allSettled=i.a):o.Promise.prototype.finally=r.a}).call(this,n(2))},function(e,t,n){(function(e){var r=void 0!==e&&e||"undefined"!=typeof self&&self||window,i=Function.prototype.apply;function o(e,t){this._id=e,this._clearFn=t}t.setTimeout=function(){return new o(i.call(setTimeout,r,arguments),clearTimeout)},t.setInterval=function(){return new o(i.call(setInterval,r,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},o.prototype.unref=o.prototype.ref=function(){},o.prototype.close=function(){this._clearFn.call(r,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout((function(){e._onTimeout&&e._onTimeout()}),t))},n(7),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(this,n(2))},function(e,t,n){(function(e,t){!function(e,n){"use strict";if(!e.setImmediate){var r,i,o,a,s,u=1,c={},l=!1,f=e.document,d=Object.getPrototypeOf&&Object.getPrototypeOf(e);d=d&&d.setTimeout?d:e,"[object process]"==={}.toString.call(e.process)?r=function(e){t.nextTick((function(){p(e)}))}:!function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=n,t}}()?e.MessageChannel?((o=new MessageChannel).port1.onmessage=function(e){p(e.data)},r=function(e){o.port2.postMessage(e)}):f&&"onreadystatechange"in f.createElement("script")?(i=f.documentElement,r=function(e){var t=f.createElement("script");t.onreadystatechange=function(){p(e),t.onreadystatechange=null,i.removeChild(t),t=null},i.appendChild(t)}):r=function(e){setTimeout(p,0,e)}:(a="setImmediate$"+Math.random()+"$",s=function(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(a)&&p(+t.data.slice(a.length))},e.addEventListener?e.addEventListener("message",s,!1):e.attachEvent("onmessage",s),r=function(t){e.postMessage(a+t,"*")}),d.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),n=0;n1)for(var n=1;n-1};function f(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(e)||""===e)throw new TypeError('Invalid character in header field name: "'+e+'"');return e.toLowerCase()}function d(e){return"string"!=typeof e&&(e=String(e)),e}function h(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return o&&(t[Symbol.iterator]=function(){return t}),t}function p(e){this.map={},e instanceof p?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function v(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function y(e){return new Promise((function(t,n){e.onload=function(){t(e.result)},e.onerror=function(){n(e.error)}}))}function w(e){var t=new FileReader,n=y(t);return t.readAsArrayBuffer(e),n}function b(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function m(){return this.bodyUsed=!1,this._initBody=function(e){var t;this.bodyUsed=this.bodyUsed,this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:a&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:s&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:i&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():u&&a&&((t=e)&&DataView.prototype.isPrototypeOf(t))?(this._bodyArrayBuffer=b(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):u&&(ArrayBuffer.prototype.isPrototypeOf(e)||l(e))?this._bodyArrayBuffer=b(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):i&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},a&&(this.blob=function(){var e=v(this);if(e)return e;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(){if(this._bodyArrayBuffer){var e=v(this);return e||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}return this.blob().then(w)}),this.text=function(){var e,t,n,r=v(this);if(r)return r;if(this._bodyBlob)return e=this._bodyBlob,t=new FileReader,n=y(t),t.readAsText(e),n;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),n=new Array(t.length),r=0;r-1?r:n),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(i),!("GET"!==this.method&&"HEAD"!==this.method||"no-store"!==t.cache&&"no-cache"!==t.cache)){var o=/([?&])_=[^&]*/;if(o.test(this.url))this.url=this.url.replace(o,"$1_="+(new Date).getTime());else{this.url+=(/\?/.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}}function E(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var n=e.split("="),r=n.shift().replace(/\+/g," "),i=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(r),decodeURIComponent(i))}})),t}function T(e,t){if(!(this instanceof T))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText=void 0===t.statusText?"":""+t.statusText,this.headers=new p(t.headers),this.url=t.url||"",this._initBody(e)}I.prototype.clone=function(){return new I(this,{body:this._bodyInit})},m.call(I.prototype),m.call(T.prototype),T.prototype.clone=function(){return new T(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new p(this.headers),url:this.url})},T.error=function(){var e=new T(null,{status:0,statusText:""});return e.type="error",e};var S=[301,302,303,307,308];T.redirect=function(e,t){if(-1===S.indexOf(t))throw new RangeError("Invalid status code");return new T(null,{status:t,headers:{location:e}})};var O=r.DOMException;try{new O}catch(Li){(O=function(e,t){this.message=e,this.name=t;var n=Error(e);this.stack=n.stack}).prototype=Object.create(Error.prototype),O.prototype.constructor=O}function _(e,t){return new Promise((function(n,i){var o=new I(e,t);if(o.signal&&o.signal.aborted)return i(new O("Aborted","AbortError"));var s=new XMLHttpRequest;function c(){s.abort()}s.onload=function(){var e,t,r={status:s.status,statusText:s.statusText,headers:(e=s.getAllResponseHeaders()||"",t=new p,e.replace(/\r?\n[\t ]+/g," ").split("\r").map((function(e){return 0===e.indexOf("\n")?e.substr(1,e.length):e})).forEach((function(e){var n=e.split(":"),r=n.shift().trim();if(r){var i=n.join(":").trim();t.append(r,i)}})),t)};r.url="responseURL"in s?s.responseURL:r.headers.get("X-Request-URL");var i="response"in s?s.response:s.responseText;setTimeout((function(){n(new T(i,r))}),0)},s.onerror=function(){setTimeout((function(){i(new TypeError("Network request failed"))}),0)},s.ontimeout=function(){setTimeout((function(){i(new TypeError("Network request failed"))}),0)},s.onabort=function(){setTimeout((function(){i(new O("Aborted","AbortError"))}),0)},s.open(o.method,function(e){try{return""===e&&r.location.href?r.location.href:e}catch(t){return e}}(o.url),!0),"include"===o.credentials?s.withCredentials=!0:"omit"===o.credentials&&(s.withCredentials=!1),"responseType"in s&&(a?s.responseType="blob":u&&o.headers.get("Content-Type")&&-1!==o.headers.get("Content-Type").indexOf("application/octet-stream")&&(s.responseType="arraybuffer")),!t||"object"!=typeof t.headers||t.headers instanceof p?o.headers.forEach((function(e,t){s.setRequestHeader(t,e)})):Object.getOwnPropertyNames(t.headers).forEach((function(e){s.setRequestHeader(e,d(t.headers[e]))})),o.signal&&(o.signal.addEventListener("abort",c),s.onreadystatechange=function(){4===s.readyState&&o.signal.removeEventListener("abort",c)}),s.send(void 0===o._bodyInit?null:o._bodyInit)}))}_.polyfill=!0,r.fetch||(r.fetch=_,r.Headers=p,r.Request=I,r.Response=T);n(5);var k=function(){return(k=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0)&&!(r=o.next()).done;)a.push(r.value)}catch(s){i={error:s}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}Object.create;var A,L=new Promise((function(e){A=e})),N="UNAUTHORIZED",F="INVALID_ARGUMENT",j="INIT_FAILED",R="INVALID_CONFIG",U="INVALID_ID_TOKEN",D="EXCEPTION_IN_SUBWINDOW",B={ACCESS_TOKEN:"accessToken",ID_TOKEN:"IDToken",DECODED_ID_TOKEN:"decodedIDToken",FEATURE_TOKEN:"featureToken",LOGIN_TMP:"loginTmp",CONFIG:"config",CONTEXT:"context",EXPIRES:"expires",RAW_CONTEXT:"rawContext",CLIENT_ID:"clientId",IS_SUBSEQUENT_LIFF_APP:"isSubsequentLiffApp",MST_CHALLENGE:"mstChallenge",MSIT:"msit",MST:"mst",MST_VERIFIER:"mstVerifier",APP_DATA:"appData"},M="isInClient",W=["context_token","feature_token","access_token","id_token","client_id","mst_verifier","mst_challenge","msit"],G=["liff.ref.source","liff.ref.medium","liff.ref.campaign","liff.ref.term","liff.ref.content"],K={INIT:"init",SUBMIT:"submit",CANCEL:"cancel",CLOSE:"close",ERROR:"error"},H=["profile","chat_message.write","openid","email"];Object.create;function V(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(s){i={error:s}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function J(){for(var e=[],t=0;t=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Y(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(s){i={error:s}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}Object.create;function Z(e){return window.atob(e.replace(/-/g,"+").replace(/_/g,"/"))}var ee={decode:Z,encode:function(e){return window.btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")},decodeUnicode:function(e){var t=Z(e).split("").map((function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)})).join("");return decodeURIComponent(t)}};function te(e,t){if(e===t)return 0;for(var n=e.split("."),r=t.split("."),i=Math.max(n.length,r.length),o=0;o0?1:-1}return 0}function ne(e){var t=e.replace("#","").match(/.{2}/g)||[];if(4!==t.length)return $.warn("convertArgbToRgba: Received invalid ARGB color"),"";var n=function(e){var t=re(e);return Math.round(t/255*100)/100}(t[0]);return"rgba("+re(t[1])+", "+re(t[2])+", "+re(t[3])+", "+n+")"}function re(e){return parseInt(e,16)}function ie(e){var t=e.replace("#","").match(/.{2}/g)||[];return 3!==t.length?($.warn("convertArgbToRgba: Received invalid hex color"),""):re(t[0])+", "+re(t[1])+", "+re(t[2])}function oe(e){for(var t=e.length,n=new ArrayBuffer(t),r=new Uint8Array(n),i=0;i0})).reduce((function(e,t){var n=Y(t.split("=").map(decodeURIComponent),2),r=n[0],i=n[1],o=e[r];return Array.isArray(o)?o.push(i):Object.prototype.hasOwnProperty.call(e,r)?e[r]=[o,i]:e[r]=i,e}),{})},ve=function(e){return Object.keys(e).map((function(t){var n=e[t],r=function(e){return void 0!==e?encodeURIComponent(t)+"="+encodeURIComponent(e):encodeURIComponent(t)};return Array.isArray(n)?n.map((function(e){return r(e)})).join("&"):r(n)})).join("&")},ye="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function we(e){for(var t="",n=0;n0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0)&&te(n,e)>=0}function ct(e){var t=st(e);if(!t)return!1;var n=t.permission,r=t.minVer,i=t.unsupportedFromVer;return!!n&&!!ke()&&ut(r,i)}var lt={shareTargetPicker:function(){if(!Qe())return!1;var e=st("shareTargetPicker");if(!e)return!1;var t=e.permission,n=e.minVer;if(!t)return!1;if(ke()){var r=Ze();return null!==r&&te(r,n)>=0}return!0},multipleLiffTransition:function(){var e=st("multipleLiffTransition");if(!e)return!1;var t=e.permission;return ke()&&t},subwindowOpen:function(){var e=st("subwindowOpen");return!(!e||!e.permission)&&(!ke()||ut(e.minVer,e.unsupportedFromVer))},scanCode:function(){return ct("scanCode")},scanCodeV2:function(){if(!Qe())return!1;var e=st("scanCodeV2");return!(!e||!e.permission)&&(!ke()||ut(e.minVer))},getAdvertisingId:function(){return ct("getAdvertisingId")},addToHomeScreen:function(){return ct("addToHomeScreen")},bluetoothLeFunction:function(){return ct("bluetoothLeFunction")},skipChannelVerificationScreen:function(){return ct("skipChannelVerificationScreen")}};function ft(e){if(!at.includes(e))throw fe(F,"Unexpected API name.");var t=lt[e];return!t||t()}function dt(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(t){o(t)}}function s(e){try{u(r.throw(e))}catch(t){o(t)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))}function ht(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0)&&!(r=o.next()).done;)a.push(r.value)}catch(s){i={error:s}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}Object.create;var vt=function(){return(vt=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&r.length>0},this.isReady=function(){return t.hasIdentification()&&!!t.messageHandlerInstance},this.setup=function(){return kt(t,void 0,void 0,(function(){var e,t,n,r,i,o=this;return Ct(this,(function(a){switch(a.label){case 0:return this.messageHandlerInstance?[2]:[4,this.generateIdentification()];case 1:if(a.sent(),!(e=this.identification.identifier))return[2];if(t=/^[a-zA-Z0-9]+$/gm,!e.match(t))throw fe("UNKNOWN","Invalid identifier");return(n=document.createElement("iframe")).style.display="none",n.src="about:blank",document.body.appendChild(n),null===(i=null==n?void 0:n.contentWindow)||void 0===i||i.window.eval("("+Bt.toString().replace("$MESSAGE_HANDLER_URL","https://liff-subwindow.line.me/liff/v2/sub/messageHandler").replace("$IDENTIFIER",e.split("'")[0])+")()"),r="iframe-"+e+"-ready",[4,new Promise((function(e){var t=function(i){i.data[r]&&(o.messageHandlerInstance=n,window.addEventListener("message",o.proxyToListeners),e(),document.removeEventListener("message",t))};window.addEventListener("message",t)}))];case 2:return[2,a.sent()]}}))}))},this.teardown=function(){return kt(t,void 0,void 0,(function(){var e,t;return Ct(this,(function(n){switch(n.label){case 0:return this.isReady()?[4,this.send({eventName:xt.TEARDOWN})]:[3,2];case 1:n.sent(),window.removeEventListener("message",this.proxyToListeners),this.listeners.clear(),null===(t=null===(e=this.messageHandlerInstance)||void 0===e?void 0:e.parentNode)||void 0===t||t.removeChild(this.messageHandlerInstance),this.messageHandlerInstance=null,n.label=2;case 2:return[2]}}))}))},this.listen=function(e){t.listeners.set(e,e)},this.listenRepliedEvent=function(e,n){var r=function(i){i.replyTarget&&function(e,t){return Ut(e)===Ut(t)}(i.replyTarget,e)&&(n(i),t.listeners.delete(r))};t.listeners.set(r,r)},this.send=function(e){return kt(t,void 0,void 0,(function(){var t,n,r,i,o=this;return Ct(this,(function(a){switch(a.label){case 0:if(!this.isReady())throw fe("message bus is not ready to send message");return n={action:Dt(e.eventName),identifier:this.identification.identifier||"",timestamp:(new Date).getTime()},[4,this.getEncryptedContext(e)];case 1:return n.context=a.sent(),t=n,null===(i=null===(r=this.messageHandlerInstance)||void 0===r?void 0:r.contentWindow)||void 0===i||i.postMessage({messageBusEvent:t},"*"),this.sentMessages.push(Ut(t)),[4,new Promise((function(e){o.listenRepliedEvent(t,(function(t){e(t.context)}))}))];case 2:return[2,a.sent()]}}))}))},this.reply=function(e,n){return kt(t,void 0,void 0,(function(){var t,r,i,o;return Ct(this,(function(a){switch(a.label){case 0:if(!this.isReady())throw fe("message bus is not ready to send message");if(!e.identifier||!e.timestamp)throw fe("UNKNOWN","target message is not valid");return r={action:Pt},[4,this.getEncryptedContext(n)];case 1:return r.context=a.sent(),r.identifier=this.identification.identifier||"",r.timestamp=(new Date).getTime(),r.replyTarget={action:e.action,identifier:e.identifier,timestamp:e.timestamp},t=r,null===(o=null===(i=this.messageHandlerInstance)||void 0===i?void 0:i.contentWindow)||void 0===o||o.postMessage({messageBusEvent:t},"*"),this.sentMessages.push(Ut(t)),[2]}}))}))},this.setData=function(e,n){void 0===e&&(e="appData"),t.send({eventName:xt.SET_DATA,key:e,data:n})},this.getData=function(e){return void 0===e&&(e="appData"),kt(t,void 0,void 0,(function(){return Ct(this,(function(t){switch(t.label){case 0:return[4,this.send({eventName:xt.GET_DATA,key:e})];case 1:return[2,t.sent()]}}))}))},this.proxyToListeners=function(e){return kt(t,void 0,void 0,(function(){var t,n=this;return Ct(this,(function(r){return(t=e.data.messageBusEvent)?(this.sentMessages.includes(Ut(t))||t.identifier!==this.identification.identifier||t.action!==Pt&&!t.replyTarget||this.listeners.forEach((function(e){return kt(n,void 0,void 0,(function(){var n,r,i;return Ct(this,(function(o){switch(o.label){case 0:return n=e,r=[_t({},t)],i={},[4,this.getDecryptedContext(t.context)];case 1:return n.apply(void 0,[_t.apply(void 0,r.concat([(i.context=o.sent(),i)]))]),[2]}}))}))})),[2]):[2]}))}))},this.getEncryptedContext=function(e){return kt(t,void 0,void 0,(function(){var t,n,r,i,o,a,s;return Ct(this,(function(u){switch(u.label){case 0:return t=this.identification,n=t.identifier,r=t.cryptoKey,o=(i=JSON).stringify,s={eventName:e.eventName,key:e.key?e.key:void 0},e.data?[4,jt(n,r,JSON.stringify(e.data))]:[3,2];case 1:return a=u.sent(),[3,3];case 2:a=void 0,u.label=3;case 3:return[2,o.apply(i,[(s.data=a,s)])]}}))}))},this.getDecryptedContext=function(e){return kt(t,void 0,void 0,(function(){var t,n,r,i,o,a,s,u;return Ct(this,(function(c){switch(c.label){case 0:return t=this.identification,n=t.identifier,r=t.cryptoKey,(i=JSON.parse(e)).data&&"string"==typeof i.data?(u=(s=JSON).parse,[4,Rt(n,r,i.data)]):[3,2];case 1:return a=u.apply(s,[c.sent()]),[3,3];case 2:a=void 0,c.label=3;case 3:return o=a,[2,_t(_t({},i),{data:o})]}}))}))},this.windowType=e};var Wt=function(){return(Wt=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=0&&n.splice(r,1)}}function Jt(e,t,n){void 0===t&&(t={}),void 0===n&&(n="");var r=Be();if(!r)throw fe("FORBIDDEN","Invalid featureToken for client features");if(!window._liff||!window._liff.postMessage)throw fe(F,"postMessage is not available from client");$.debug("[js postMessage to client]",e,n,t),window._liff.postMessage(e,r,n,JSON.stringify(t))}function qt(e,t,n){return void 0===t&&(t={}),void 0===n&&(n={once:!0}),Be()?(n=Wt({callbackId:we(12),once:!0},n),new Promise((function(r,i){var o=function(t){if(t&&t.detail){var a=t.detail.callbackId===n.callbackId,s="string"!=typeof t.detail.callbackId;(a||s)&&(n.once&&Vt(e,o),$.debug("[callback detail]",t.detail),t.detail.error?i(t.detail.error):t.detail.data?r(t.detail.data):i(t.detail))}i()};Ht(e,o),Jt(e,t,n.callbackId)}))):Promise.reject(fe("FORBIDDEN","Invalid featureToken for client features"))}function zt(){var e=Ze();null!==e&&("ios"===Ye()&&te(e,"9.19")>=0||"android"===Ye()&&te(e,"11.6.0")>=0)?location.href="liff://close":window._liff&&window._liff.postMessage?null!==e&&te(e,"10.15.0")>=0?"ios"===Ye()?window._liff.postMessage("closeWindow",""):window._liff.postMessage("closeWindow","","",""):qt("closeWindow"):window.close()}function $t(e){return gt(St("subWindowGetOrigin")(e))}var Xt={};function Qt(e,t){e&&Xt[e]&&Xt[e].forEach((function(e){e(t)}))}var Yt,Zt,en,tn,nn,rn=function(){function e(e){this.storage=e}return e.prototype.getItem=function(e){return this.storage.getItem(this.getKeyPrefix()+":"+e)},e.prototype.setItem=function(e,t){this.storage.setItem(this.getKeyPrefix()+":"+e,t)},e.prototype.removeItem=function(e){this.storage.removeItem(this.getKeyPrefix()+":"+e)},e.prototype.clear=function(){this.storage.clear()},e.prototype.getKeyPrefix=function(){return"LIFF_STORE:"+this.getLiffId()},e.prototype.getLiffId=function(){var e=Pe().liffId;if(!e)throw fe(R,"liffId is necessary for liff.init()");return e},e}(),on=new rn(he);function an(){var e=on.getItem("subWindowStatusUpdated");return null!==e&&JSON.parse(e)}function sn(e){on.setItem("subWindowStatusUpdated",String(e))}function un(e){Yt=e}function cn(){return Yt}function ln(){return en}function fn(){return tn}function dn(e){return void 0===e&&(e=Lt),dt(this,void 0,void 0,(function(){return ht(this,(function(t){switch(t.label){case 0:return[4,(nn=new Mt(e)).setup()];case 1:return t.sent(),[2,nn]}}))}))}function hn(){return nn}var pn=new rn(window.sessionStorage);function vn(){return pn.getItem("mainWindowOrigin")}function yn(e,t){return void 0===t&&(t={}),dt(this,void 0,void 0,(function(){var n,r,i,o,a,s,u,c;return ht(this,(function(l){switch(l.label){case 0:if(null==(n=hn())?void 0:n.isReady())return[3,5];if(r=JSON.stringify(t),i=Pe().liffId,o=vn(),!window.opener||!o||!i)throw fe(D);a=!1,l.label=1;case 1:return l.trys.push([1,3,,4]),[4,$t(i)];case 2:return s=l.sent(),a=s.subwindowCommonModule,[3,4];case 3:throw u=l.sent(),$.debug(u),fe(D);case 4:return c=a?o:location.origin,[2,new Promise((function(t){window.addEventListener("message",(function n(i){(function(e){return!(!e.data||"string"!=typeof e.data.type||![K.SUBMIT,K.CANCEL].includes(e.data.type))})(i)&&(window.removeEventListener("message",n),t({status:e,result:r}))})),window.opener.postMessage({status:e,result:r},c)}))];case 5:return n.send({eventName:e,data:t}),[4,new Promise((function(e){setTimeout(e,500)}))];case 6:return l.sent(),[2,{status:e,result:JSON.stringify(t)}]}}))}))}function wn(e){var t,n=fn();if(e.origin===n){var r=e.data;if(r){var i,o=r.status,a=r.result;try{i=JSON.parse(a||"{}")}catch(s){i={}}switch(o){case"healthCheck":window.clearInterval(ln()),In();break;case K.CANCEL:case K.SUBMIT:sn(!0),window.clearInterval(ln()),window.removeEventListener("message",wn),Qt(o,i),null===(t=cn())||void 0===t||t.postMessage({type:o},fn());break;default:$.debug("unexpected message")}}}}var bn=function(e){return dt(void 0,void 0,void 0,(function(){var t,n,r,i;return ht(this,(function(o){if(an())return[2];switch(t=e.context,n=t.eventName,r=t.data,i=hn(),n){case K.INIT:gn(!r.hasOpener);break;case K.CANCEL:case K.SUBMIT:sn(!0),Qt(n,r),null==i||i.reply(e,{eventName:n});break;case K.CLOSE:!1===an()&&(sn(!0),Qt(K.CLOSE,{})),In()}return[2]}))}))};function mn(){window.clearInterval(Zt),window.clearInterval(ln()),window.removeEventListener("message",wn)}function gn(e){if(void 0===e&&(e=!1),mn(),sn(!1),e){var t=cn();t&&(t.close(),un(null))}}function In(){return dt(this,void 0,void 0,(function(){var e;return ht(this,(function(t){switch(t.label){case 0:return(e=hn())?[4,e.teardown()]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}}))}))}function En(e){return dt(this,void 0,void 0,(function(){var t,n,r,i,o,a,s,u,c,l;return ht(this,(function(f){switch(f.label){case 0:return(t=Ee(e.url))?(gn(!0),[4,In()]):[2,Promise.reject(fe(F,"params.url must be liff url"))];case 1:return f.sent(),n=e.url,r=e.appData,(i=new URL(n)).searchParams.append("liff.subwindow","true"),[4,dn()];case 2:return o=f.sent(),i.searchParams.append("liff.subwindow.identifier",o.identification.identifier),i.searchParams.append("liff.subwindow.cryptokey",o.identification.cryptoKey),i.hostname=function(e){var t=pt(e.split("."));return function(){for(var e=[],t=0;t=500?[4,Sn()]:[3,9];case 7:return d.sent(),[4,_n(Tn,{msit:t,mstChallenge:n,onSuccess:r,onError:i,reconnectCount:a+=1})];case 8:return d.sent(),[3,20];case 9:return s.status>=400&&500>s.status?[4,On(s)]:[3,11];case 10:return(c=d.sent())?(u=c.errorDetail,i(fe(F,u))):i(fe("UNKNOWN","Some error happened in the server")),[3,20];case 11:return 200!==s.status?[3,19]:[4,On(s)];case 12:return(c=d.sent())?[3,13]:(i(fe("UNKNOWN","Some error happened in the server")),[3,18]);case 13:switch(l=c.status,f=c.result,l){case K.ERROR:return[3,14];case K.CLOSE:case K.CANCEL:case K.SUBMIT:return[3,16]}return[3,17];case 14:return[4,_n(Tn,{msit:t,mstChallenge:n,onSuccess:r,onError:i,reconnectCount:a})];case 15:return d.sent(),[3,18];case 16:return r(l,f),[3,18];case 17:i(fe("UNKNOWN","Some error happened in the server")),d.label=18;case 18:return[3,20];case 19:i(fe("UNKNOWN","Some error happened in the server")),d.label=20;case 20:return[2]}}))}))}function Sn(){return new Promise((function(e){return setTimeout(e,1e3)}))}function On(e){return dt(this,void 0,void 0,(function(){return ht(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,e.json()];case 1:return[2,t.sent()];case 2:return t.sent(),[2,null];case 3:return[2]}}))}))}function _n(e,t){return dt(this,void 0,void 0,(function(){return ht(this,(function(n){switch(n.label){case 0:return t.reconnectCount>=10?(t.onError(fe("UNKNOWN","Failed to connect")),[3,3]):[3,1];case 1:return[4,e(t)];case 2:n.sent(),n.label=3;case 3:return[2]}}))}))}function kn(e){var t={};return Object.keys(e).forEach((function(n){"closeButtonColor"===n?"white"===e[n]?t[n]="#ffffff":t[n]="#000000":t[n]=e[n]})),t}var Cn={height:"full",closeButtonPosition:"right",closeButtonColor:"black",closeButtonLabel:""};function xn(){if(!ot())throw fe(N,"this api can be only called in child window")}function Pn(e){if(!e.mst||!e.status)return Promise.reject(fe(F,"no proper argument"));var t=JSON.stringify(e);return gt(St("subWindowPost"),{method:"POST",body:t})}function An(e){var t=e.msit,n=e.mstVerifier;return t&&n?gt(St("subWindowGetMSTByMSIT"),{method:"POST",body:JSON.stringify({msit:t,mstVerifier:n})}):Promise.reject(fe(F,"no proper argument"))}function Ln(e){var t=e.mst;return t?gt(St("subWindowGetAppData"),{method:"POST",body:JSON.stringify({mst:t})}):Promise.reject(fe(F,"no proper argument"))}var Nn={on:function(e,t){Xt[e]||(Xt[e]=[]),Xt[e].push(t)},off:function(e,t){if(Xt[e]){var n=Xt[e].indexOf(t);n>=0&&Xt[e].splice(n,1)}},open:function(e){if(!ft("subwindowOpen"))throw fe("FORBIDDEN","No permission for liff.subWindow.open()");if(!Oe()&&Se())throw fe("FORBIDDEN","Subwindow is not supported in this browser");return function(){if(ot())throw fe(N,"this api can be only called in parent window")}(),ke()?function(e){var t=e.appData,n=e.native,r=Pe().liffId,i=Ue(),o=Ee(e.url);if(!r)return Promise.reject(fe(N,"liffId is invalid"));if(!i)return Promise.reject(fe(N,"mst_challenge is invalid"));if(!o)return Promise.reject(fe(F,"params.url must be liff url"));var a=Object.assign({},Cn,n);return function(e){var t=e.mainLiffId,n=e.subLiffId,r=e.mstChallenge,i=e.appData,o=e.view;return t&&r?gt(St("subWindowGetMSIT"),{method:"POST",body:JSON.stringify({mainLiffId:t,subLiffId:n,mstChallenge:r,appData:i,view:o})}):Promise.reject(fe(F,"no proper argument"))}({mainLiffId:r,subLiffId:o,mstChallenge:i,appData:t,view:kn(a)}).then((function(t){var n=t.msit;Tn({msit:n,mstChallenge:i,onSuccess:function(e,t){Qt(e,t)},onError:function(e){Qt(K.ERROR,e)}}),function(e,t){var n=e.url,r=new URLSearchParams;r.set("msit",t),location.href="liff://subwindow?url="+encodeURIComponent(n)+"&"+r.toString()}(e,n)}))}(e):En(e)},cancel:function(e){return void 0===e&&(e={}),xn(),ke()?function(e){return void 0===e&&(e={}),dt(this,void 0,void 0,(function(){var t,n;return ht(this,(function(r){switch(r.label){case 0:return(t=Re())?[4,Pn({mst:t,status:K.CANCEL,result:e})]:[2,Promise.reject(fe(N,"mst is invalid"))];case 1:return n=r.sent(),sn(!0),[2,n]}}))}))}(e):function(e){return void 0===e&&(e={}),yn(K.CANCEL,e)}(e)},submit:function(e){return void 0===e&&(e={}),xn(),ke()?function(e){return void 0===e&&(e={}),dt(this,void 0,void 0,(function(){var t,n;return ht(this,(function(r){switch(r.label){case 0:return(t=Re())?[4,Pn({mst:t,status:K.SUBMIT,result:e})]:[2,Promise.reject(fe(N,"mst is invalid"))];case 1:return n=r.sent(),sn(!0),[2,n]}}))}))}(e):function(e){return void 0===e&&(e={}),yn(K.SUBMIT,e)}(e)},close:function(){return xn(),ke()?function(){return dt(this,void 0,void 0,(function(){var e;return ht(this,(function(t){switch(t.label){case 0:return!1!==an()?[3,2]:(e=Re())?[4,Pn({mst:e,status:K.CLOSE,result:{}})]:[2,Promise.reject(fe(N,"mst is invalid"))];case 1:t.sent(),t.label=2;case 2:return zt(),[2]}}))}))}():function(){return dt(this,void 0,void 0,(function(){var e;return ht(this,(function(t){return(null==(e=hn())?void 0:e.isReady())?(e.send({eventName:K.CLOSE}),[2,new Promise((function(e){setTimeout((function(){zt(),e()}),100)}))]):(zt(),[2,Promise.resolve()])}))}))}()},getAppData:function(){return xn(),function(){var e,t=Ae(B.APP_DATA);try{e=t?JSON.parse(t):{}}catch(n){e={}}return Promise.resolve(e)}()}};function Fn(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(t){o(t)}}function s(e){try{u(r.throw(e))}catch(t){o(t)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))}function jn(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Un(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(s){i={error:s}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function Dn(){for(var e=[],t=0;t0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&!e.startsWith("/")?"/":"")+e},e.prototype.invoke=function(){return C(this,void 0,void 0,(function(){var e,t,n,r,i;return x(this,(function(o){switch(o.label){case 0:if(e=pe(window.location.search),"string"!=typeof(t=e["liff.state"]))return[2];o.label=1;case 1:return o.trys.push([1,4,,5]),n=location.href,(r=this.decodeState(t))===n?[3,3]:(e["liff.hback"]?location.replace(Ie(r,{"liff.hback":e["liff.hback"]})):location.replace(r),[4,new Promise((function(){}))]);case 2:o.sent(),o.label=3;case 3:return[3,5];case 4:if((i=o.sent()).code===j)throw i;return $.debug(i),[3,5];case 5:return[2]}}))}))},e}());function gr(e,t,n){return C(this,void 0,void 0,(function(){var r;return x(this,(function(i){switch(i.label){case 0:if(!t.liffId)throw fe(R,"liffId is necessary for liff.init()");return function(e){xe=e}(t),!ke()&&Qe()&&(function(){var e=Pe();return ae("LIFF_STORE:"+B.EXPIRES+":"+e.liffId)}()||tt()),r=pe(window.location.search),!ot()||ke()?[3,2]:[4,br()];case 1:i.sent(),i.label=2;case 2:if(r.error&&r.liffOAuth2Error)throw s=r.error,u=r.error_description.replace(/\+/g," "),fe(j,s+": "+u);return o=r.code,a=Je(),Boolean(o&&!Qe()&&a&&a.codeVerifier)?[4,wr(r.liffClientId)]:[3,4];case 3:i.sent(),i.label=4;case 4:return ke()?[4,pr(e,t)]:[3,6];case 5:return i.sent(),[3,8];case 6:return Qe()?[3,8]:[4,yr()];case 7:i.sent(),i.label=8;case 8:return[4,mr.invoke()];case 9:return i.sent(),[4,n()];case 10:return i.sent(),function(e){var t=me(be(e));window.history.replaceState(history.state,"",t)}(window.location.href),[2]}var o,a,s,u}))}))}var Ir=function(e,t){return new Promise((function(n,r){if(e){var i=document.createElement("script");i.type="module",i.onload=function(){n()},i.src=e,document.head.appendChild(i)}else r(fe(R,t))}))},Er=function(e){var t="https://static.line-scdn.net/lui/edge/versions/1.13.0/lui-alert.js";return t&&e&&(t=t.replace(/\d{1,2}\.\d{1,2}\.\d{1,3}/,e)),Ir(t,"LUI_ALERT_URL is not defined")},Tr=function(){return C(void 0,void 0,void 0,(function(){var e;return x(this,(function(t){switch(t.label){case 0:return(e=function(){var e,t=document.querySelector('script[src*="luivendor.js"]');if(t&&(null===(e=t.src.match(/\d{1,2}\.\d{1,2}\.\d{1,3}/g))||void 0===e?void 0:e.length))return t.src.match(/\d{1,2}\.\d{1,2}\.\d{1,3}/g)[0]}())?[3,2]:[4,Ir("https://static.line-scdn.net/lui/edge/versions/1.13.0/luivendor.js","LUI_VENDOR_URL is not defined")];case 1:t.sent(),t.label=2;case 2:return[4,Er(e)];case 3:return t.sent(),[4,(n=we(6),new Promise((function(){var e=document.createElement("div");e.innerHTML='',document.body.appendChild(e);var t=document.getElementById("liffAlert-"+n);t&&t.addEventListener("lui-button-click",(function(){var e=window.open(window.location.href+"&liffIsEscapedFromApp=true","_blank");e&&(e.location.href=window.location.href+"&liffIsEscapedFromApp=true",window.close())}))})))];case 4:return t.sent(),[2]}var n}))}))};function Sr(){return C(this,void 0,void 0,(function(){var e;return x(this,(function(t){switch(t.label){case 0:return ke()||"android"!==Ye()||(e=pe(window.location.search))["liff.subwindow.identifier"]||e.liffIsEscapedFromApp?[3,6]:e.liffClientId&&document.referrer.includes("access.line.me")?(window.location.href=window.location.href+"&liffIsEscapedFromApp=true",[2]):e.liffClientId&&document.referrer.includes("android-app://")?[4,Tr()]:[3,2];case 1:t.sent(),t.label=2;case 2:return e.liffClientId&&""===document.referrer&&1===window.history.length?[4,Tr()]:[3,4];case 3:t.sent(),t.label=4;case 4:return!document.referrer.includes("liffClientId")||document.referrer.includes("liffIsEscapedFromApp")?[3,6]:[4,Tr()];case 5:t.sent(),t.label=6;case 6:return[2]}}))}))}var Or=function(){function e(){this.hooks={before:new Mn,after:new Mn},this.internalHooks={beforeFinished:new Mn,beforeSuccess:new Mn,error:new Mn}}return Object.defineProperty(e.prototype,"name",{get:function(){return"init"},enumerable:!1,configurable:!0}),e.prototype.install=function(e){var t=e.liff;return this.liff=t,this.init.bind(this)},e.prototype.init=function(e,t,n){return C(this,void 0,void 0,(function(){var r;return x(this,(function(i){switch(i.label){case 0:return[4,this.hooks.before.call()];case 1:i.sent(),o=this.liff,window&&!window.liff&&(window.liff=o),i.label=2;case 2:return i.trys.push([2,9,,11]),[4,Promise.all([er(this.liff),gr(this.liff,e,this.internalHooks.beforeFinished.call)])];case 3:return i.sent(),function(){var e;Zn("color-scheme",((null==(e=Ne())?void 0:e.menuColorSetting)||{adaptableColorSchemes:["light"]}).adaptableColorSchemes.join(" "));var t=window.matchMedia("(prefers-color-scheme: dark)");Qn({matches:null==t?void 0:t.matches,media:null==t?void 0:t.media}),t.addEventListener?t.addEventListener("change",Qn):t.addListener&&t.addListener(Qn)}(),[4,this.internalHooks.beforeSuccess.call()];case 4:return i.sent(),!e.withLoginOnExternalBrowser||Qe()?[3,6]:(this.liff.login(),[4,new Promise((function(){}))]);case 5:i.sent(),i.label=6;case 6:return[4,Sr()];case 7:return i.sent(),[4,this.hooks.after.call()];case 8:return i.sent(),"function"==typeof t&&t(),A(),[3,11];case 9:return r=i.sent(),[4,this.internalHooks.error.call(r)];case 10:throw i.sent(),"function"==typeof n&&n(r),r;case 11:return[2]}var o}))}))},e}();function _r(){return"2.21.0"}var kr=n(4),Cr=n.n(kr),xr=function(){function e(){this.hooks={before:new Bn}}return Object.defineProperty(e.prototype,"name",{get:function(){return"login"},enumerable:!1,configurable:!0}),e.prototype.install=function(){return this.login.bind(this)},e.prototype.login=function(e){var t;this.hooks.before.call(e);var n,r,i=we(43),o=(n=Cr()(i),r="",n.replace(/\r|\n/g,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ").forEach((function(e){r+=String.fromCharCode(parseInt(e))})),window.btoa(r)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,""),a=Pe();if(!a||!a.liffId)throw fe(R,"You need to define `liffId` for liff.login()");var s={app_id:a.liffId,state:we(12),response_type:"code",code_challenge_method:"S256",code_challenge:o,liff_sdk_version:"2.21.0"};e&&e.redirectUri&&(s.redirect_uri=e.redirectUri),ot()&&!ke()&&((null===(t=hn())||void 0===t?void 0:t.isReady())?s.redirect_uri=window.location.href:s.disable_auto_login="true"),function(e){Le(B.LOGIN_TMP,e)}({codeVerifier:i});var u=St("authorize")+"?"+ve(s);$.debug("[Redirect] "+u),window.location.href=u},e}();function Pr(){return gt(St("profile"))}Object.create;function Ar(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(s){i={error:s}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}Object.create;var Lr=function(e){return"object"==typeof e&&null!==e&&function(e){return"string"==typeof e||e instanceof String}(e.type)};function Nr(e){return Promise.reject(fe(F,e))}var Fr=function(e){if("403"===e.code){var t="12.0.0"===Ze(),n="ios"===Ye(),r=Te();t&&(n||r)&&window.alert("LINEアプリをLINE 12.0.1以降にアップデートしてください。\nPlease update your LINE app to LINE 12.0.1 or later.")}throw e};var jr=function(){return(jr=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0)&&!(r=o.next()).done;)a.push(r.value)}catch(s){i={error:s}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}Object.create;var Ur=function(){function e(){this.modules=new Map,this.hooks={},this.internalHooks={}}return e.prototype.addModule=function(e,t){this.modules.set(e,t),t.hooks&&(this.hooks[e]=Object.entries(t.hooks).reduce((function(e,t){var n,r=Rr(t,2),i=r[0],o=r[1];return jr(jr({},e),((n={})[i]=o.on.bind(o),n))}),{})),t.internalHooks&&(this.internalHooks[e]=Object.entries(t.internalHooks).reduce((function(e,t){var n,r=Rr(t,2),i=r[0],o=r[1];return jr(jr({},e),((n={})[i]=o.on.bind(o),n))}),{}))},e.prototype.hasModule=function(e){return this.modules.has(e)},e}(),Dr=function(){function e(e,t,n){this.driver=e,this.context=t,this.option=n}return e.prototype.install=function(){return this.factory(this.driver,this.context)},Object.defineProperty(e.prototype,"name",{get:function(){return"use"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"defaultOption",{get:function(){return{namespacePrefix:"$"}},enumerable:!1,configurable:!0}),e.prototype.factory=function(e,t){var n=Object.assign({},this.defaultOption,this.option).namespacePrefix;return function(r,i){if(!r||"function"!=typeof r.install||"string"!=typeof r.name)return $.warn("To install the plugin, you need to define the `name` property and the `install` method."),this;var o=""+n+r.name;if(e.hasModule(o))return this;var a=r.install.call(r,t,i);return this[""+o]?($.warn("There is a duplicate plugin name. `"+o+"` plugin namespace will be override."),this[""+o]=a):void 0!==a&&(this[""+o]=a),e.addModule(o,r),this}},e}();var Br=function(){return(Br=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&(this.referrer=t)},e.prototype.beforeInitFinished=function(){return Mr(this,void 0,void 0,(function(){var t,n,r,i,o,a,s,u,c,l,f,d,h;return Wr(this,(function(p){switch(p.label){case 0:if(t=pe(window.location.search),this.prepareReferrer(t),n=Ne(),!(r=null==n?void 0:n.utsTracking))return[2];if("auto"!==(i=r.mode)&&"force"!==i)return[3,6];$.debug("[LIFFUTS] "+(new Date).toUTCString()),o=Pe(),a=o.liffId,s=o.analytics,p.label=1;case 1:return p.trys.push([1,3,,4]),u=this,[4,new Promise((function(e,t){var n=window.uts,r=document.createElement("script");r.type="text/javascript",r.src="https://static.line-scdn.net/uts/edge/4.1.0/uts.js",r.onload=function(){var t=window.uts;e(t),window.uts=n},r.onerror=function(e){t(e)},document.getElementsByTagName("head")[0].appendChild(r)}))];case 2:return u.uts=p.sent(),[3,4];case 3:return c=p.sent(),$.debug("[LIFFUTS] cannot load UTS, reason: "+c),[2];case 4:return l=void 0,f=void 0,"force"===i?(l={utsId:e.GENERAL_UTS_ID,appName:e.GENERAL_APP_NAME,appEnv:"release"},f={endpoint:"https://uts-front.line-apps.com",sampleRate:this.changeRatioToUTSFormat(r.sendRatio),version:"current"}):(l=Br(Br({},null==s?void 0:s.context),{utsId:(null==s?void 0:s.context.utsId)||e.GENERAL_UTS_ID,appName:(null==s?void 0:s.context.appName)||e.GENERAL_APP_NAME,appEnv:(null==s?void 0:s.context.appEnv)||"release"}),f=Br(Br({endpoint:"https://uts-front.line-apps.com"},null==s?void 0:s.options),{sampleRate:this.changeRatioToUTSFormat(r.sendRatio),version:"current"})),this.uts.init(l,f),[4,Kr()];case 5:(d=p.sent())&&($.debug("[LIFFUTS][mid] "+d),this.uts.setMid(d)),(null==n?void 0:n.tid)&&($.debug("[LIFFUTS][tid] "+n.tid),this.uts.setTid(n.tid)),this.referrer&&($.debug("liff.ref.referrer",this.referrer),this.uts.setSessionParams(this.referrer)),a&&this.setLiffId(a),this.setIsLoggedIn(Qe()),this.setVersion("2.21.0"),h=be(location.href),$.debug("[LIFFUTS][url] "+h),this.uts.setUrl(h),this.liffCore.analytics=this.uts,this.injected=!0,p.label=6;case 6:return[2]}}))}))},e.prototype.beforeInitSuccess=function(){return this.injected&&(this.setIsLiffSuccessful(!0),this.sendLiffInit()),Promise.resolve()},e.prototype.initError=function(){return this.injected&&(this.setIsLiffSuccessful(!1),this.sendLiffInit()),Promise.resolve()},e}();function Vr(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(t){o(t)}}function s(e){try{u(r.throw(e))}catch(t){o(t)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))}function Jr(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&"/"!==u[0]&&(u="/"+u);var c=new RegExp("^"+W.join("|")),l=o.substring(1).split("&").filter((function(e){return!c.test(e)&&Boolean(e)})).join("&"),f=l===s.hash.substring(1)?"":l,d=function(e){return e.substring(1).split("&").filter((function(e){return!/liff\.state/.test(e)&&Boolean(e)}))},h=d(i),p=d(s.search);e.extraParams&&h.push(e.extraParams);for(var v=0;v-1&&h.splice(w,1)}var b=h.join("&"),m=u+(""!==b?"?"+b:"")+(f?"#"+f:"");return"https://liff.line.me/"+Pe().liffId+m},this.createUrlBy=function(t){return Vr(e,void 0,void 0,(function(){var e,n;return Jr(this,(function(r){switch(r.label){case 0:if(!(e=Pe().liffId))throw fe(j,"Should run after liff init.");try{n=new URL(t)}catch(z){throw fe(F,"invalid URL.")}return[4,qr({liffId:e,currentPageUrl:n.toString()})];case 1:return[2,r.sent().permanentLinkUrl]}}))}))},this.setExtraQueryParam=function(t){e.extraParams=t},this.isAncestor=function(e,t){return 0===t.indexOf(e)&&(e.endsWith("/")&&(e=e.substring(0,e.length-1)),void 0===t[e.length]||"/"===t[e.length])},this.install=function(){return{createUrl:e.createUrl,createUrlBy:e.createUrlBy,setExtraQueryParam:e.setExtraQueryParam}}}return Object.defineProperty(e.prototype,"name",{get:function(){return"permanentLink"},enumerable:!1,configurable:!0}),e}());function $r(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(t){o(t)}}function s(e){try{u(r.throw(e))}catch(t){o(t)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))}function Xr(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function ii(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(s){i={error:s}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function oi(){for(var e=[],t=0;t0?[4,new Promise((function(e,t){(ci=new hi(e,t)).open()}))]:[3,3];case 2:return He(t.sent().newAccessToken),[3,4];case 3:throw fe("FORBIDDEN","All permissions have already been approved.");case 4:return[2]}}))}))}function vi(e,t){var n=this;return function(){for(var r=[],i=0;i0?r[r.length-1]:{}).ignorePermissionCheck,i=void 0!==n&&n,[4,ai(t)];case 1:if("unavailable"!==(o=a.sent().state))return[3,2];throw fe("FORBIDDEN","The permission is not in LIFF app scope.");case 2:return"prompt"!==o||!si()||i||!ke()&&"chat_message.write"===t?[3,4]:[4,pi()];case 3:return a.sent(),[3,5];case 4:i&&r.pop(),a.label=5;case 5:return[4,e.apply(void 0,oi(r))];case 6:return[2,a.sent()]}}))}))}}var yi=new(function(){function e(){this.name="permission"}return e.prototype.install=function(){return{query:ai,requestAll:pi}},e}());function wi(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(t){o(t)}}function s(e){try{u(r.throw(e))}catch(t){o(t)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))}function bi(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0)&&!(r=o.next()).done;)a.push(r.value)}catch(s){i={error:s}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}Object.create;var gi={};function Ii(e,t){var n=gi,r=mi(t.split("."),1)[0],i=n[t];i&&e.removeEventListener(r,i),n[t]=null}var Ei=!1,Ti=!1;function Si(e,t,n,r){if(void 0===n&&(n={}),"object"!=typeof e||!e.postMessage)throw fe(F,"target must be window object");if("string"!=typeof t)throw fe(F,"keyname must be string");if("object"!=typeof n)throw fe(F,"incorrect body format. It should be Object or Array comprised of Object");if(!r)throw fe(F,"serverEndPointUrl isn't passed. please fill up with proper url");if("*"===r)throw new Error("serverEndPointUrl doesn't allow to set '*'");var i={name:t,body:n};e.postMessage(i,r)}function Oi(e,t,n,r){!function(e,t,n,r){Ei||(Ti=function(){var e=!1;try{var n=Object.defineProperty({},"passive",{get:function(){return e=!0,!1}});window.addEventListener("test",n,n),window.removeEventListener("test",n,n)}catch(t){e=!1}return e}(),Ei=!0);var i=mi(t.split("."),1)[0];new Promise((function(o){var a=function(i){o(i),n&&n(i),r&&r.once&&Ii(e,t)};!function(e,t){gi[e]=t}(t,a),e.addEventListener(i,a,!!Ti&&r)}))}(e,"message."+t,function(e,t,n){return function(r){$.debug("messageReceive",r),r.origin===n&&r.data.name===e&&t(r)}}(t,n,r))}var _i=function(){function e(){this.payloadToShareTargetPicker=null,this.popupWindow=null,this.doesWaitForSubwindowResult=!1}return e.getInstance=function(){return e.instance?e.instance.reset():e.instance=new e,e.instance},e.prototype.init=function(e){return wi(this,void 0,void 0,(function(){var t,n;return bi(this,(function(r){switch(r.label){case 0:return r.trys.push([0,5,,6]),this.liffId=e.referrer.liffId,this.doesWaitForSubwindowResult=!(!e.options||!e.options.waitForSubwindowResult),this.allowPostMessageOrigin=this.initAllowPostMessageOrigin(),this.payloadToShareTargetPicker=this.buildPayloadToShareTargetPicker(e),window.AbortController&&(this.abortController=new window.AbortController),this.prepareAnotherWindow(),[4,this.initOtt()];case 1:return r.sent(),this.initListener(),this.openAnotherWindow(),this.doesWaitForSubwindowResult?[4,this.pollingShareResult()]:[3,3];case 2:return t=r.sent(),this.finalize(),[2,t];case 3:return[2];case 4:return[3,6];case 5:if(n=r.sent(),this.finalize(),"AbortError"!==n.name)throw n;return[3,6];case 6:return[2]}}))}))},e.prototype.resetAllVariables=function(){this.liffId="",this.allowPostMessageOrigin="",this.payloadToShareTargetPicker=null,this.ott="",this.popupWindow=null,this.timeoutIDForHealthCheck=null,this.abortController=null,this.internalError=null,this.doesWaitForSubwindowResult=!1},e.prototype.reset=function(){this.finalize(),this.resetAllVariables()},e.prototype.finalize=function(){var e,t;this.abortController&&this.abortController.abort(),ke()||(e=this.timeoutIDForHealthCheck,t=this.popupWindow,Ii(window,"message.receivedHealthcheck"),e&&clearTimeout(e),t&&!t.closed&&t.close())},e.prototype.buildPayloadToShareTargetPicker=function(e){return{messages:e.messages,isMultiple:e.isMultiple,referrer:e.referrer}},e.prototype.initAllowPostMessageOrigin=function(e){return void 0===e&&(e=St("shareTargetPicker")),function(e){var t=e.match(/^(https?:\/\/.*?)\//);return t&&t[1]||""}(e)},e.prototype.initOtt=function(){return wi(this,void 0,void 0,(function(){var e,t,n;return bi(this,(function(r){switch(r.label){case 0:return this.abortController&&(e=this.abortController.signal),t=St("shareTargetPickerOtt")+"/"+this.liffId+"/ott",n=this,[4,gt(t,{method:"GET",signal:e}).then((function(e){return e.ott}))];case 1:return n.ott=r.sent(),[2]}}))}))},e.prototype.prepareAnotherWindow=function(){ke()||("ios"!==Ye()||Te()?this.popupWindow=window.open("","liffpopup","width=480, height=640, menubar=no, toolbar=no, scrollbars=yes"):this.popupWindow=window.open())},e.prototype.openAnotherWindow=function(){if(ke()&&this.payloadToShareTargetPicker)e=this.liffId,t=this.ott,n=this.payloadToShareTargetPicker,r={liffId:e,ott:t,data:JSON.stringify(n),closeModals:!1},location.href="line://picker?"+ve(r);else{if(this.timeoutIDForHealthCheck=window.setTimeout(this.healthCheck.bind(this),1e3),!this.popupWindow)throw fe("CREATE_SUBWINDOW_FAILED");!function(e,t,n){var r={liffId:t,ott:n};e.location.href=St("shareTargetPicker")+"?"+ve(r)}(this.popupWindow,this.liffId,this.ott)}var e,t,n,r},e.prototype.initListener=function(){var e,t;ke()||(e=this.onReceivedHealthcheck.bind(this),t=this.allowPostMessageOrigin,Oi(window,"receivedHealthcheck",e,t))},e.prototype.healthCheck=function(){return wi(this,void 0,void 0,(function(){var e;return bi(this,(function(t){switch(t.label){case 0:if(this.popupWindow&&!this.popupWindow.closed)return[3,7];if(!this.doesWaitForSubwindowResult)return[3,5];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this.onCanceled()];case 2:return t.sent(),[3,4];case 3:return e=t.sent(),this.internalError=e,[3,4];case 4:return[3,6];case 5:this.finalize(),t.label=6;case 6:return[3,8];case 7:Si(this.popupWindow,"healthcheck",void 0,this.allowPostMessageOrigin),this.timeoutIDForHealthCheck=window.setTimeout(this.healthCheck.bind(this),1e3),t.label=8;case 8:return[2]}}))}))},e.prototype.onReceivedHealthcheck=function(){if(!this.popupWindow||!this.payloadToShareTargetPicker)throw fe("CREATE_SUBWINDOW_FAILED");Si(this.popupWindow,"ready",this.payloadToShareTargetPicker,this.allowPostMessageOrigin)},e.prototype.onCanceled=function(){return wi(this,void 0,void 0,(function(){var e,t;return bi(this,(function(n){switch(n.label){case 0:if(ke()||!this.ott)throw new Error("need to call with ott in client");return this.abortController&&(e=this.abortController.signal),t={liffId:this.liffId,ott:this.ott},[4,gt(St("shareTargetPickerResult")+"?"+ve(t),{method:"POST",signal:e,headers:{Accept:"application/json","Content-Type":"application/x-www-form-urlencoded"},body:"result=CANCEL"})];case 1:return[2,"ok"===n.sent().status]}}))}))},e.prototype.getShareResult=function(){return wi(this,void 0,void 0,(function(){var e,t;return bi(this,(function(n){if(!this.ott)throw new Error("need to call with ott in client");return this.abortController&&(e=this.abortController.signal),t={liffId:this.liffId,ott:this.ott},$.debug("fetch: getShareResult"),[2,gt(St("shareTargetPickerResult")+"?"+ve(t),{method:"GET",headers:{Accept:"application/json"},signal:e})]}))}))},e.isPollingTimeOut=function(e,t){return(t-e)/6e4>=10},e.prototype.pollingShareResult=function(){return wi(this,void 0,void 0,(function(){var t,n;return bi(this,(function(r){switch(r.label){case 0:t=Date.now(),r.label=1;case 1:if(e.isPollingTimeOut(t,Date.now()))return[3,4];if(this.internalError)throw this.internalError;return[4,this.getShareResult()];case 2:if((n=r.sent())&&n.result)switch(n.result){case"SUCCESS":return[2,{status:"success"}];case"CANCEL":return[2];case"FAILURE":default:throw new Error(n.resultDescription)}return[4,new Promise((function(e){setTimeout(e,500)}))];case 3:return r.sent(),[3,1];case 4:throw new Error("Timeout: not finished within 10min")}}))}))},e}(),ki=new(function(){function e(){var e=this;this.name="shareTargetPicker",this.shareTargetPicker=function(t,n){return void 0===n&&(n={}),wi(e,void 0,void 0,(function(){var e,r,i,o,a,s,u;return bi(this,(function(c){switch(c.label){case 0:if(e=void 0===n.isMultiple||n.isMultiple,this.checkPermission(),!Qe())throw fe(N,"Need access_token for api call, Please login first");if(!t||!Array.isArray(t)||0===t.length)throw fe(F,"no proper argument");if(t.length>5)throw fe(F,"exceed the limit of num of messages");if(!(r=Pe().liffId))throw fe(R);window.liff&&(i=window.liff).analytics&&function(e){$.debug("[LIFFUTS][sendCustom] liff.shareTargetPicker"),e.sendCustom({type:"liffSdk",params:{placeId:"liff.shareTargetPicker"}})}(i.analytics),c.label=1;case 1:return c.trys.push([1,3,,4]),o=_i.getInstance(),a=Ze(),s={waitForSubwindowResult:!0},ke()&&a&&te(a,"10.11.0")<0&&(s.waitForSubwindowResult=!1),[4,o.init({messages:t,isMultiple:e,referrer:{liffId:r,url:location.origin},options:s})];case 2:return[2,c.sent()];case 3:throw(u=c.sent())instanceof le?u:fe(D,u.message);case 4:return[2]}}))}))},this.checkPermission=function(){if(ot())throw fe("FORBIDDEN","The operation is not allowed in the SubWindow");var e=((Ne()||{}).availability||{}).shareTargetPicker||{},t=e.permission,n=e.minVer;if(!t)throw ke()?fe("FORBIDDEN","Need LINE App "+n+" at least or consent on shareTargetPicker usage on LINE developer site"):fe("FORBIDDEN","Need consent on shareTargetPicker usage on LINE developer site")}}return e.prototype.install=function(){return this.shareTargetPicker},e}()),Ci=Object.defineProperties({},{getOS:{value:Ye,enumerable:!0,writable:!0},getVersion:{value:_r,enumerable:!0,writable:!0},getLanguage:{value:function(){return navigator.language},enumerable:!0,writable:!0},isInClient:{value:ke,enumerable:!0,writable:!0},isLoggedIn:{value:Qe,enumerable:!0,writable:!0},logout:{value:tt,enumerable:!0,writable:!0},getAccessToken:{value:Ke,enumerable:!0,writable:!0},getIDToken:{value:We,enumerable:!0,writable:!0},getDecodedIDToken:{value:ze,enumerable:!0,writable:!0},getContext:{value:Ne,enumerable:!0,writable:!0},openWindow:{value:function(e){if(!function(e){if(!e||"object"!=typeof e)return!1;var t=e,n=t.url,r=Ar([typeof n,typeof t.external],2),i=r[0],o=r[1];return"string"===i&&""!==n&&("undefined"===o||"boolean"===o)}(e))throw fe(F,"Invalid parameters for liff.openWindow()");var t=Ze();if(ke())if(null!==t&&"ios"===Ye()&&te(t,"9.19")>=0||!window._liff.postMessage){var n=e.url,r=e.external,i=void 0!==r&&r;window.open(function(e,t){var n,r,i,o,a,s,u,c,l,f;return-1!==(f=e).indexOf("#")&&-1!==f.indexOf("?")&&f.indexOf("#")5?Nr("Number of messages should be in range 1 to 5."):gt(St("message"),{method:"POST",body:JSON.stringify({messages:e})}).catch(Fr)}),"chat_message.write"),enumerable:!0,writable:!0},subWindow:{value:Nn,enumerable:!0,writable:!0},ready:{value:L,enumerable:!0,writable:!0},id:{get:function(){return Pe().liffId||null},enumerable:!0},_dispatchEvent:{value:function(e){var t={};try{t=JSON.parse(e)}catch(r){throw fe(F,r.message)}var n=new CustomEvent("liffEvent",{detail:t});$.debug("[client dispatchEvent to js]",{type:n.type,detail:n.detail}),window.dispatchEvent(n)},enumerable:!0,writable:!0},_call:{value:qt,enumerable:!0,writable:!0},_addListener:{value:Ht,enumerable:!0,writable:!0},_removeListener:{value:Vt,enumerable:!0,writable:!0},_postMessage:{value:Jt,enumerable:!0,writable:!0}}),xi=new Ur,Pi=new Dr(xi,new function(e,t){this._driver=e,this.liff=t,this.hooks=this._driver.hooks,this.internalHooks=this._driver.internalHooks}(xi,Ci),{namespacePrefix:""}).install();[new Dr(xi,new function(e,t){this._driver=e,this.liff=t,this.hooks=this._driver.hooks}(xi,Ci)),new xr,new Or,new Hr,ei,zr,it,yi,ki,zn].forEach((function(e){Pi.call(Ci,e)}));var Ai=Ci;t.default=Ai}]).default}));