pubo-web 1.0.85 → 1.0.89

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.
Files changed (2) hide show
  1. package/dist/pubo-web.js +1 -1
  2. package/package.json +3 -3
package/dist/pubo-web.js CHANGED
@@ -1 +1 @@
1
- !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports["pubo-web"]=e():t["pubo-web"]=e()}(this,(()=>(()=>{"use strict";var t={d:(e,n)=>{for(var r in n)t.o(n,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{DragMethod:()=>b,IndexedStorage:()=>T,WebStorage:()=>u,WebsocketClient:()=>d,blob2base64:()=>i,blob2file:()=>a,blob2text:()=>o,downloadFile:()=>c,getCookie:()=>A,getCookieValue:()=>P,loadScript:()=>r,pickFiles:()=>g,setCookieItem:()=>L});var n=function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},r=function(t,e){return void 0===e&&(e={}),new Promise((function(r){var o,i,a=function(){var e,r,o=document.getElementsByTagName("script");try{for(var i=n(o),a=i.next();!a.done;a=i.next()){var c=a.value;if(c.src===t)return c}}catch(t){e={error:t}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}return null}(),c=a;if(a){if("complete"===a._state)return r(t)}else c=document.createElement("script");try{for(var s=n(Object.keys(e)),u=s.next();!u.done;u=s.next()){var l=u.value;c[l]=e[l]}}catch(t){o={error:t}}finally{try{u&&!u.done&&(i=s.return)&&i.call(s)}finally{if(o)throw o.error}}return c.src=t,c.addEventListener("load",(function e(){r(t),c.removeEventListener("load",e),c._state="complete"})),document.body.appendChild(c),"success"}))},o=function(t){return new Promise((function(e){var n=new FileReader;n.onload=function(t){return e(t.target.result)},n.readAsText(t)}))},i=function(t){return new Promise((function(e,n){var r=new FileReader;t?(r.onload=function(t){return e(t.target.result)},r.onabort=function(){return n()},r.readAsDataURL(t)):n("文件爲空!")}))},a=function(t,e,n){return new File(t,e,{type:n})},c=function(t,e){var n=document.createElement("a");n.href=t,e&&(n.download=e),n.style.position="fixed",n.style.visibility="hidden",document.body.appendChild(n),n.click(),document.body.removeChild(n)},s=function(){return s=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},s.apply(this,arguments)},u=function(){function t(t){var e=t.type,n=void 0===e?"sessionStorage":e,r=t.key;this._key=r,this.storage=window[n],this.zip=t.zip}return Object.defineProperty(t.prototype,"state",{get:function(){var t=this.storage.getItem(this._key);return this.zip&&t&&(t=this.zip.inflate(t)),t?JSON.parse(t):null},set:function(t){var e=JSON.stringify(t);this.zip&&(e=this.zip.deflate(e)),this.storage.setItem(this._key,e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"key",{get:function(){return this._key},enumerable:!1,configurable:!0}),t.prototype.merge=function(t){var e=this.state;this.state=s(s({},e),t)},t.prototype.clear=function(){this.storage.removeItem(this._key)},t}(),l=function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},f=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},h=function(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))},p=function(){function t(){this.state={},this.ids={}}return t.prototype.on=function(t,e){if(this.state[t]||(this.state[t]=[]),"function"!=typeof e)throw new Error("第二个参数必须为function!");var n=this.state[t].push(e)-1,r=function(t){void 0===t&&(t=8);var e=function(t){return Math.random().toString(32).slice(2,2+t)};if(t<=8)return e(t);for(var n="",r=0;r<=t;r+=8)n+=e(t-r>8?8:t-r);return n}(40);return this.ids[r]={event:t,index:n},r},t.prototype.cancel=function(t){var e=this;if(t){var n=this.ids[t]||{},r=n.event,o=n.index;r&&Array.isArray(this.state[r])&&(this.state[r].splice(o,1),delete this.ids[t],Object.keys(this.ids).forEach((function(t){e.ids[t].event===r&&e.ids[t].index>o&&(e.ids[t].index=e.ids[t].index-1)})))}else this.clear()},t.prototype.clear=function(){this.state.length=0},t.prototype.emit=function(t){for(var e,n,r=[],o=1;o<arguments.length;o++)r[o-1]=arguments[o];if(Array.isArray(this.state[t]))try{for(var i=l(this.state[t]),a=i.next();!a.done;a=i.next()){var c=a.value;"function"==typeof c&&c.apply(void 0,h([],f(r),!1))}}catch(t){e={error:t}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}},t}();const d=function(){function t(t){var e=t.url;this.client=null,this._status=0,this.emitter=new p,this.url=e,this.connect()}return t.prototype.reconnect=function(){var t=this;this.client&&this.client.close(),this.client=null,3===this._status&&setTimeout((function(){return t.connect()}),1e3)},t.prototype.onClose=function(){2!==this._status&&(this._status=3),this.reconnect()},t.prototype.onMessage=function(t){this.emitter.emit("message",t.data)},t.prototype.connect=function(){var t=this;this.client||(this.client=new WebSocket(this.url),this.client.onclose=this.onClose.bind(this),this.client.onmessage=this.onMessage.bind(this),this.client.onopen=function(){t._status=1})},t.prototype.close=function(){this.client&&(this.client.close(),this.client=null,this._status=2)},t.prototype.send=function(t,e){var n;void 0===e&&(e=!1);var r=t;e&&(r=JSON.stringify(t)),null===(n=this.client)||void 0===n||n.send(r)},t}();var y=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},v=function(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))},b=function(){function t(t){var e,n,r,o,i=void 0===t?{}:t,a=i.key,c=void 0===a?"":a,s=i.onMove,u=i.onMoveEnd;this.key="",this.cache={pageX:0,pageY:0,dragging:!1},this.key=c,this.onMouseDown=this._onMouseDown.bind(this),this.onMouseMove=(e=this._onMouseMove.bind(this),n=10,o=!0,function(){for(var t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];r||(r=setTimeout((function(){o=!0,r=null}),n)),o&&(o=!1,e.apply(void 0,v([],y(t),!1)))}),this.onMouseUp=this._onMouseUp.bind(this),this.onMove=s,this.onMoveEnd=u}return t.prototype._onMouseMove=function(t){"function"==typeof this.onMove&&(this.onMove({offsetX:t.pageX-this.cache.pageX,offsetY:t.pageY-this.cache.pageY,key:this.key}),this.cache.pageX=t.pageX,this.cache.pageY=t.pageY)},t.prototype.clearListener=function(){window.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("mouseup",this.onMouseUp)},t.prototype._onMouseUp=function(){this.clearListener(),this.cache.dragging=!1,"function"==typeof this.onMoveEnd&&this.onMoveEnd()},t.prototype._onMouseDown=function(t){t.preventDefault?t.preventDefault():t.returnValue=!1,"function"!=typeof this.onMove||this.cache.dragging||(this.clearListener(),this.cache.dragging=!0,this.cache.pageX=t.pageX,this.cache.pageY=t.pageY,window.addEventListener("mousemove",this.onMouseMove),window.addEventListener("mouseup",this.onMouseUp))},t}(),g=function(){return new Promise((function(t){var e=document.createElement("input");e.type="file",e.style.visibility="hidden",e.style.position="fixed",e.style.top="0px",e.style.zIndex="-1",window.addEventListener("focus",(function t(){document.body.removeChild(e),window.removeEventListener("focus",t)})),e.onchange=function(e){t(e.target.files)},document.body.appendChild(e),e.click()}))},m=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{s(r.next(t))}catch(t){i(t)}}function c(t){try{s(r.throw(t))}catch(t){i(t)}}function s(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,c)}s((r=r.apply(t,e||[])).next())}))},w=function(t,e){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(c){return function(s){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,r=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=e.call(t,a)}catch(t){c=[6,t],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,s])}}},x=function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},S=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},k=function(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))},M=function(){function t(t,e,n){this.indexedDB=self.indexedDB,this.get=this.createTransaction((function(t,e){return t.get(e)})),this.getAll=this.createTransaction((function(t){return t.getAll()})),this.delete=this.createTransaction((function(t,e){return t.delete(e)})),this.put=this.createTransaction((function(t,e){return t.put(e)})),this.name=t,this.version=e,this.tables=n}return t.prototype.open=function(){var t=this;return new Promise((function(e,n){var r,o=null===(r=t.indexedDB)||void 0===r?void 0:r.open(t.name,t.version);o.onupgradeneeded=function(n){return m(t,void 0,void 0,(function(){var t,r,o,i,a,c=this;return w(this,(function(s){this.db=n.target.result,this.transaction=n.target.transaction,this.transaction.oncomplete=function(){return m(c,void 0,void 0,(function(){var t,e,n,r,o,i;return w(this,(function(a){switch(a.label){case 0:this.transaction=null,a.label=1;case 1:a.trys.push([1,6,7,8]),t=x(this.tables),e=t.next(),a.label=2;case 2:return e.done?[3,5]:(n=e.value).default?[4,this.put(n.name,n.default)]:[3,4];case 3:a.sent(),a.label=4;case 4:return e=t.next(),[3,2];case 5:return[3,8];case 6:return r=a.sent(),o={error:r},[3,8];case 7:try{e&&!e.done&&(i=t.return)&&i.call(t)}finally{if(o)throw o.error}return[7];case 8:return[2]}}))}))};try{for(t=x(this.tables),r=t.next();!r.done;r=t.next())o=r.value,this.createTable(o)}catch(t){i={error:t}}finally{try{r&&!r.done&&(a=t.return)&&a.call(t)}finally{if(i)throw i.error}}return e("success"),[2]}))}))},o.onsuccess=function(){t.db=o.result,e("success")},o.onerror=function(t){console.error("indexed db connect error: ",t),n(t)}}))},t.prototype.createTable=function(t){this.db.objectStoreNames.contains(t.name)||this.db.createObjectStore(t.name,t.options||{keyPath:"_id",autoIncrement:!0})},t.prototype.createTransaction=function(t){var e=this;return function(n){for(var r=[],o=1;o<arguments.length;o++)r[o-1]=arguments[o];return new Promise((function(o,i){if(e.db){var a=e.db.transaction([n],"readwrite").objectStore(n),c=t.apply(void 0,k([a],S(r),!1));c.onerror=function(t){i(t)},c.onsuccess=function(){o(c.result)}}else i("not connect")}))}},t}(),_=function(){return _=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},_.apply(this,arguments)},E=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{s(r.next(t))}catch(t){i(t)}}function c(t){try{s(r.throw(t))}catch(t){i(t)}}function s(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,c)}s((r=r.apply(t,e||[])).next())}))},O=function(t,e){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(c){return function(s){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,r=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=e.call(t,a)}catch(t){c=[6,t],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,s])}}},j=function(){function t(t,e){this.utils=t,this.store=e}return t.prototype.getState=function(){return E(this,void 0,void 0,(function(){return O(this,(function(t){return[2,this.utils.get(this.store,1)]}))}))},t.prototype.setState=function(t){this.utils.put(this.store,_(_({},t),{_id:1}))},t.prototype.merge=function(t){return E(this,void 0,void 0,(function(){var e;return O(this,(function(n){switch(n.label){case 0:return[4,this.getState()];case 1:return e=n.sent(),this.setState=_(_(_({},e),t),{_id:1}),[2]}}))}))},t}(),T=function(){function t(t){var e=t.name,n=t.version,r=t.tables;this._cache={},this.tables=[],this.connected=!1,this.connecting=!1,this.name=e,this.version=n,this.tables=null!=r?r:[]}return t.prototype.register=function(t){var e;(e=this.tables).push.apply(e,function(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))}([],function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a}(t),!1))},t.prototype.connect=function(){return E(this,void 0,void 0,(function(){return O(this,(function(t){switch(t.label){case 0:if(this.connected)return[2];if(!this.connecting)return[3,4];t.label=1;case 1:return this.connecting?[3,3]:[4,(100,e=void 0,n=void 0,r=void 0,o=function(){return function(t,e){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(c){return function(s){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,r=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=e.call(t,a)}catch(t){c=[6,t],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,s])}}}(this,(function(t){switch(t.label){case 0:return[4,new Promise((function(t){return setTimeout((function(){return t()}),100)}))];case 1:return t.sent(),[2]}}))},new(r||(r=Promise))((function(t,i){function a(t){try{s(o.next(t))}catch(t){i(t)}}function c(t){try{s(o.throw(t))}catch(t){i(t)}}function s(e){var n;e.done?t(e.value):(n=e.value,n instanceof r?n:new r((function(t){t(n)}))).then(a,c)}s((o=o.apply(e,n||[])).next())})))];case 2:return t.sent(),[3,1];case 3:return[2];case 4:return this.connecting=!0,this.utils=new M(this.name,this.version,this.tables),[4,this.utils.open()];case 5:return t.sent(),this.connected=!0,this.connecting=!1,[2]}var e,n,r,o}))}))},t.prototype.get=function(t){return!this._cache[t]&&this.utils&&(this._cache[t]=new j(this.utils,t)),this._cache[t]},t}(),P=function(t){var e=new RegExp("(^| )".concat(t,"=([^;]*)(;|$)")).exec(document.cookie);return e?e[2]:""},A=function(){var t={};return document.cookie?(document.cookie.split(";").forEach((function(e){var n=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a}(e.split("="),2),r=n[0],o=n[1];t[r]=o})),t):t},L=function(t,e){document.cookie="".concat(t,"=").concat(e)};return e})()));
1
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports["pubo-web"]=e():t["pubo-web"]=e()}(this,(()=>(()=>{"use strict";var t={d:(e,n)=>{for(var r in n)t.o(n,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{DragMethod:()=>g,IndexedStorage:()=>T,WebStorage:()=>u,WebsocketClient:()=>y,blob2base64:()=>i,blob2file:()=>a,blob2text:()=>o,downloadFile:()=>c,getCookie:()=>L,getCookieValue:()=>A,loadScript:()=>r,pickFiles:()=>m,setCookieItem:()=>C});var n=function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},r=function(t,e){return void 0===e&&(e={}),new Promise((function(r){var o,i,a=function(){var e,r,o=document.getElementsByTagName("script");try{for(var i=n(o),a=i.next();!a.done;a=i.next()){var c=a.value;if(c.src===t)return c}}catch(t){e={error:t}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}return null}(),c=a;if(a){if("complete"===a._state)return r(t)}else c=document.createElement("script");try{for(var s=n(Object.keys(e)),u=s.next();!u.done;u=s.next()){var l=u.value;c[l]=e[l]}}catch(t){o={error:t}}finally{try{u&&!u.done&&(i=s.return)&&i.call(s)}finally{if(o)throw o.error}}return c.src=t,c.addEventListener("load",(function e(){r(t),c.removeEventListener("load",e),c._state="complete"})),document.body.appendChild(c),"success"}))},o=function(t){return new Promise((function(e){var n=new FileReader;n.onload=function(t){return e(t.target.result)},n.readAsText(t)}))},i=function(t){return new Promise((function(e,n){var r=new FileReader;t?(r.onload=function(t){return e(t.target.result)},r.onabort=function(){return n()},r.readAsDataURL(t)):n("文件爲空!")}))},a=function(t,e,n){return new File(t,e,{type:n})},c=function(t,e){var n=document.createElement("a");n.href=t,e&&(n.download=e),n.style.position="fixed",n.style.visibility="hidden",document.body.appendChild(n),n.click(),document.body.removeChild(n)},s=function(){return s=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},s.apply(this,arguments)},u=function(){function t(t){var e=t.type,n=void 0===e?"sessionStorage":e,r=t.key;this._key=r,this.storage=window[n],this.zip=t.zip}return Object.defineProperty(t.prototype,"state",{get:function(){var t=this.storage.getItem(this._key);return this.zip&&t&&(t=this.zip.inflate(t)),t?JSON.parse(t):null},set:function(t){var e=JSON.stringify(t);this.zip&&(e=this.zip.deflate(e)),this.storage.setItem(this._key,e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"key",{get:function(){return this._key},enumerable:!1,configurable:!0}),t.prototype.merge=function(t){var e=this.state;this.state=s(s({},e),t)},t.prototype.clear=function(){this.storage.removeItem(this._key)},t}(),l=function(){return l=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},l.apply(this,arguments)},f=function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},h=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},p=function(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))},d=function(){function t(){this.state={},this.ids={}}return t.prototype.on=function(t,e){if(this.state[t]||(this.state[t]=[]),"function"!=typeof e)throw new Error("第二个参数必须为function!");var n=this.state[t].push(e)-1,r=function(t){void 0===t&&(t=8);var e=function(t){return Math.random().toString(32).slice(2,2+t)};if(t<=8)return e(t);for(var n="",r=0;r<=t;r+=8)n+=e(t-r>8?8:t-r);return n}(40);return this.ids[r]={event:t,index:n},r},t.prototype.cancel=function(t){var e=this;if(t){var n=this.ids[t]||{},r=n.event,o=n.index;r&&Array.isArray(this.state[r])&&(this.state[r].splice(o,1),delete this.ids[t],Object.keys(this.ids).forEach((function(t){e.ids[t].event===r&&e.ids[t].index>o&&(e.ids[t].index=e.ids[t].index-1)})))}else this.clear()},t.prototype.clear=function(){this.state.length=0},t.prototype.emit=function(t){for(var e,n,r=[],o=1;o<arguments.length;o++)r[o-1]=arguments[o];if(Array.isArray(this.state[t]))try{for(var i=f(this.state[t]),a=i.next();!a.done;a=i.next()){var c=a.value;"function"==typeof c&&c.apply(void 0,p([],h(r),!1))}}catch(t){e={error:t}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}},t.prototype.clone=function(){return{state:l({},this.state),ids:l({},this.ids)}},t.prototype.restore=function(t){this.state=t.state,this.ids=t.ids},t}();const y=function(){function t(t){var e=t.url;this.client=null,this._status=0,this.emitter=new d,this.url=e,this.connect()}return t.prototype.reconnect=function(){var t=this;this.client&&this.client.close(),this.client=null,3===this._status&&setTimeout((function(){return t.connect()}),1e3)},t.prototype.onClose=function(){2!==this._status&&(this._status=3),this.reconnect()},t.prototype.onMessage=function(t){this.emitter.emit("message",t.data)},t.prototype.connect=function(){var t=this;this.client||(this.client=new WebSocket(this.url),this.client.onclose=this.onClose.bind(this),this.client.onmessage=this.onMessage.bind(this),this.client.onopen=function(){t._status=1})},t.prototype.close=function(){this.client&&(this.client.close(),this.client=null,this._status=2)},t.prototype.send=function(t,e){var n;void 0===e&&(e=!1);var r=t;e&&(r=JSON.stringify(t)),null===(n=this.client)||void 0===n||n.send(r)},t}();var v=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},b=function(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))},g=function(){function t(t){var e,n,r,o,i=void 0===t?{}:t,a=i.key,c=void 0===a?"":a,s=i.onMove,u=i.onMoveEnd;this.key="",this.cache={pageX:0,pageY:0,dragging:!1},this.key=c,this.onMouseDown=this._onMouseDown.bind(this),this.onMouseMove=(e=this._onMouseMove.bind(this),n=10,o=!0,function(){for(var t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];r||(r=setTimeout((function(){o=!0,r=null}),n)),o&&(o=!1,e.apply(void 0,b([],v(t),!1)))}),this.onMouseUp=this._onMouseUp.bind(this),this.onMove=s,this.onMoveEnd=u}return t.prototype._onMouseMove=function(t){"function"==typeof this.onMove&&(this.onMove({offsetX:t.pageX-this.cache.pageX,offsetY:t.pageY-this.cache.pageY,key:this.key}),this.cache.pageX=t.pageX,this.cache.pageY=t.pageY)},t.prototype.clearListener=function(){window.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("mouseup",this.onMouseUp)},t.prototype._onMouseUp=function(){this.clearListener(),this.cache.dragging=!1,"function"==typeof this.onMoveEnd&&this.onMoveEnd()},t.prototype._onMouseDown=function(t){t.preventDefault?t.preventDefault():t.returnValue=!1,"function"!=typeof this.onMove||this.cache.dragging||(this.clearListener(),this.cache.dragging=!0,this.cache.pageX=t.pageX,this.cache.pageY=t.pageY,window.addEventListener("mousemove",this.onMouseMove),window.addEventListener("mouseup",this.onMouseUp))},t}(),m=function(){return new Promise((function(t){var e=document.createElement("input");e.type="file",e.style.visibility="hidden",e.style.position="fixed",e.style.top="0px",e.style.zIndex="-1",window.addEventListener("focus",(function t(){document.body.removeChild(e),window.removeEventListener("focus",t)})),e.onchange=function(e){t(e.target.files)},document.body.appendChild(e),e.click()}))},w=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{s(r.next(t))}catch(t){i(t)}}function c(t){try{s(r.throw(t))}catch(t){i(t)}}function s(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,c)}s((r=r.apply(t,e||[])).next())}))},x=function(t,e){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(c){return function(s){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,r=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=e.call(t,a)}catch(t){c=[6,t],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,s])}}},S=function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},k=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},M=function(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))},_=function(){function t(t,e,n){this.indexedDB=self.indexedDB,this.get=this.createTransaction((function(t,e){return t.get(e)})),this.getAll=this.createTransaction((function(t){return t.getAll()})),this.delete=this.createTransaction((function(t,e){return t.delete(e)})),this.put=this.createTransaction((function(t,e){return t.put(e)})),this.name=t,this.version=e,this.tables=n}return t.prototype.open=function(){var t=this;return new Promise((function(e,n){var r,o=null===(r=t.indexedDB)||void 0===r?void 0:r.open(t.name,t.version);o.onupgradeneeded=function(n){return w(t,void 0,void 0,(function(){var t,r,o,i,a,c=this;return x(this,(function(s){this.db=n.target.result,this.transaction=n.target.transaction,this.transaction.oncomplete=function(){return w(c,void 0,void 0,(function(){var t,e,n,r,o,i;return x(this,(function(a){switch(a.label){case 0:this.transaction=null,a.label=1;case 1:a.trys.push([1,6,7,8]),t=S(this.tables),e=t.next(),a.label=2;case 2:return e.done?[3,5]:(n=e.value).default?[4,this.put(n.name,n.default)]:[3,4];case 3:a.sent(),a.label=4;case 4:return e=t.next(),[3,2];case 5:return[3,8];case 6:return r=a.sent(),o={error:r},[3,8];case 7:try{e&&!e.done&&(i=t.return)&&i.call(t)}finally{if(o)throw o.error}return[7];case 8:return[2]}}))}))};try{for(t=S(this.tables),r=t.next();!r.done;r=t.next())o=r.value,this.createTable(o)}catch(t){i={error:t}}finally{try{r&&!r.done&&(a=t.return)&&a.call(t)}finally{if(i)throw i.error}}return e("success"),[2]}))}))},o.onsuccess=function(){t.db=o.result,e("success")},o.onerror=function(t){console.error("indexed db connect error: ",t),n(t)}}))},t.prototype.createTable=function(t){this.db.objectStoreNames.contains(t.name)||this.db.createObjectStore(t.name,t.options||{keyPath:"_id",autoIncrement:!0})},t.prototype.createTransaction=function(t){var e=this;return function(n){for(var r=[],o=1;o<arguments.length;o++)r[o-1]=arguments[o];return new Promise((function(o,i){if(e.db){var a=e.db.transaction([n],"readwrite").objectStore(n),c=t.apply(void 0,M([a],k(r),!1));c.onerror=function(t){i(t)},c.onsuccess=function(){o(c.result)}}else i("not connect")}))}},t}(),E=function(){return E=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},E.apply(this,arguments)},O=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{s(r.next(t))}catch(t){i(t)}}function c(t){try{s(r.throw(t))}catch(t){i(t)}}function s(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,c)}s((r=r.apply(t,e||[])).next())}))},j=function(t,e){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(c){return function(s){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,r=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=e.call(t,a)}catch(t){c=[6,t],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,s])}}},P=function(){function t(t,e){this.utils=t,this.store=e}return t.prototype.getState=function(){return O(this,void 0,void 0,(function(){return j(this,(function(t){return[2,this.utils.get(this.store,1)]}))}))},t.prototype.setState=function(t){this.utils.put(this.store,E(E({},t),{_id:1}))},t.prototype.merge=function(t){return O(this,void 0,void 0,(function(){var e;return j(this,(function(n){switch(n.label){case 0:return[4,this.getState()];case 1:return e=n.sent(),this.setState=E(E(E({},e),t),{_id:1}),[2]}}))}))},t}(),T=function(){function t(t){var e=t.name,n=t.version,r=t.tables;this._cache={},this.tables=[],this.connected=!1,this.connecting=!1,this.name=e,this.version=n,this.tables=null!=r?r:[]}return t.prototype.register=function(t){var e;(e=this.tables).push.apply(e,function(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))}([],function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a}(t),!1))},t.prototype.connect=function(){return O(this,void 0,void 0,(function(){return j(this,(function(t){switch(t.label){case 0:if(this.connected)return[2];if(!this.connecting)return[3,4];t.label=1;case 1:return this.connecting?[3,3]:[4,(100,e=void 0,n=void 0,r=void 0,o=function(){return function(t,e){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(c){return function(s){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,r=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=e.call(t,a)}catch(t){c=[6,t],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,s])}}}(this,(function(t){switch(t.label){case 0:return[4,new Promise((function(t){return setTimeout((function(){return t()}),100)}))];case 1:return t.sent(),[2]}}))},new(r||(r=Promise))((function(t,i){function a(t){try{s(o.next(t))}catch(t){i(t)}}function c(t){try{s(o.throw(t))}catch(t){i(t)}}function s(e){var n;e.done?t(e.value):(n=e.value,n instanceof r?n:new r((function(t){t(n)}))).then(a,c)}s((o=o.apply(e,n||[])).next())})))];case 2:return t.sent(),[3,1];case 3:return[2];case 4:return this.connecting=!0,this.utils=new _(this.name,this.version,this.tables),[4,this.utils.open()];case 5:return t.sent(),this.connected=!0,this.connecting=!1,[2]}var e,n,r,o}))}))},t.prototype.get=function(t){return!this._cache[t]&&this.utils&&(this._cache[t]=new P(this.utils,t)),this._cache[t]},t}(),A=function(t){var e=new RegExp("(^| )".concat(t,"=([^;]*)(;|$)")).exec(document.cookie);return e?e[2]:""},L=function(){var t={};return document.cookie?(document.cookie.split(";").forEach((function(e){var n=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a}(e.split("="),2),r=n[0],o=n[1];t[r]=o})),t):t},C=function(t,e){document.cookie="".concat(t,"=").concat(e)};return e})()));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pubo-web",
3
- "version": "1.0.85",
3
+ "version": "1.0.89",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -19,7 +19,7 @@
19
19
  "node": ">=8.0.0"
20
20
  },
21
21
  "dependencies": {
22
- "pubo-utils": "^1.0.85"
22
+ "pubo-utils": "^1.0.89"
23
23
  },
24
- "gitHead": "285a872798f8841f283dfc502ec10f8de6abf9e2"
24
+ "gitHead": "c4c41946c214c2f3411f8221a8e6f28055c14c6b"
25
25
  }