@copio/sdk 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +661 -0
- package/LICENSE-COMMERCIAL.md +43 -0
- package/README.md +6 -1
- package/THIRD_PARTY_NOTICES.md +416 -0
- package/dist/adapters/image/canvas2d-adapter.js +1 -1
- package/dist/adapters/image/index.js +1 -1
- package/dist/adapters/image/null-image-processor-adapter.js +1 -1
- package/dist/adapters/index.js +1 -1
- package/dist/adapters/indexeddb-adapter.js +1 -1
- package/dist/adapters/memory-adapter.js +1 -1
- package/dist/adapters/ocr/index.js +1 -1
- package/dist/adapters/ocr/null-ocr-adapter.js +1 -1
- package/dist/adapters/ocr/tesseract-wasm-adapter.js +1 -1
- package/dist/adapters/pdf/index.js +1 -1
- package/dist/adapters/pdf/null-pdf-adapter.js +1 -1
- package/dist/adapters/pdf/pdfkit-adapter.js +1 -1
- package/dist/adapters/storage/index.js +1 -1
- package/dist/adapters/storage/indexeddb-adapter.js +1 -1
- package/dist/adapters/storage/memory-adapter.js +1 -1
- package/dist/adapters/sync/index.js +1 -1
- package/dist/adapters/sync/null-sync-adapter.js +1 -1
- package/dist/adapters/sync/peerjs-adapter.js +1 -1
- package/dist/cdn.js +106 -249
- package/dist/{chunk-A5G52Q2W.js → chunk-2AB5L3Y2.js} +2 -2
- package/dist/{chunk-DGGK5KEX.js → chunk-4ICUYKSR.js} +2 -2
- package/dist/{chunk-IZOWC74B.js → chunk-4XWSVHFW.js} +69 -198
- package/dist/{chunk-IUBYFIV6.js → chunk-4YYY7PHH.js} +2 -2
- package/dist/{chunk-N7Q34F2P.js → chunk-534NMCRQ.js} +4 -4
- package/dist/{chunk-UCV3MQ6I.js → chunk-5KUKBKWL.js} +1 -1
- package/dist/{chunk-E7JYVRJA.js → chunk-5OTO5WFV.js} +2 -2
- package/dist/{chunk-N4R55VRR.js → chunk-6DSLE3AY.js} +1 -1
- package/dist/chunk-DIU5BGU5.js +2 -0
- package/dist/chunk-DOKG4LX2.js +2 -0
- package/dist/{chunk-B2EK6INF.js → chunk-DY5ZSP4Q.js} +2 -2
- package/dist/chunk-FAVTIE3M.js +8 -0
- package/dist/chunk-FQRADJY6.js +2 -0
- package/dist/chunk-IH2AI54D.js +2 -0
- package/dist/{chunk-PVNRK4OH.js → chunk-J7HWZNIP.js} +2 -2
- package/dist/{chunk-SH4P4XSZ.js → chunk-KH5JE65X.js} +2 -2
- package/dist/chunk-MEE2NNYB.js +2 -0
- package/dist/{chunk-KIMVF5UG.js → chunk-NEEWG3OP.js} +1 -1
- package/dist/{chunk-YHLOPPXM.js → chunk-O6FQFVKY.js} +1 -1
- package/dist/chunk-RDCHJL6F.js +2 -0
- package/dist/{chunk-B7HT2X67.js → chunk-U3V3VZGO.js} +2 -2
- package/dist/{chunk-HN3336JN.js → chunk-ULTSZWZO.js} +1 -1
- package/dist/{chunk-BKZEOOH4.js → chunk-WETG2JD7.js} +2 -2
- package/dist/{chunk-V2FP4EEH.js → chunk-YNY65JUJ.js} +1 -1
- package/dist/chunk-ZT72PD2C.js +2 -0
- package/dist/core.js +1 -1
- package/dist/custom-elements.json +264 -102
- package/dist/export.js +1 -1
- package/dist/index.js +11 -19
- package/dist/ocr.js +1 -1
- package/dist/scanner.js +88 -217
- package/dist/sync.js +1 -1
- package/dist/types/js/adapters/storage/blob-store.d.ts +48 -0
- package/dist/types/js/adapters/storage/index.d.ts +11 -4
- package/dist/types/js/adapters/storage/indexeddb-adapter.d.ts +46 -9
- package/dist/types/js/adapters/storage/memory-adapter.d.ts +7 -0
- package/dist/types/js/adapters/storage/opfs-adapter.d.ts +160 -0
- package/dist/types/js/adapters/storage/storage-port.d.ts +7 -0
- package/dist/types/js/components/copio-header.d.ts +4 -0
- package/dist/types/js/routes/doc/copio-carousel.d.ts +1 -2
- package/dist/types/js/routes/doc/copio-images.d.ts +0 -4
- package/dist/types/js/routes/home/copio-row.d.ts +2 -2
- package/dist/types/js/routes/ocr/copio-doc-ocr-dialog.d.ts +0 -2
- package/dist/types/js/services/doc-repository.d.ts +1 -0
- package/dist/types/js/services/export-utils.d.ts +8 -12
- package/dist/types/js/services/ocr-service.d.ts +2 -1
- package/dist/types/js/utils/module-loader.d.ts +0 -6
- package/dist/types/js/utils/utils.d.ts +5 -3
- package/dist/types/sdk/core.d.ts +13 -2
- package/dist/types/sdk/events.d.ts +4 -4
- package/dist/types/sdk/index.d.ts +3 -3
- package/dist/types/sdk/models.d.ts +66 -0
- package/dist/types/sdk/styles.d.ts +1 -1
- package/dist/types/sdk/version.d.ts +1 -1
- package/package.json +4 -3
- package/sdk/cdn.js +1 -0
- package/sdk/core.js +60 -0
- package/sdk/events.js +3 -2
- package/sdk/index.js +4 -3
- package/sdk/license.js +1 -0
- package/sdk/models.js +79 -3
- package/sdk/scanner.js +45 -7
- package/sdk/styles.js +12 -5
- package/sdk/sync.js +1 -0
- package/sdk/version.js +2 -1
- package/dist/chunk-36F637QU.js +0 -2
- package/dist/chunk-4JPEWIT4.js +0 -2
- package/dist/chunk-B5BEYYR2.js +0 -8
- package/dist/chunk-G65H4ZTJ.js +0 -2
- package/dist/chunk-HS6GDZIS.js +0 -2
- package/dist/chunk-K6YP7EET.js +0 -8
- package/dist/chunk-LI54F6PA.js +0 -2
- package/dist/chunk-OI4WCW7E.js +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as R,k as Bt,q as nt}from"./chunk-HS6GDZIS.js";import{a as re,b as O,c as K}from"./chunk-XEN5VKAV.js";import{a as It,b as ce,c as Tt,h as ue,i as Pt,j as Mt,k as at}from"./chunk-N7Q34F2P.js";import{a as Nt}from"./chunk-IUBYFIV6.js";import{a as Ce,b as st,d as Y}from"./chunk-V2FP4EEH.js";import{b as _t,e as Rt,h as Ot}from"./chunk-G65H4ZTJ.js";function zt(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(i);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,o)}return t}function Z(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?zt(Object(t),!0).forEach(function(o){uo(i,o,t[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):zt(Object(t)).forEach(function(o){Object.defineProperty(i,o,Object.getOwnPropertyDescriptor(t,o))})}return i}function He(i){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?He=function(e){return typeof e}:He=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},He(i)}function uo(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function ee(){return ee=Object.assign||function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(i[o]=t[o])}return i},ee.apply(this,arguments)}function fo(i,e){if(i==null)return{};var t={},o=Object.keys(i),r,a;for(a=0;a<o.length;a++)r=o[a],!(e.indexOf(r)>=0)&&(t[r]=i[r]);return t}function go(i,e){if(i==null)return{};var t=fo(i,e),o,r;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(i);for(r=0;r<a.length;r++)o=a[r],!(e.indexOf(o)>=0)&&Object.prototype.propertyIsEnumerable.call(i,o)&&(t[o]=i[o])}return t}var mo="1.15.6";function J(i){if(typeof window<"u"&&window.navigator)return!!navigator.userAgent.match(i)}var te=J(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),Oe=J(/Edge/i),Lt=J(/firefox/i),Te=J(/safari/i)&&!J(/chrome/i)&&!J(/android/i),wt=J(/iP(ad|od|hone)/i),Xt=J(/chrome/i)&&J(/android/i),Gt={capture:!1,passive:!1};function E(i,e,t){i.addEventListener(e,t,!te&&Gt)}function w(i,e,t){i.removeEventListener(e,t,!te&&Gt)}function Ge(i,e){if(e){if(e[0]===">"&&(e=e.substring(1)),i)try{if(i.matches)return i.matches(e);if(i.msMatchesSelector)return i.msMatchesSelector(e);if(i.webkitMatchesSelector)return i.webkitMatchesSelector(e)}catch{return!1}return!1}}function Yt(i){return i.host&&i!==document&&i.host.nodeType?i.host:i.parentNode}function G(i,e,t,o){if(i){t=t||document;do{if(e!=null&&(e[0]===">"?i.parentNode===t&&Ge(i,e):Ge(i,e))||o&&i===t)return i;if(i===t)break}while(i=Yt(i))}return null}var Ft=/\s+/g;function q(i,e,t){if(i&&e)if(i.classList)i.classList[t?"add":"remove"](e);else{var o=(" "+i.className+" ").replace(Ft," ").replace(" "+e+" "," ");i.className=(o+(t?" "+e:"")).replace(Ft," ")}}function m(i,e,t){var o=i&&i.style;if(o){if(t===void 0)return document.defaultView&&document.defaultView.getComputedStyle?t=document.defaultView.getComputedStyle(i,""):i.currentStyle&&(t=i.currentStyle),e===void 0?t:t[e];!(e in o)&&e.indexOf("webkit")===-1&&(e="-webkit-"+e),o[e]=t+(typeof t=="string"?"":"px")}}function ve(i,e){var t="";if(typeof i=="string")t=i;else do{var o=m(i,"transform");o&&o!=="none"&&(t=o+" "+t)}while(!e&&(i=i.parentNode));var r=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return r&&new r(t)}function Kt(i,e,t){if(i){var o=i.getElementsByTagName(e),r=0,a=o.length;if(t)for(;r<a;r++)t(o[r],r);return o}return[]}function V(){var i=document.scrollingElement;return i||document.documentElement}function _(i,e,t,o,r){if(!(!i.getBoundingClientRect&&i!==window)){var a,n,s,l,c,p,d;if(i!==window&&i.parentNode&&i!==V()?(a=i.getBoundingClientRect(),n=a.top,s=a.left,l=a.bottom,c=a.right,p=a.height,d=a.width):(n=0,s=0,l=window.innerHeight,c=window.innerWidth,p=window.innerHeight,d=window.innerWidth),(e||t)&&i!==window&&(r=r||i.parentNode,!te))do if(r&&r.getBoundingClientRect&&(m(r,"transform")!=="none"||t&&m(r,"position")!=="static")){var u=r.getBoundingClientRect();n-=u.top+parseInt(m(r,"border-top-width")),s-=u.left+parseInt(m(r,"border-left-width")),l=n+a.height,c=s+a.width;break}while(r=r.parentNode);if(o&&i!==window){var v=ve(r||i),f=v&&v.a,y=v&&v.d;v&&(n/=y,s/=f,d/=f,p/=y,l=n+p,c=s+d)}return{top:n,left:s,bottom:l,right:c,width:d,height:p}}}function $t(i,e,t){for(var o=se(i,!0),r=_(i)[e];o;){var a=_(o)[t],n=void 0;if(t==="top"||t==="left"?n=r>=a:n=r<=a,!n)return o;if(o===V())break;o=se(o,!1)}return!1}function xe(i,e,t,o){for(var r=0,a=0,n=i.children;a<n.length;){if(n[a].style.display!=="none"&&n[a]!==b.ghost&&(o||n[a]!==b.dragged)&&G(n[a],t.draggable,i,!1)){if(r===e)return n[a];r++}a++}return null}function Et(i,e){for(var t=i.lastElementChild;t&&(t===b.ghost||m(t,"display")==="none"||e&&!Ge(t,e));)t=t.previousElementSibling;return t||null}function U(i,e){var t=0;if(!i||!i.parentNode)return-1;for(;i=i.previousElementSibling;)i.nodeName.toUpperCase()!=="TEMPLATE"&&i!==b.clone&&(!e||Ge(i,e))&&t++;return t}function jt(i){var e=0,t=0,o=V();if(i)do{var r=ve(i),a=r.a,n=r.d;e+=i.scrollLeft*a,t+=i.scrollTop*n}while(i!==o&&(i=i.parentNode));return[e,t]}function bo(i,e){for(var t in i)if(i.hasOwnProperty(t)){for(var o in e)if(e.hasOwnProperty(o)&&e[o]===i[t][o])return Number(t)}return-1}function se(i,e){if(!i||!i.getBoundingClientRect)return V();var t=i,o=!1;do if(t.clientWidth<t.scrollWidth||t.clientHeight<t.scrollHeight){var r=m(t);if(t.clientWidth<t.scrollWidth&&(r.overflowX=="auto"||r.overflowX=="scroll")||t.clientHeight<t.scrollHeight&&(r.overflowY=="auto"||r.overflowY=="scroll")){if(!t.getBoundingClientRect||t===document.body)return V();if(o||e)return t;o=!0}}while(t=t.parentNode);return V()}function vo(i,e){if(i&&e)for(var t in e)e.hasOwnProperty(t)&&(i[t]=e[t]);return i}function lt(i,e){return Math.round(i.top)===Math.round(e.top)&&Math.round(i.left)===Math.round(e.left)&&Math.round(i.height)===Math.round(e.height)&&Math.round(i.width)===Math.round(e.width)}var Pe;function Vt(i,e){return function(){if(!Pe){var t=arguments,o=this;t.length===1?i.call(o,t[0]):i.apply(o,t),Pe=setTimeout(function(){Pe=void 0},e)}}}function xo(){clearTimeout(Pe),Pe=void 0}function Zt(i,e,t){i.scrollLeft+=e,i.scrollTop+=t}function Qt(i){var e=window.Polymer,t=window.jQuery||window.Zepto;return e&&e.dom?e.dom(i).cloneNode(!0):t?t(i).clone(!0)[0]:i.cloneNode(!0)}function Jt(i,e,t){var o={};return Array.from(i.children).forEach(function(r){var a,n,s,l;if(!(!G(r,e.draggable,i,!1)||r.animated||r===t)){var c=_(r);o.left=Math.min((a=o.left)!==null&&a!==void 0?a:1/0,c.left),o.top=Math.min((n=o.top)!==null&&n!==void 0?n:1/0,c.top),o.right=Math.max((s=o.right)!==null&&s!==void 0?s:-1/0,c.right),o.bottom=Math.max((l=o.bottom)!==null&&l!==void 0?l:-1/0,c.bottom)}}),o.width=o.right-o.left,o.height=o.bottom-o.top,o.x=o.left,o.y=o.top,o}var j="Sortable"+new Date().getTime();function yo(){var i=[],e;return{captureAnimationState:function(){if(i=[],!!this.options.animation){var o=[].slice.call(this.el.children);o.forEach(function(r){if(!(m(r,"display")==="none"||r===b.ghost)){i.push({target:r,rect:_(r)});var a=Z({},i[i.length-1].rect);if(r.thisAnimationDuration){var n=ve(r,!0);n&&(a.top-=n.f,a.left-=n.e)}r.fromRect=a}})}},addAnimationState:function(o){i.push(o)},removeAnimationState:function(o){i.splice(bo(i,{target:o}),1)},animateAll:function(o){var r=this;if(!this.options.animation){clearTimeout(e),typeof o=="function"&&o();return}var a=!1,n=0;i.forEach(function(s){var l=0,c=s.target,p=c.fromRect,d=_(c),u=c.prevFromRect,v=c.prevToRect,f=s.rect,y=ve(c,!0);y&&(d.top-=y.f,d.left-=y.e),c.toRect=d,c.thisAnimationDuration&<(u,d)&&!lt(p,d)&&(f.top-d.top)/(f.left-d.left)===(p.top-d.top)/(p.left-d.left)&&(l=Eo(f,u,v,r.options)),lt(d,p)||(c.prevFromRect=p,c.prevToRect=d,l||(l=r.options.animation),r.animate(c,f,d,l)),l&&(a=!0,n=Math.max(n,l),clearTimeout(c.animationResetTimer),c.animationResetTimer=setTimeout(function(){c.animationTime=0,c.prevFromRect=null,c.fromRect=null,c.prevToRect=null,c.thisAnimationDuration=null},l),c.thisAnimationDuration=l)}),clearTimeout(e),a?e=setTimeout(function(){typeof o=="function"&&o()},n):typeof o=="function"&&o(),i=[]},animate:function(o,r,a,n){if(n){m(o,"transition",""),m(o,"transform","");var s=ve(this.el),l=s&&s.a,c=s&&s.d,p=(r.left-a.left)/(l||1),d=(r.top-a.top)/(c||1);o.animatingX=!!p,o.animatingY=!!d,m(o,"transform","translate3d("+p+"px,"+d+"px,0)"),this.forRepaintDummy=wo(o),m(o,"transition","transform "+n+"ms"+(this.options.easing?" "+this.options.easing:"")),m(o,"transform","translate3d(0,0,0)"),typeof o.animated=="number"&&clearTimeout(o.animated),o.animated=setTimeout(function(){m(o,"transition",""),m(o,"transform",""),o.animated=!1,o.animatingX=!1,o.animatingY=!1},n)}}}}function wo(i){return i.offsetWidth}function Eo(i,e,t,o){return Math.sqrt(Math.pow(e.top-i.top,2)+Math.pow(e.left-i.left,2))/Math.sqrt(Math.pow(e.top-t.top,2)+Math.pow(e.left-t.left,2))*o.animation}var fe=[],ct={initializeByDefault:!0},Be={mount:function(e){for(var t in ct)ct.hasOwnProperty(t)&&!(t in e)&&(e[t]=ct[t]);fe.forEach(function(o){if(o.pluginName===e.pluginName)throw"Sortable: Cannot mount plugin ".concat(e.pluginName," more than once")}),fe.push(e)},pluginEvent:function(e,t,o){var r=this;this.eventCanceled=!1,o.cancel=function(){r.eventCanceled=!0};var a=e+"Global";fe.forEach(function(n){t[n.pluginName]&&(t[n.pluginName][a]&&t[n.pluginName][a](Z({sortable:t},o)),t.options[n.pluginName]&&t[n.pluginName][e]&&t[n.pluginName][e](Z({sortable:t},o)))})},initializePlugins:function(e,t,o,r){fe.forEach(function(s){var l=s.pluginName;if(!(!e.options[l]&&!s.initializeByDefault)){var c=new s(e,t,e.options);c.sortable=e,c.options=e.options,e[l]=c,ee(o,c.defaults)}});for(var a in e.options)if(e.options.hasOwnProperty(a)){var n=this.modifyOption(e,a,e.options[a]);typeof n<"u"&&(e.options[a]=n)}},getEventProperties:function(e,t){var o={};return fe.forEach(function(r){typeof r.eventProperties=="function"&&ee(o,r.eventProperties.call(t[r.pluginName],e))}),o},modifyOption:function(e,t,o){var r;return fe.forEach(function(a){e[a.pluginName]&&a.optionListeners&&typeof a.optionListeners[t]=="function"&&(r=a.optionListeners[t].call(e[a.pluginName],o))}),r}};function ko(i){var e=i.sortable,t=i.rootEl,o=i.name,r=i.targetEl,a=i.cloneEl,n=i.toEl,s=i.fromEl,l=i.oldIndex,c=i.newIndex,p=i.oldDraggableIndex,d=i.newDraggableIndex,u=i.originalEvent,v=i.putSortable,f=i.extraEventProperties;if(e=e||t&&t[j],!!e){var y,C=e.options,A="on"+o.charAt(0).toUpperCase()+o.substr(1);window.CustomEvent&&!te&&!Oe?y=new CustomEvent(o,{bubbles:!0,cancelable:!0}):(y=document.createEvent("Event"),y.initEvent(o,!0,!0)),y.to=n||t,y.from=s||t,y.item=r||t,y.clone=a,y.oldIndex=l,y.newIndex=c,y.oldDraggableIndex=p,y.newDraggableIndex=d,y.originalEvent=u,y.pullMode=v?v.lastPutMode:void 0;var k=Z(Z({},f),Be.getEventProperties(o,e));for(var D in k)y[D]=k[D];t&&t.dispatchEvent(y),C[A]&&C[A].call(e,y)}}var So=["evt"],$=function(e,t){var o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=o.evt,a=go(o,So);Be.pluginEvent.bind(b)(e,t,Z({dragEl:h,parentEl:P,ghostEl:x,rootEl:I,nextEl:he,lastDownEl:qe,cloneEl:T,cloneHidden:ne,dragStarted:De,putSortable:B,activeSortable:b.active,originalEvent:r,oldIndex:be,oldDraggableIndex:Me,newIndex:W,newDraggableIndex:ae,hideGhostForTarget:io,unhideGhostForTarget:ro,cloneNowHidden:function(){ne=!0},cloneNowShown:function(){ne=!1},dispatchSortableEvent:function(s){F({sortable:t,name:s,originalEvent:r})}},a))};function F(i){ko(Z({putSortable:B,cloneEl:T,targetEl:h,rootEl:I,oldIndex:be,oldDraggableIndex:Me,newIndex:W,newDraggableIndex:ae},i))}var h,P,x,I,he,qe,T,ne,be,W,Me,ae,Le,B,me=!1,Ye=!1,Ke=[],de,X,dt,pt,Ht,qt,De,ge,_e,Re=!1,Fe=!1,We,L,ht=[],bt=!1,Ve=[],Qe=typeof document<"u",$e=wt,Wt=Oe||te?"cssFloat":"float",Co=Qe&&!Xt&&!wt&&"draggable"in document.createElement("div"),eo=(function(){if(Qe){if(te)return!1;var i=document.createElement("x");return i.style.cssText="pointer-events:auto",i.style.pointerEvents==="auto"}})(),to=function(e,t){var o=m(e),r=parseInt(o.width)-parseInt(o.paddingLeft)-parseInt(o.paddingRight)-parseInt(o.borderLeftWidth)-parseInt(o.borderRightWidth),a=xe(e,0,t),n=xe(e,1,t),s=a&&m(a),l=n&&m(n),c=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+_(a).width,p=l&&parseInt(l.marginLeft)+parseInt(l.marginRight)+_(n).width;if(o.display==="flex")return o.flexDirection==="column"||o.flexDirection==="column-reverse"?"vertical":"horizontal";if(o.display==="grid")return o.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(a&&s.float&&s.float!=="none"){var d=s.float==="left"?"left":"right";return n&&(l.clear==="both"||l.clear===d)?"vertical":"horizontal"}return a&&(s.display==="block"||s.display==="flex"||s.display==="table"||s.display==="grid"||c>=r&&o[Wt]==="none"||n&&o[Wt]==="none"&&c+p>r)?"vertical":"horizontal"},Do=function(e,t,o){var r=o?e.left:e.top,a=o?e.right:e.bottom,n=o?e.width:e.height,s=o?t.left:t.top,l=o?t.right:t.bottom,c=o?t.width:t.height;return r===s||a===l||r+n/2===s+c/2},Ao=function(e,t){var o;return Ke.some(function(r){var a=r[j].options.emptyInsertThreshold;if(!(!a||Et(r))){var n=_(r),s=e>=n.left-a&&e<=n.right+a,l=t>=n.top-a&&t<=n.bottom+a;if(s&&l)return o=r}}),o},oo=function(e){function t(a,n){return function(s,l,c,p){var d=s.options.group.name&&l.options.group.name&&s.options.group.name===l.options.group.name;if(a==null&&(n||d))return!0;if(a==null||a===!1)return!1;if(n&&a==="clone")return a;if(typeof a=="function")return t(a(s,l,c,p),n)(s,l,c,p);var u=(n?s:l).options.group.name;return a===!0||typeof a=="string"&&a===u||a.join&&a.indexOf(u)>-1}}var o={},r=e.group;(!r||He(r)!="object")&&(r={name:r}),o.name=r.name,o.checkPull=t(r.pull,!0),o.checkPut=t(r.put),o.revertClone=r.revertClone,e.group=o},io=function(){!eo&&x&&m(x,"display","none")},ro=function(){!eo&&x&&m(x,"display","")};Qe&&!Xt&&document.addEventListener("click",function(i){if(Ye)return i.preventDefault(),i.stopPropagation&&i.stopPropagation(),i.stopImmediatePropagation&&i.stopImmediatePropagation(),Ye=!1,!1},!0);var pe=function(e){if(h){e=e.touches?e.touches[0]:e;var t=Ao(e.clientX,e.clientY);if(t){var o={};for(var r in e)e.hasOwnProperty(r)&&(o[r]=e[r]);o.target=o.rootEl=t,o.preventDefault=void 0,o.stopPropagation=void 0,t[j]._onDragOver(o)}}},Io=function(e){h&&h.parentNode[j]._isOutsideThisEl(e.target)};function b(i,e){if(!(i&&i.nodeType&&i.nodeType===1))throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(i));this.el=i,this.options=e=ee({},e),i[j]=this;var t={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(i.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return to(i,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(n,s){n.setData("Text",s.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:b.supportPointer!==!1&&"PointerEvent"in window&&(!Te||wt),emptyInsertThreshold:5};Be.initializePlugins(this,i,t);for(var o in t)!(o in e)&&(e[o]=t[o]);oo(e);for(var r in this)r.charAt(0)==="_"&&typeof this[r]=="function"&&(this[r]=this[r].bind(this));this.nativeDraggable=e.forceFallback?!1:Co,this.nativeDraggable&&(this.options.touchStartThreshold=1),e.supportPointer?E(i,"pointerdown",this._onTapStart):(E(i,"mousedown",this._onTapStart),E(i,"touchstart",this._onTapStart)),this.nativeDraggable&&(E(i,"dragover",this),E(i,"dragenter",this)),Ke.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),ee(this,yo())}b.prototype={constructor:b,_isOutsideThisEl:function(e){!this.el.contains(e)&&e!==this.el&&(ge=null)},_getDirection:function(e,t){return typeof this.options.direction=="function"?this.options.direction.call(this,e,t,h):this.options.direction},_onTapStart:function(e){if(e.cancelable){var t=this,o=this.el,r=this.options,a=r.preventOnFilter,n=e.type,s=e.touches&&e.touches[0]||e.pointerType&&e.pointerType==="touch"&&e,l=(s||e).target,c=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||l,p=r.filter;if(No(o),!h&&!(/mousedown|pointerdown/.test(n)&&e.button!==0||r.disabled)&&!c.isContentEditable&&!(!this.nativeDraggable&&Te&&l&&l.tagName.toUpperCase()==="SELECT")&&(l=G(l,r.draggable,o,!1),!(l&&l.animated)&&qe!==l)){if(be=U(l),Me=U(l,r.draggable),typeof p=="function"){if(p.call(this,e,l,this)){F({sortable:t,rootEl:c,name:"filter",targetEl:l,toEl:o,fromEl:o}),$("filter",t,{evt:e}),a&&e.preventDefault();return}}else if(p&&(p=p.split(",").some(function(d){if(d=G(c,d.trim(),o,!1),d)return F({sortable:t,rootEl:d,name:"filter",targetEl:l,fromEl:o,toEl:o}),$("filter",t,{evt:e}),!0}),p)){a&&e.preventDefault();return}r.handle&&!G(c,r.handle,o,!1)||this._prepareDragStart(e,s,l)}}},_prepareDragStart:function(e,t,o){var r=this,a=r.el,n=r.options,s=a.ownerDocument,l;if(o&&!h&&o.parentNode===a){var c=_(o);if(I=a,h=o,P=h.parentNode,he=h.nextSibling,qe=o,Le=n.group,b.dragged=h,de={target:h,clientX:(t||e).clientX,clientY:(t||e).clientY},Ht=de.clientX-c.left,qt=de.clientY-c.top,this._lastX=(t||e).clientX,this._lastY=(t||e).clientY,h.style["will-change"]="all",l=function(){if($("delayEnded",r,{evt:e}),b.eventCanceled){r._onDrop();return}r._disableDelayedDragEvents(),!Lt&&r.nativeDraggable&&(h.draggable=!0),r._triggerDragStart(e,t),F({sortable:r,name:"choose",originalEvent:e}),q(h,n.chosenClass,!0)},n.ignore.split(",").forEach(function(p){Kt(h,p.trim(),ut)}),E(s,"dragover",pe),E(s,"mousemove",pe),E(s,"touchmove",pe),n.supportPointer?(E(s,"pointerup",r._onDrop),!this.nativeDraggable&&E(s,"pointercancel",r._onDrop)):(E(s,"mouseup",r._onDrop),E(s,"touchend",r._onDrop),E(s,"touchcancel",r._onDrop)),Lt&&this.nativeDraggable&&(this.options.touchStartThreshold=4,h.draggable=!0),$("delayStart",this,{evt:e}),n.delay&&(!n.delayOnTouchOnly||t)&&(!this.nativeDraggable||!(Oe||te))){if(b.eventCanceled){this._onDrop();return}n.supportPointer?(E(s,"pointerup",r._disableDelayedDrag),E(s,"pointercancel",r._disableDelayedDrag)):(E(s,"mouseup",r._disableDelayedDrag),E(s,"touchend",r._disableDelayedDrag),E(s,"touchcancel",r._disableDelayedDrag)),E(s,"mousemove",r._delayedDragTouchMoveHandler),E(s,"touchmove",r._delayedDragTouchMoveHandler),n.supportPointer&&E(s,"pointermove",r._delayedDragTouchMoveHandler),r._dragStartTimer=setTimeout(l,n.delay)}else l()}},_delayedDragTouchMoveHandler:function(e){var t=e.touches?e.touches[0]:e;Math.max(Math.abs(t.clientX-this._lastX),Math.abs(t.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){h&&ut(h),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;w(e,"mouseup",this._disableDelayedDrag),w(e,"touchend",this._disableDelayedDrag),w(e,"touchcancel",this._disableDelayedDrag),w(e,"pointerup",this._disableDelayedDrag),w(e,"pointercancel",this._disableDelayedDrag),w(e,"mousemove",this._delayedDragTouchMoveHandler),w(e,"touchmove",this._delayedDragTouchMoveHandler),w(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,t){t=t||e.pointerType=="touch"&&e,!this.nativeDraggable||t?this.options.supportPointer?E(document,"pointermove",this._onTouchMove):t?E(document,"touchmove",this._onTouchMove):E(document,"mousemove",this._onTouchMove):(E(h,"dragend",this),E(I,"dragstart",this._onDragStart));try{document.selection?Ue(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch{}},_dragStarted:function(e,t){if(me=!1,I&&h){$("dragStarted",this,{evt:t}),this.nativeDraggable&&E(document,"dragover",Io);var o=this.options;!e&&q(h,o.dragClass,!1),q(h,o.ghostClass,!0),b.active=this,e&&this._appendGhost(),F({sortable:this,name:"start",originalEvent:t})}else this._nulling()},_emulateDragOver:function(){if(X){this._lastX=X.clientX,this._lastY=X.clientY,io();for(var e=document.elementFromPoint(X.clientX,X.clientY),t=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(X.clientX,X.clientY),e!==t);)t=e;if(h.parentNode[j]._isOutsideThisEl(e),t)do{if(t[j]){var o=void 0;if(o=t[j]._onDragOver({clientX:X.clientX,clientY:X.clientY,target:e,rootEl:t}),o&&!this.options.dragoverBubble)break}e=t}while(t=Yt(t));ro()}},_onTouchMove:function(e){if(de){var t=this.options,o=t.fallbackTolerance,r=t.fallbackOffset,a=e.touches?e.touches[0]:e,n=x&&ve(x,!0),s=x&&n&&n.a,l=x&&n&&n.d,c=$e&&L&&jt(L),p=(a.clientX-de.clientX+r.x)/(s||1)+(c?c[0]-ht[0]:0)/(s||1),d=(a.clientY-de.clientY+r.y)/(l||1)+(c?c[1]-ht[1]:0)/(l||1);if(!b.active&&!me){if(o&&Math.max(Math.abs(a.clientX-this._lastX),Math.abs(a.clientY-this._lastY))<o)return;this._onDragStart(e,!0)}if(x){n?(n.e+=p-(dt||0),n.f+=d-(pt||0)):n={a:1,b:0,c:0,d:1,e:p,f:d};var u="matrix(".concat(n.a,",").concat(n.b,",").concat(n.c,",").concat(n.d,",").concat(n.e,",").concat(n.f,")");m(x,"webkitTransform",u),m(x,"mozTransform",u),m(x,"msTransform",u),m(x,"transform",u),dt=p,pt=d,X=a}e.cancelable&&e.preventDefault()}},_appendGhost:function(){if(!x){var e=this.options.fallbackOnBody?document.body:I,t=_(h,!0,$e,!0,e),o=this.options;if($e){for(L=e;m(L,"position")==="static"&&m(L,"transform")==="none"&&L!==document;)L=L.parentNode;L!==document.body&&L!==document.documentElement?(L===document&&(L=V()),t.top+=L.scrollTop,t.left+=L.scrollLeft):L=V(),ht=jt(L)}x=h.cloneNode(!0),q(x,o.ghostClass,!1),q(x,o.fallbackClass,!0),q(x,o.dragClass,!0),m(x,"transition",""),m(x,"transform",""),m(x,"box-sizing","border-box"),m(x,"margin",0),m(x,"top",t.top),m(x,"left",t.left),m(x,"width",t.width),m(x,"height",t.height),m(x,"opacity","0.8"),m(x,"position",$e?"absolute":"fixed"),m(x,"zIndex","100000"),m(x,"pointerEvents","none"),b.ghost=x,e.appendChild(x),m(x,"transform-origin",Ht/parseInt(x.style.width)*100+"% "+qt/parseInt(x.style.height)*100+"%")}},_onDragStart:function(e,t){var o=this,r=e.dataTransfer,a=o.options;if($("dragStart",this,{evt:e}),b.eventCanceled){this._onDrop();return}$("setupClone",this),b.eventCanceled||(T=Qt(h),T.removeAttribute("id"),T.draggable=!1,T.style["will-change"]="",this._hideClone(),q(T,this.options.chosenClass,!1),b.clone=T),o.cloneId=Ue(function(){$("clone",o),!b.eventCanceled&&(o.options.removeCloneOnHide||I.insertBefore(T,h),o._hideClone(),F({sortable:o,name:"clone"}))}),!t&&q(h,a.dragClass,!0),t?(Ye=!0,o._loopId=setInterval(o._emulateDragOver,50)):(w(document,"mouseup",o._onDrop),w(document,"touchend",o._onDrop),w(document,"touchcancel",o._onDrop),r&&(r.effectAllowed="move",a.setData&&a.setData.call(o,r,h)),E(document,"drop",o),m(h,"transform","translateZ(0)")),me=!0,o._dragStartId=Ue(o._dragStarted.bind(o,t,e)),E(document,"selectstart",o),De=!0,window.getSelection().removeAllRanges(),Te&&m(document.body,"user-select","none")},_onDragOver:function(e){var t=this.el,o=e.target,r,a,n,s=this.options,l=s.group,c=b.active,p=Le===l,d=s.sort,u=B||c,v,f=this,y=!1;if(bt)return;function C(Se,po){$(Se,f,Z({evt:e,isOwner:p,axis:v?"vertical":"horizontal",revert:n,dragRect:r,targetRect:a,canSort:d,fromSortable:u,target:o,completed:k,onMove:function(At,ho){return je(I,t,h,r,At,_(At),e,ho)},changed:D},po))}function A(){C("dragOverAnimationCapture"),f.captureAnimationState(),f!==u&&u.captureAnimationState()}function k(Se){return C("dragOverCompleted",{insertion:Se}),Se&&(p?c._hideClone():c._showClone(f),f!==u&&(q(h,B?B.options.ghostClass:c.options.ghostClass,!1),q(h,s.ghostClass,!0)),B!==f&&f!==b.active?B=f:f===b.active&&B&&(B=null),u===f&&(f._ignoreWhileAnimating=o),f.animateAll(function(){C("dragOverAnimationComplete"),f._ignoreWhileAnimating=null}),f!==u&&(u.animateAll(),u._ignoreWhileAnimating=null)),(o===h&&!h.animated||o===t&&!o.animated)&&(ge=null),!s.dragoverBubble&&!e.rootEl&&o!==document&&(h.parentNode[j]._isOutsideThisEl(e.target),!Se&&pe(e)),!s.dragoverBubble&&e.stopPropagation&&e.stopPropagation(),y=!0}function D(){W=U(h),ae=U(h,s.draggable),F({sortable:f,name:"change",toEl:t,newIndex:W,newDraggableIndex:ae,originalEvent:e})}if(e.preventDefault!==void 0&&e.cancelable&&e.preventDefault(),o=G(o,s.draggable,t,!0),C("dragOver"),b.eventCanceled)return y;if(h.contains(e.target)||o.animated&&o.animatingX&&o.animatingY||f._ignoreWhileAnimating===o)return k(!1);if(Ye=!1,c&&!s.disabled&&(p?d||(n=P!==I):B===this||(this.lastPutMode=Le.checkPull(this,c,h,e))&&l.checkPut(this,c,h,e))){if(v=this._getDirection(e,o)==="vertical",r=_(h),C("dragOverValid"),b.eventCanceled)return y;if(n)return P=I,A(),this._hideClone(),C("revert"),b.eventCanceled||(he?I.insertBefore(h,he):I.appendChild(h)),k(!0);var g=Et(t,s.draggable);if(!g||_o(e,v,this)&&!g.animated){if(g===h)return k(!1);if(g&&t===e.target&&(o=g),o&&(a=_(o)),je(I,t,h,r,o,a,e,!!o)!==!1)return A(),g&&g.nextSibling?t.insertBefore(h,g.nextSibling):t.appendChild(h),P=t,D(),k(!0)}else if(g&&Mo(e,v,this)){var S=xe(t,0,s,!0);if(S===h)return k(!1);if(o=S,a=_(o),je(I,t,h,r,o,a,e,!1)!==!1)return A(),t.insertBefore(h,S),P=t,D(),k(!0)}else if(o.parentNode===t){a=_(o);var N=0,z,ye=h.parentNode!==t,H=!Do(h.animated&&h.toRect||r,o.animated&&o.toRect||a,v),we=v?"top":"left",oe=$t(o,"top","top")||$t(h,"top","top"),Ee=oe?oe.scrollTop:void 0;ge!==o&&(z=a[we],Re=!1,Fe=!H&&s.invertSwap||ye),N=Ro(e,o,a,v,H?1:s.swapThreshold,s.invertedSwapThreshold==null?s.swapThreshold:s.invertedSwapThreshold,Fe,ge===o);var Q;if(N!==0){var le=U(h);do le-=N,Q=P.children[le];while(Q&&(m(Q,"display")==="none"||Q===x))}if(N===0||Q===o)return k(!1);ge=o,_e=N;var ke=o.nextElementSibling,ie=!1;ie=N===1;var ze=je(I,t,h,r,o,a,e,ie);if(ze!==!1)return(ze===1||ze===-1)&&(ie=ze===1),bt=!0,setTimeout(Po,30),A(),ie&&!ke?t.appendChild(h):o.parentNode.insertBefore(h,ie?ke:o),oe&&Zt(oe,0,Ee-oe.scrollTop),P=h.parentNode,z!==void 0&&!Fe&&(We=Math.abs(z-_(o)[we])),D(),k(!0)}if(t.contains(h))return k(!1)}return!1},_ignoreWhileAnimating:null,_offMoveEvents:function(){w(document,"mousemove",this._onTouchMove),w(document,"touchmove",this._onTouchMove),w(document,"pointermove",this._onTouchMove),w(document,"dragover",pe),w(document,"mousemove",pe),w(document,"touchmove",pe)},_offUpEvents:function(){var e=this.el.ownerDocument;w(e,"mouseup",this._onDrop),w(e,"touchend",this._onDrop),w(e,"pointerup",this._onDrop),w(e,"pointercancel",this._onDrop),w(e,"touchcancel",this._onDrop),w(document,"selectstart",this)},_onDrop:function(e){var t=this.el,o=this.options;if(W=U(h),ae=U(h,o.draggable),$("drop",this,{evt:e}),P=h&&h.parentNode,W=U(h),ae=U(h,o.draggable),b.eventCanceled){this._nulling();return}me=!1,Fe=!1,Re=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),vt(this.cloneId),vt(this._dragStartId),this.nativeDraggable&&(w(document,"drop",this),w(t,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),Te&&m(document.body,"user-select",""),m(h,"transform",""),e&&(De&&(e.cancelable&&e.preventDefault(),!o.dropBubble&&e.stopPropagation()),x&&x.parentNode&&x.parentNode.removeChild(x),(I===P||B&&B.lastPutMode!=="clone")&&T&&T.parentNode&&T.parentNode.removeChild(T),h&&(this.nativeDraggable&&w(h,"dragend",this),ut(h),h.style["will-change"]="",De&&!me&&q(h,B?B.options.ghostClass:this.options.ghostClass,!1),q(h,this.options.chosenClass,!1),F({sortable:this,name:"unchoose",toEl:P,newIndex:null,newDraggableIndex:null,originalEvent:e}),I!==P?(W>=0&&(F({rootEl:P,name:"add",toEl:P,fromEl:I,originalEvent:e}),F({sortable:this,name:"remove",toEl:P,originalEvent:e}),F({rootEl:P,name:"sort",toEl:P,fromEl:I,originalEvent:e}),F({sortable:this,name:"sort",toEl:P,originalEvent:e})),B&&B.save()):W!==be&&W>=0&&(F({sortable:this,name:"update",toEl:P,originalEvent:e}),F({sortable:this,name:"sort",toEl:P,originalEvent:e})),b.active&&((W==null||W===-1)&&(W=be,ae=Me),F({sortable:this,name:"end",toEl:P,originalEvent:e}),this.save()))),this._nulling()},_nulling:function(){$("nulling",this),I=h=P=x=he=T=qe=ne=de=X=De=W=ae=be=Me=ge=_e=B=Le=b.dragged=b.ghost=b.clone=b.active=null,Ve.forEach(function(e){e.checked=!0}),Ve.length=dt=pt=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":h&&(this._onDragOver(e),To(e));break;case"selectstart":e.preventDefault();break}},toArray:function(){for(var e=[],t,o=this.el.children,r=0,a=o.length,n=this.options;r<a;r++)t=o[r],G(t,n.draggable,this.el,!1)&&e.push(t.getAttribute(n.dataIdAttr)||Bo(t));return e},sort:function(e,t){var o={},r=this.el;this.toArray().forEach(function(a,n){var s=r.children[n];G(s,this.options.draggable,r,!1)&&(o[a]=s)},this),t&&this.captureAnimationState(),e.forEach(function(a){o[a]&&(r.removeChild(o[a]),r.appendChild(o[a]))}),t&&this.animateAll()},save:function(){var e=this.options.store;e&&e.set&&e.set(this)},closest:function(e,t){return G(e,t||this.options.draggable,this.el,!1)},option:function(e,t){var o=this.options;if(t===void 0)return o[e];var r=Be.modifyOption(this,e,t);typeof r<"u"?o[e]=r:o[e]=t,e==="group"&&oo(o)},destroy:function(){$("destroy",this);var e=this.el;e[j]=null,w(e,"mousedown",this._onTapStart),w(e,"touchstart",this._onTapStart),w(e,"pointerdown",this._onTapStart),this.nativeDraggable&&(w(e,"dragover",this),w(e,"dragenter",this)),Array.prototype.forEach.call(e.querySelectorAll("[draggable]"),function(t){t.removeAttribute("draggable")}),this._onDrop(),this._disableDelayedDragEvents(),Ke.splice(Ke.indexOf(this.el),1),this.el=e=null},_hideClone:function(){if(!ne){if($("hideClone",this),b.eventCanceled)return;m(T,"display","none"),this.options.removeCloneOnHide&&T.parentNode&&T.parentNode.removeChild(T),ne=!0}},_showClone:function(e){if(e.lastPutMode!=="clone"){this._hideClone();return}if(ne){if($("showClone",this),b.eventCanceled)return;h.parentNode==I&&!this.options.group.revertClone?I.insertBefore(T,h):he?I.insertBefore(T,he):I.appendChild(T),this.options.group.revertClone&&this.animate(h,T),m(T,"display",""),ne=!1}}};function To(i){i.dataTransfer&&(i.dataTransfer.dropEffect="move"),i.cancelable&&i.preventDefault()}function je(i,e,t,o,r,a,n,s){var l,c=i[j],p=c.options.onMove,d;return window.CustomEvent&&!te&&!Oe?l=new CustomEvent("move",{bubbles:!0,cancelable:!0}):(l=document.createEvent("Event"),l.initEvent("move",!0,!0)),l.to=e,l.from=i,l.dragged=t,l.draggedRect=o,l.related=r||e,l.relatedRect=a||_(e),l.willInsertAfter=s,l.originalEvent=n,i.dispatchEvent(l),p&&(d=p.call(c,l,n)),d}function ut(i){i.draggable=!1}function Po(){bt=!1}function Mo(i,e,t){var o=_(xe(t.el,0,t.options,!0)),r=Jt(t.el,t.options,x),a=10;return e?i.clientX<r.left-a||i.clientY<o.top&&i.clientX<o.right:i.clientY<r.top-a||i.clientY<o.bottom&&i.clientX<o.left}function _o(i,e,t){var o=_(Et(t.el,t.options.draggable)),r=Jt(t.el,t.options,x),a=10;return e?i.clientX>r.right+a||i.clientY>o.bottom&&i.clientX>o.left:i.clientY>r.bottom+a||i.clientX>o.right&&i.clientY>o.top}function Ro(i,e,t,o,r,a,n,s){var l=o?i.clientY:i.clientX,c=o?t.height:t.width,p=o?t.top:t.left,d=o?t.bottom:t.right,u=!1;if(!n){if(s&&We<c*r){if(!Re&&(_e===1?l>p+c*a/2:l<d-c*a/2)&&(Re=!0),Re)u=!0;else if(_e===1?l<p+We:l>d-We)return-_e}else if(l>p+c*(1-r)/2&&l<d-c*(1-r)/2)return Oo(e)}return u=u||n,u&&(l<p+c*a/2||l>d-c*a/2)?l>p+c/2?1:-1:0}function Oo(i){return U(h)<U(i)?1:-1}function Bo(i){for(var e=i.tagName+i.className+i.src+i.href+i.textContent,t=e.length,o=0;t--;)o+=e.charCodeAt(t);return o.toString(36)}function No(i){Ve.length=0;for(var e=i.getElementsByTagName("input"),t=e.length;t--;){var o=e[t];o.checked&&Ve.push(o)}}function Ue(i){return setTimeout(i,0)}function vt(i){return clearTimeout(i)}Qe&&E(document,"touchmove",function(i){(b.active||me)&&i.cancelable&&i.preventDefault()});b.utils={on:E,off:w,css:m,find:Kt,is:function(e,t){return!!G(e,t,e,!1)},extend:vo,throttle:Vt,closest:G,toggleClass:q,clone:Qt,index:U,nextTick:Ue,cancelNextTick:vt,detectDirection:to,getChild:xe,expando:j};b.get=function(i){return i[j]};b.mount=function(){for(var i=arguments.length,e=new Array(i),t=0;t<i;t++)e[t]=arguments[t];e[0].constructor===Array&&(e=e[0]),e.forEach(function(o){if(!o.prototype||!o.prototype.constructor)throw"Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(o));o.utils&&(b.utils=Z(Z({},b.utils),o.utils)),Be.mount(o)})};b.create=function(i,e){return new b(i,e)};b.version=mo;var M=[],Ae,xt,yt=!1,ft,gt,Ze,Ie;function zo(){function i(){this.defaults={scroll:!0,forceAutoScrollFallback:!1,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:!0};for(var e in this)e.charAt(0)==="_"&&typeof this[e]=="function"&&(this[e]=this[e].bind(this))}return i.prototype={dragStarted:function(t){var o=t.originalEvent;this.sortable.nativeDraggable?E(document,"dragover",this._handleAutoScroll):this.options.supportPointer?E(document,"pointermove",this._handleFallbackAutoScroll):o.touches?E(document,"touchmove",this._handleFallbackAutoScroll):E(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(t){var o=t.originalEvent;!this.options.dragOverBubble&&!o.rootEl&&this._handleAutoScroll(o)},drop:function(){this.sortable.nativeDraggable?w(document,"dragover",this._handleAutoScroll):(w(document,"pointermove",this._handleFallbackAutoScroll),w(document,"touchmove",this._handleFallbackAutoScroll),w(document,"mousemove",this._handleFallbackAutoScroll)),Ut(),Xe(),xo()},nulling:function(){Ze=xt=Ae=yt=Ie=ft=gt=null,M.length=0},_handleFallbackAutoScroll:function(t){this._handleAutoScroll(t,!0)},_handleAutoScroll:function(t,o){var r=this,a=(t.touches?t.touches[0]:t).clientX,n=(t.touches?t.touches[0]:t).clientY,s=document.elementFromPoint(a,n);if(Ze=t,o||this.options.forceAutoScrollFallback||Oe||te||Te){mt(t,this.options,s,o);var l=se(s,!0);yt&&(!Ie||a!==ft||n!==gt)&&(Ie&&Ut(),Ie=setInterval(function(){var c=se(document.elementFromPoint(a,n),!0);c!==l&&(l=c,Xe()),mt(t,r.options,c,o)},10),ft=a,gt=n)}else{if(!this.options.bubbleScroll||se(s,!0)===V()){Xe();return}mt(t,this.options,se(s,!1),!1)}}},ee(i,{pluginName:"scroll",initializeByDefault:!0})}function Xe(){M.forEach(function(i){clearInterval(i.pid)}),M=[]}function Ut(){clearInterval(Ie)}var mt=Vt(function(i,e,t,o){if(e.scroll){var r=(i.touches?i.touches[0]:i).clientX,a=(i.touches?i.touches[0]:i).clientY,n=e.scrollSensitivity,s=e.scrollSpeed,l=V(),c=!1,p;xt!==t&&(xt=t,Xe(),Ae=e.scroll,p=e.scrollFn,Ae===!0&&(Ae=se(t,!0)));var d=0,u=Ae;do{var v=u,f=_(v),y=f.top,C=f.bottom,A=f.left,k=f.right,D=f.width,g=f.height,S=void 0,N=void 0,z=v.scrollWidth,ye=v.scrollHeight,H=m(v),we=v.scrollLeft,oe=v.scrollTop;v===l?(S=D<z&&(H.overflowX==="auto"||H.overflowX==="scroll"||H.overflowX==="visible"),N=g<ye&&(H.overflowY==="auto"||H.overflowY==="scroll"||H.overflowY==="visible")):(S=D<z&&(H.overflowX==="auto"||H.overflowX==="scroll"),N=g<ye&&(H.overflowY==="auto"||H.overflowY==="scroll"));var Ee=S&&(Math.abs(k-r)<=n&&we+D<z)-(Math.abs(A-r)<=n&&!!we),Q=N&&(Math.abs(C-a)<=n&&oe+g<ye)-(Math.abs(y-a)<=n&&!!oe);if(!M[d])for(var le=0;le<=d;le++)M[le]||(M[le]={});(M[d].vx!=Ee||M[d].vy!=Q||M[d].el!==v)&&(M[d].el=v,M[d].vx=Ee,M[d].vy=Q,clearInterval(M[d].pid),(Ee!=0||Q!=0)&&(c=!0,M[d].pid=setInterval(function(){o&&this.layer===0&&b.active._onTouchMove(Ze);var ke=M[this.layer].vy?M[this.layer].vy*s:0,ie=M[this.layer].vx?M[this.layer].vx*s:0;typeof p=="function"&&p.call(b.dragged.parentNode[j],ie,ke,i,Ze,M[this.layer].el)!=="continue"||Zt(M[this.layer].el,ie,ke)}.bind({layer:d}),24))),d++}while(e.bubbleScroll&&u!==l&&(u=se(u,!1)));yt=c}},30),ao=function(e){var t=e.originalEvent,o=e.putSortable,r=e.dragEl,a=e.activeSortable,n=e.dispatchSortableEvent,s=e.hideGhostForTarget,l=e.unhideGhostForTarget;if(t){var c=o||a;s();var p=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:t,d=document.elementFromPoint(p.clientX,p.clientY);l(),c&&!c.el.contains(d)&&(n("spill"),this.onSpill({dragEl:r,putSortable:o}))}};function kt(){}kt.prototype={startIndex:null,dragStart:function(e){var t=e.oldDraggableIndex;this.startIndex=t},onSpill:function(e){var t=e.dragEl,o=e.putSortable;this.sortable.captureAnimationState(),o&&o.captureAnimationState();var r=xe(this.sortable.el,this.startIndex,this.options);r?this.sortable.el.insertBefore(t,r):this.sortable.el.appendChild(t),this.sortable.animateAll(),o&&o.animateAll()},drop:ao};ee(kt,{pluginName:"revertOnSpill"});function St(){}St.prototype={onSpill:function(e){var t=e.dragEl,o=e.putSortable,r=o||this.sortable;r.captureAnimationState(),t.parentNode&&t.parentNode.removeChild(t),r.animateAll()},drop:ao};ee(St,{pluginName:"removeOnSpill"});b.mount(new zo);b.mount(St,kt);var no=b;var so=`
|
|
1
|
+
import{h as Rt,i as Bt,m as B,n as Nt,t as nt}from"./chunk-DOKG4LX2.js";import{a as re,b as R,c as G}from"./chunk-XEN5VKAV.js";import{a as zt}from"./chunk-4YYY7PHH.js";import{a as It,b as Ce,c as Pt,h as he,i as Tt,j as _t,k as at}from"./chunk-534NMCRQ.js";import{a as ke,b as st,d as Q}from"./chunk-YNY65JUJ.js";import{b as Ot,e as Mt}from"./chunk-ZT72PD2C.js";function Lt(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(i);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,o)}return t}function K(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Lt(Object(t),!0).forEach(function(o){fo(i,o,t[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Lt(Object(t)).forEach(function(o){Object.defineProperty(i,o,Object.getOwnPropertyDescriptor(t,o))})}return i}function He(i){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?He=function(e){return typeof e}:He=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},He(i)}function fo(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function ee(){return ee=Object.assign||function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(i[o]=t[o])}return i},ee.apply(this,arguments)}function go(i,e){if(i==null)return{};var t={},o=Object.keys(i),r,a;for(a=0;a<o.length;a++)r=o[a],!(e.indexOf(r)>=0)&&(t[r]=i[r]);return t}function mo(i,e){if(i==null)return{};var t=go(i,e),o,r;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(i);for(r=0;r<a.length;r++)o=a[r],!(e.indexOf(o)>=0)&&Object.prototype.propertyIsEnumerable.call(i,o)&&(t[o]=i[o])}return t}var bo="1.15.6";function J(i){if(typeof window<"u"&&window.navigator)return!!navigator.userAgent.match(i)}var te=J(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),Re=J(/Edge/i),Ft=J(/firefox/i),Pe=J(/safari/i)&&!J(/chrome/i)&&!J(/android/i),wt=J(/iP(ad|od|hone)/i),Gt=J(/chrome/i)&&J(/android/i),Yt={capture:!1,passive:!1};function S(i,e,t){i.addEventListener(e,t,!te&&Yt)}function E(i,e,t){i.removeEventListener(e,t,!te&&Yt)}function Ge(i,e){if(e){if(e[0]===">"&&(e=e.substring(1)),i)try{if(i.matches)return i.matches(e);if(i.msMatchesSelector)return i.msMatchesSelector(e);if(i.webkitMatchesSelector)return i.webkitMatchesSelector(e)}catch{return!1}return!1}}function Kt(i){return i.host&&i!==document&&i.host.nodeType?i.host:i.parentNode}function X(i,e,t,o){if(i){t=t||document;do{if(e!=null&&(e[0]===">"?i.parentNode===t&&Ge(i,e):Ge(i,e))||o&&i===t)return i;if(i===t)break}while(i=Kt(i))}return null}var $t=/\s+/g;function H(i,e,t){if(i&&e)if(i.classList)i.classList[t?"add":"remove"](e);else{var o=(" "+i.className+" ").replace($t," ").replace(" "+e+" "," ");i.className=(o+(t?" "+e:"")).replace($t," ")}}function m(i,e,t){var o=i&&i.style;if(o){if(t===void 0)return document.defaultView&&document.defaultView.getComputedStyle?t=document.defaultView.getComputedStyle(i,""):i.currentStyle&&(t=i.currentStyle),e===void 0?t:t[e];!(e in o)&&e.indexOf("webkit")===-1&&(e="-webkit-"+e),o[e]=t+(typeof t=="string"?"":"px")}}function be(i,e){var t="";if(typeof i=="string")t=i;else do{var o=m(i,"transform");o&&o!=="none"&&(t=o+" "+t)}while(!e&&(i=i.parentNode));var r=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return r&&new r(t)}function Vt(i,e,t){if(i){var o=i.getElementsByTagName(e),r=0,a=o.length;if(t)for(;r<a;r++)t(o[r],r);return o}return[]}function Y(){var i=document.scrollingElement;return i||document.documentElement}function M(i,e,t,o,r){if(!(!i.getBoundingClientRect&&i!==window)){var a,n,l,s,c,h,p;if(i!==window&&i.parentNode&&i!==Y()?(a=i.getBoundingClientRect(),n=a.top,l=a.left,s=a.bottom,c=a.right,h=a.height,p=a.width):(n=0,l=0,s=window.innerHeight,c=window.innerWidth,h=window.innerHeight,p=window.innerWidth),(e||t)&&i!==window&&(r=r||i.parentNode,!te))do if(r&&r.getBoundingClientRect&&(m(r,"transform")!=="none"||t&&m(r,"position")!=="static")){var u=r.getBoundingClientRect();n-=u.top+parseInt(m(r,"border-top-width")),l-=u.left+parseInt(m(r,"border-left-width")),s=n+a.height,c=l+a.width;break}while(r=r.parentNode);if(o&&i!==window){var v=be(r||i),f=v&&v.a,y=v&&v.d;v&&(n/=y,l/=f,p/=f,h/=y,s=n+h,c=l+p)}return{top:n,left:l,bottom:s,right:c,width:p,height:h}}}function jt(i,e,t){for(var o=se(i,!0),r=M(i)[e];o;){var a=M(o)[t],n=void 0;if(t==="top"||t==="left"?n=r>=a:n=r<=a,!n)return o;if(o===Y())break;o=se(o,!1)}return!1}function ve(i,e,t,o){for(var r=0,a=0,n=i.children;a<n.length;){if(n[a].style.display!=="none"&&n[a]!==b.ghost&&(o||n[a]!==b.dragged)&&X(n[a],t.draggable,i,!1)){if(r===e)return n[a];r++}a++}return null}function Et(i,e){for(var t=i.lastElementChild;t&&(t===b.ghost||m(t,"display")==="none"||e&&!Ge(t,e));)t=t.previousElementSibling;return t||null}function W(i,e){var t=0;if(!i||!i.parentNode)return-1;for(;i=i.previousElementSibling;)i.nodeName.toUpperCase()!=="TEMPLATE"&&i!==b.clone&&(!e||Ge(i,e))&&t++;return t}function Ht(i){var e=0,t=0,o=Y();if(i)do{var r=be(i),a=r.a,n=r.d;e+=i.scrollLeft*a,t+=i.scrollTop*n}while(i!==o&&(i=i.parentNode));return[e,t]}function vo(i,e){for(var t in i)if(i.hasOwnProperty(t)){for(var o in e)if(e.hasOwnProperty(o)&&e[o]===i[t][o])return Number(t)}return-1}function se(i,e){if(!i||!i.getBoundingClientRect)return Y();var t=i,o=!1;do if(t.clientWidth<t.scrollWidth||t.clientHeight<t.scrollHeight){var r=m(t);if(t.clientWidth<t.scrollWidth&&(r.overflowX=="auto"||r.overflowX=="scroll")||t.clientHeight<t.scrollHeight&&(r.overflowY=="auto"||r.overflowY=="scroll")){if(!t.getBoundingClientRect||t===document.body)return Y();if(o||e)return t;o=!0}}while(t=t.parentNode);return Y()}function xo(i,e){if(i&&e)for(var t in e)e.hasOwnProperty(t)&&(i[t]=e[t]);return i}function lt(i,e){return Math.round(i.top)===Math.round(e.top)&&Math.round(i.left)===Math.round(e.left)&&Math.round(i.height)===Math.round(e.height)&&Math.round(i.width)===Math.round(e.width)}var Te;function Zt(i,e){return function(){if(!Te){var t=arguments,o=this;t.length===1?i.call(o,t[0]):i.apply(o,t),Te=setTimeout(function(){Te=void 0},e)}}}function yo(){clearTimeout(Te),Te=void 0}function Qt(i,e,t){i.scrollLeft+=e,i.scrollTop+=t}function Jt(i){var e=window.Polymer,t=window.jQuery||window.Zepto;return e&&e.dom?e.dom(i).cloneNode(!0):t?t(i).clone(!0)[0]:i.cloneNode(!0)}function eo(i,e,t){var o={};return Array.from(i.children).forEach(function(r){var a,n,l,s;if(!(!X(r,e.draggable,i,!1)||r.animated||r===t)){var c=M(r);o.left=Math.min((a=o.left)!==null&&a!==void 0?a:1/0,c.left),o.top=Math.min((n=o.top)!==null&&n!==void 0?n:1/0,c.top),o.right=Math.max((l=o.right)!==null&&l!==void 0?l:-1/0,c.right),o.bottom=Math.max((s=o.bottom)!==null&&s!==void 0?s:-1/0,c.bottom)}}),o.width=o.right-o.left,o.height=o.bottom-o.top,o.x=o.left,o.y=o.top,o}var $="Sortable"+new Date().getTime();function wo(){var i=[],e;return{captureAnimationState:function(){if(i=[],!!this.options.animation){var o=[].slice.call(this.el.children);o.forEach(function(r){if(!(m(r,"display")==="none"||r===b.ghost)){i.push({target:r,rect:M(r)});var a=K({},i[i.length-1].rect);if(r.thisAnimationDuration){var n=be(r,!0);n&&(a.top-=n.f,a.left-=n.e)}r.fromRect=a}})}},addAnimationState:function(o){i.push(o)},removeAnimationState:function(o){i.splice(vo(i,{target:o}),1)},animateAll:function(o){var r=this;if(!this.options.animation){clearTimeout(e),typeof o=="function"&&o();return}var a=!1,n=0;i.forEach(function(l){var s=0,c=l.target,h=c.fromRect,p=M(c),u=c.prevFromRect,v=c.prevToRect,f=l.rect,y=be(c,!0);y&&(p.top-=y.f,p.left-=y.e),c.toRect=p,c.thisAnimationDuration&<(u,p)&&!lt(h,p)&&(f.top-p.top)/(f.left-p.left)===(h.top-p.top)/(h.left-p.left)&&(s=So(f,u,v,r.options)),lt(p,h)||(c.prevFromRect=h,c.prevToRect=p,s||(s=r.options.animation),r.animate(c,f,p,s)),s&&(a=!0,n=Math.max(n,s),clearTimeout(c.animationResetTimer),c.animationResetTimer=setTimeout(function(){c.animationTime=0,c.prevFromRect=null,c.fromRect=null,c.prevToRect=null,c.thisAnimationDuration=null},s),c.thisAnimationDuration=s)}),clearTimeout(e),a?e=setTimeout(function(){typeof o=="function"&&o()},n):typeof o=="function"&&o(),i=[]},animate:function(o,r,a,n){if(n){m(o,"transition",""),m(o,"transform","");var l=be(this.el),s=l&&l.a,c=l&&l.d,h=(r.left-a.left)/(s||1),p=(r.top-a.top)/(c||1);o.animatingX=!!h,o.animatingY=!!p,m(o,"transform","translate3d("+h+"px,"+p+"px,0)"),this.forRepaintDummy=Eo(o),m(o,"transition","transform "+n+"ms"+(this.options.easing?" "+this.options.easing:"")),m(o,"transform","translate3d(0,0,0)"),typeof o.animated=="number"&&clearTimeout(o.animated),o.animated=setTimeout(function(){m(o,"transition",""),m(o,"transform",""),o.animated=!1,o.animatingX=!1,o.animatingY=!1},n)}}}}function Eo(i){return i.offsetWidth}function So(i,e,t,o){return Math.sqrt(Math.pow(e.top-i.top,2)+Math.pow(e.left-i.left,2))/Math.sqrt(Math.pow(e.top-t.top,2)+Math.pow(e.left-t.left,2))*o.animation}var ue=[],ct={initializeByDefault:!0},Be={mount:function(e){for(var t in ct)ct.hasOwnProperty(t)&&!(t in e)&&(e[t]=ct[t]);ue.forEach(function(o){if(o.pluginName===e.pluginName)throw"Sortable: Cannot mount plugin ".concat(e.pluginName," more than once")}),ue.push(e)},pluginEvent:function(e,t,o){var r=this;this.eventCanceled=!1,o.cancel=function(){r.eventCanceled=!0};var a=e+"Global";ue.forEach(function(n){t[n.pluginName]&&(t[n.pluginName][a]&&t[n.pluginName][a](K({sortable:t},o)),t.options[n.pluginName]&&t[n.pluginName][e]&&t[n.pluginName][e](K({sortable:t},o)))})},initializePlugins:function(e,t,o,r){ue.forEach(function(l){var s=l.pluginName;if(!(!e.options[s]&&!l.initializeByDefault)){var c=new l(e,t,e.options);c.sortable=e,c.options=e.options,e[s]=c,ee(o,c.defaults)}});for(var a in e.options)if(e.options.hasOwnProperty(a)){var n=this.modifyOption(e,a,e.options[a]);typeof n<"u"&&(e.options[a]=n)}},getEventProperties:function(e,t){var o={};return ue.forEach(function(r){typeof r.eventProperties=="function"&&ee(o,r.eventProperties.call(t[r.pluginName],e))}),o},modifyOption:function(e,t,o){var r;return ue.forEach(function(a){e[a.pluginName]&&a.optionListeners&&typeof a.optionListeners[t]=="function"&&(r=a.optionListeners[t].call(e[a.pluginName],o))}),r}};function Co(i){var e=i.sortable,t=i.rootEl,o=i.name,r=i.targetEl,a=i.cloneEl,n=i.toEl,l=i.fromEl,s=i.oldIndex,c=i.newIndex,h=i.oldDraggableIndex,p=i.newDraggableIndex,u=i.originalEvent,v=i.putSortable,f=i.extraEventProperties;if(e=e||t&&t[$],!!e){var y,I=e.options,D="on"+o.charAt(0).toUpperCase()+o.substr(1);window.CustomEvent&&!te&&!Re?y=new CustomEvent(o,{bubbles:!0,cancelable:!0}):(y=document.createEvent("Event"),y.initEvent(o,!0,!0)),y.to=n||t,y.from=l||t,y.item=r||t,y.clone=a,y.oldIndex=s,y.newIndex=c,y.oldDraggableIndex=h,y.newDraggableIndex=p,y.originalEvent=u,y.pullMode=v?v.lastPutMode:void 0;var g=K(K({},f),Be.getEventProperties(o,e));for(var w in g)y[w]=g[w];t&&t.dispatchEvent(y),I[D]&&I[D].call(e,y)}}var ko=["evt"],F=function(e,t){var o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=o.evt,a=mo(o,ko);Be.pluginEvent.bind(b)(e,t,K({dragEl:d,parentEl:T,ghostEl:x,rootEl:A,nextEl:pe,lastDownEl:qe,cloneEl:P,cloneHidden:ne,dragStarted:De,putSortable:N,activeSortable:b.active,originalEvent:r,oldIndex:me,oldDraggableIndex:_e,newIndex:q,newDraggableIndex:ae,hideGhostForTarget:ro,unhideGhostForTarget:ao,cloneNowHidden:function(){ne=!0},cloneNowShown:function(){ne=!1},dispatchSortableEvent:function(l){L({sortable:t,name:l,originalEvent:r})}},a))};function L(i){Co(K({putSortable:N,cloneEl:P,targetEl:d,rootEl:A,oldIndex:me,oldDraggableIndex:_e,newIndex:q,newDraggableIndex:ae},i))}var d,T,x,A,pe,qe,P,ne,me,q,_e,ae,Le,N,ge=!1,Ye=!1,Ke=[],ce,U,dt,pt,qt,Wt,De,fe,Oe,Me=!1,Fe=!1,We,z,ht=[],bt=!1,Ve=[],Qe=typeof document<"u",$e=wt,Ut=Re||te?"cssFloat":"float",Do=Qe&&!Gt&&!wt&&"draggable"in document.createElement("div"),to=(function(){if(Qe){if(te)return!1;var i=document.createElement("x");return i.style.cssText="pointer-events:auto",i.style.pointerEvents==="auto"}})(),oo=function(e,t){var o=m(e),r=parseInt(o.width)-parseInt(o.paddingLeft)-parseInt(o.paddingRight)-parseInt(o.borderLeftWidth)-parseInt(o.borderRightWidth),a=ve(e,0,t),n=ve(e,1,t),l=a&&m(a),s=n&&m(n),c=l&&parseInt(l.marginLeft)+parseInt(l.marginRight)+M(a).width,h=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+M(n).width;if(o.display==="flex")return o.flexDirection==="column"||o.flexDirection==="column-reverse"?"vertical":"horizontal";if(o.display==="grid")return o.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(a&&l.float&&l.float!=="none"){var p=l.float==="left"?"left":"right";return n&&(s.clear==="both"||s.clear===p)?"vertical":"horizontal"}return a&&(l.display==="block"||l.display==="flex"||l.display==="table"||l.display==="grid"||c>=r&&o[Ut]==="none"||n&&o[Ut]==="none"&&c+h>r)?"vertical":"horizontal"},Ao=function(e,t,o){var r=o?e.left:e.top,a=o?e.right:e.bottom,n=o?e.width:e.height,l=o?t.left:t.top,s=o?t.right:t.bottom,c=o?t.width:t.height;return r===l||a===s||r+n/2===l+c/2},Io=function(e,t){var o;return Ke.some(function(r){var a=r[$].options.emptyInsertThreshold;if(!(!a||Et(r))){var n=M(r),l=e>=n.left-a&&e<=n.right+a,s=t>=n.top-a&&t<=n.bottom+a;if(l&&s)return o=r}}),o},io=function(e){function t(a,n){return function(l,s,c,h){var p=l.options.group.name&&s.options.group.name&&l.options.group.name===s.options.group.name;if(a==null&&(n||p))return!0;if(a==null||a===!1)return!1;if(n&&a==="clone")return a;if(typeof a=="function")return t(a(l,s,c,h),n)(l,s,c,h);var u=(n?l:s).options.group.name;return a===!0||typeof a=="string"&&a===u||a.join&&a.indexOf(u)>-1}}var o={},r=e.group;(!r||He(r)!="object")&&(r={name:r}),o.name=r.name,o.checkPull=t(r.pull,!0),o.checkPut=t(r.put),o.revertClone=r.revertClone,e.group=o},ro=function(){!to&&x&&m(x,"display","none")},ao=function(){!to&&x&&m(x,"display","")};Qe&&!Gt&&document.addEventListener("click",function(i){if(Ye)return i.preventDefault(),i.stopPropagation&&i.stopPropagation(),i.stopImmediatePropagation&&i.stopImmediatePropagation(),Ye=!1,!1},!0);var de=function(e){if(d){e=e.touches?e.touches[0]:e;var t=Io(e.clientX,e.clientY);if(t){var o={};for(var r in e)e.hasOwnProperty(r)&&(o[r]=e[r]);o.target=o.rootEl=t,o.preventDefault=void 0,o.stopPropagation=void 0,t[$]._onDragOver(o)}}},Po=function(e){d&&d.parentNode[$]._isOutsideThisEl(e.target)};function b(i,e){if(!(i&&i.nodeType&&i.nodeType===1))throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(i));this.el=i,this.options=e=ee({},e),i[$]=this;var t={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(i.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return oo(i,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(n,l){n.setData("Text",l.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:b.supportPointer!==!1&&"PointerEvent"in window&&(!Pe||wt),emptyInsertThreshold:5};Be.initializePlugins(this,i,t);for(var o in t)!(o in e)&&(e[o]=t[o]);io(e);for(var r in this)r.charAt(0)==="_"&&typeof this[r]=="function"&&(this[r]=this[r].bind(this));this.nativeDraggable=e.forceFallback?!1:Do,this.nativeDraggable&&(this.options.touchStartThreshold=1),e.supportPointer?S(i,"pointerdown",this._onTapStart):(S(i,"mousedown",this._onTapStart),S(i,"touchstart",this._onTapStart)),this.nativeDraggable&&(S(i,"dragover",this),S(i,"dragenter",this)),Ke.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),ee(this,wo())}b.prototype={constructor:b,_isOutsideThisEl:function(e){!this.el.contains(e)&&e!==this.el&&(fe=null)},_getDirection:function(e,t){return typeof this.options.direction=="function"?this.options.direction.call(this,e,t,d):this.options.direction},_onTapStart:function(e){if(e.cancelable){var t=this,o=this.el,r=this.options,a=r.preventOnFilter,n=e.type,l=e.touches&&e.touches[0]||e.pointerType&&e.pointerType==="touch"&&e,s=(l||e).target,c=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||s,h=r.filter;if(zo(o),!d&&!(/mousedown|pointerdown/.test(n)&&e.button!==0||r.disabled)&&!c.isContentEditable&&!(!this.nativeDraggable&&Pe&&s&&s.tagName.toUpperCase()==="SELECT")&&(s=X(s,r.draggable,o,!1),!(s&&s.animated)&&qe!==s)){if(me=W(s),_e=W(s,r.draggable),typeof h=="function"){if(h.call(this,e,s,this)){L({sortable:t,rootEl:c,name:"filter",targetEl:s,toEl:o,fromEl:o}),F("filter",t,{evt:e}),a&&e.preventDefault();return}}else if(h&&(h=h.split(",").some(function(p){if(p=X(c,p.trim(),o,!1),p)return L({sortable:t,rootEl:p,name:"filter",targetEl:s,fromEl:o,toEl:o}),F("filter",t,{evt:e}),!0}),h)){a&&e.preventDefault();return}r.handle&&!X(c,r.handle,o,!1)||this._prepareDragStart(e,l,s)}}},_prepareDragStart:function(e,t,o){var r=this,a=r.el,n=r.options,l=a.ownerDocument,s;if(o&&!d&&o.parentNode===a){var c=M(o);if(A=a,d=o,T=d.parentNode,pe=d.nextSibling,qe=o,Le=n.group,b.dragged=d,ce={target:d,clientX:(t||e).clientX,clientY:(t||e).clientY},qt=ce.clientX-c.left,Wt=ce.clientY-c.top,this._lastX=(t||e).clientX,this._lastY=(t||e).clientY,d.style["will-change"]="all",s=function(){if(F("delayEnded",r,{evt:e}),b.eventCanceled){r._onDrop();return}r._disableDelayedDragEvents(),!Ft&&r.nativeDraggable&&(d.draggable=!0),r._triggerDragStart(e,t),L({sortable:r,name:"choose",originalEvent:e}),H(d,n.chosenClass,!0)},n.ignore.split(",").forEach(function(h){Vt(d,h.trim(),ut)}),S(l,"dragover",de),S(l,"mousemove",de),S(l,"touchmove",de),n.supportPointer?(S(l,"pointerup",r._onDrop),!this.nativeDraggable&&S(l,"pointercancel",r._onDrop)):(S(l,"mouseup",r._onDrop),S(l,"touchend",r._onDrop),S(l,"touchcancel",r._onDrop)),Ft&&this.nativeDraggable&&(this.options.touchStartThreshold=4,d.draggable=!0),F("delayStart",this,{evt:e}),n.delay&&(!n.delayOnTouchOnly||t)&&(!this.nativeDraggable||!(Re||te))){if(b.eventCanceled){this._onDrop();return}n.supportPointer?(S(l,"pointerup",r._disableDelayedDrag),S(l,"pointercancel",r._disableDelayedDrag)):(S(l,"mouseup",r._disableDelayedDrag),S(l,"touchend",r._disableDelayedDrag),S(l,"touchcancel",r._disableDelayedDrag)),S(l,"mousemove",r._delayedDragTouchMoveHandler),S(l,"touchmove",r._delayedDragTouchMoveHandler),n.supportPointer&&S(l,"pointermove",r._delayedDragTouchMoveHandler),r._dragStartTimer=setTimeout(s,n.delay)}else s()}},_delayedDragTouchMoveHandler:function(e){var t=e.touches?e.touches[0]:e;Math.max(Math.abs(t.clientX-this._lastX),Math.abs(t.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){d&&ut(d),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;E(e,"mouseup",this._disableDelayedDrag),E(e,"touchend",this._disableDelayedDrag),E(e,"touchcancel",this._disableDelayedDrag),E(e,"pointerup",this._disableDelayedDrag),E(e,"pointercancel",this._disableDelayedDrag),E(e,"mousemove",this._delayedDragTouchMoveHandler),E(e,"touchmove",this._delayedDragTouchMoveHandler),E(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,t){t=t||e.pointerType=="touch"&&e,!this.nativeDraggable||t?this.options.supportPointer?S(document,"pointermove",this._onTouchMove):t?S(document,"touchmove",this._onTouchMove):S(document,"mousemove",this._onTouchMove):(S(d,"dragend",this),S(A,"dragstart",this._onDragStart));try{document.selection?Ue(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch{}},_dragStarted:function(e,t){if(ge=!1,A&&d){F("dragStarted",this,{evt:t}),this.nativeDraggable&&S(document,"dragover",Po);var o=this.options;!e&&H(d,o.dragClass,!1),H(d,o.ghostClass,!0),b.active=this,e&&this._appendGhost(),L({sortable:this,name:"start",originalEvent:t})}else this._nulling()},_emulateDragOver:function(){if(U){this._lastX=U.clientX,this._lastY=U.clientY,ro();for(var e=document.elementFromPoint(U.clientX,U.clientY),t=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(U.clientX,U.clientY),e!==t);)t=e;if(d.parentNode[$]._isOutsideThisEl(e),t)do{if(t[$]){var o=void 0;if(o=t[$]._onDragOver({clientX:U.clientX,clientY:U.clientY,target:e,rootEl:t}),o&&!this.options.dragoverBubble)break}e=t}while(t=Kt(t));ao()}},_onTouchMove:function(e){if(ce){var t=this.options,o=t.fallbackTolerance,r=t.fallbackOffset,a=e.touches?e.touches[0]:e,n=x&&be(x,!0),l=x&&n&&n.a,s=x&&n&&n.d,c=$e&&z&&Ht(z),h=(a.clientX-ce.clientX+r.x)/(l||1)+(c?c[0]-ht[0]:0)/(l||1),p=(a.clientY-ce.clientY+r.y)/(s||1)+(c?c[1]-ht[1]:0)/(s||1);if(!b.active&&!ge){if(o&&Math.max(Math.abs(a.clientX-this._lastX),Math.abs(a.clientY-this._lastY))<o)return;this._onDragStart(e,!0)}if(x){n?(n.e+=h-(dt||0),n.f+=p-(pt||0)):n={a:1,b:0,c:0,d:1,e:h,f:p};var u="matrix(".concat(n.a,",").concat(n.b,",").concat(n.c,",").concat(n.d,",").concat(n.e,",").concat(n.f,")");m(x,"webkitTransform",u),m(x,"mozTransform",u),m(x,"msTransform",u),m(x,"transform",u),dt=h,pt=p,U=a}e.cancelable&&e.preventDefault()}},_appendGhost:function(){if(!x){var e=this.options.fallbackOnBody?document.body:A,t=M(d,!0,$e,!0,e),o=this.options;if($e){for(z=e;m(z,"position")==="static"&&m(z,"transform")==="none"&&z!==document;)z=z.parentNode;z!==document.body&&z!==document.documentElement?(z===document&&(z=Y()),t.top+=z.scrollTop,t.left+=z.scrollLeft):z=Y(),ht=Ht(z)}x=d.cloneNode(!0),H(x,o.ghostClass,!1),H(x,o.fallbackClass,!0),H(x,o.dragClass,!0),m(x,"transition",""),m(x,"transform",""),m(x,"box-sizing","border-box"),m(x,"margin",0),m(x,"top",t.top),m(x,"left",t.left),m(x,"width",t.width),m(x,"height",t.height),m(x,"opacity","0.8"),m(x,"position",$e?"absolute":"fixed"),m(x,"zIndex","100000"),m(x,"pointerEvents","none"),b.ghost=x,e.appendChild(x),m(x,"transform-origin",qt/parseInt(x.style.width)*100+"% "+Wt/parseInt(x.style.height)*100+"%")}},_onDragStart:function(e,t){var o=this,r=e.dataTransfer,a=o.options;if(F("dragStart",this,{evt:e}),b.eventCanceled){this._onDrop();return}F("setupClone",this),b.eventCanceled||(P=Jt(d),P.removeAttribute("id"),P.draggable=!1,P.style["will-change"]="",this._hideClone(),H(P,this.options.chosenClass,!1),b.clone=P),o.cloneId=Ue(function(){F("clone",o),!b.eventCanceled&&(o.options.removeCloneOnHide||A.insertBefore(P,d),o._hideClone(),L({sortable:o,name:"clone"}))}),!t&&H(d,a.dragClass,!0),t?(Ye=!0,o._loopId=setInterval(o._emulateDragOver,50)):(E(document,"mouseup",o._onDrop),E(document,"touchend",o._onDrop),E(document,"touchcancel",o._onDrop),r&&(r.effectAllowed="move",a.setData&&a.setData.call(o,r,d)),S(document,"drop",o),m(d,"transform","translateZ(0)")),ge=!0,o._dragStartId=Ue(o._dragStarted.bind(o,t,e)),S(document,"selectstart",o),De=!0,window.getSelection().removeAllRanges(),Pe&&m(document.body,"user-select","none")},_onDragOver:function(e){var t=this.el,o=e.target,r,a,n,l=this.options,s=l.group,c=b.active,h=Le===s,p=l.sort,u=N||c,v,f=this,y=!1;if(bt)return;function I(Se,ho){F(Se,f,K({evt:e,isOwner:h,axis:v?"vertical":"horizontal",revert:n,dragRect:r,targetRect:a,canSort:p,fromSortable:u,target:o,completed:g,onMove:function(At,uo){return je(A,t,d,r,At,M(At),e,uo)},changed:w},ho))}function D(){I("dragOverAnimationCapture"),f.captureAnimationState(),f!==u&&u.captureAnimationState()}function g(Se){return I("dragOverCompleted",{insertion:Se}),Se&&(h?c._hideClone():c._showClone(f),f!==u&&(H(d,N?N.options.ghostClass:c.options.ghostClass,!1),H(d,l.ghostClass,!0)),N!==f&&f!==b.active?N=f:f===b.active&&N&&(N=null),u===f&&(f._ignoreWhileAnimating=o),f.animateAll(function(){I("dragOverAnimationComplete"),f._ignoreWhileAnimating=null}),f!==u&&(u.animateAll(),u._ignoreWhileAnimating=null)),(o===d&&!d.animated||o===t&&!o.animated)&&(fe=null),!l.dragoverBubble&&!e.rootEl&&o!==document&&(d.parentNode[$]._isOutsideThisEl(e.target),!Se&&de(e)),!l.dragoverBubble&&e.stopPropagation&&e.stopPropagation(),y=!0}function w(){q=W(d),ae=W(d,l.draggable),L({sortable:f,name:"change",toEl:t,newIndex:q,newDraggableIndex:ae,originalEvent:e})}if(e.preventDefault!==void 0&&e.cancelable&&e.preventDefault(),o=X(o,l.draggable,t,!0),I("dragOver"),b.eventCanceled)return y;if(d.contains(e.target)||o.animated&&o.animatingX&&o.animatingY||f._ignoreWhileAnimating===o)return g(!1);if(Ye=!1,c&&!l.disabled&&(h?p||(n=T!==A):N===this||(this.lastPutMode=Le.checkPull(this,c,d,e))&&s.checkPut(this,c,d,e))){if(v=this._getDirection(e,o)==="vertical",r=M(d),I("dragOverValid"),b.eventCanceled)return y;if(n)return T=A,D(),this._hideClone(),I("revert"),b.eventCanceled||(pe?A.insertBefore(d,pe):A.appendChild(d)),g(!0);var C=Et(t,l.draggable);if(!C||Mo(e,v,this)&&!C.animated){if(C===d)return g(!1);if(C&&t===e.target&&(o=C),o&&(a=M(o)),je(A,t,d,r,o,a,e,!!o)!==!1)return D(),C&&C.nextSibling?t.insertBefore(d,C.nextSibling):t.appendChild(d),T=t,w(),g(!0)}else if(C&&Oo(e,v,this)){var k=ve(t,0,l,!0);if(k===d)return g(!1);if(o=k,a=M(o),je(A,t,d,r,o,a,e,!1)!==!1)return D(),t.insertBefore(d,k),T=t,w(),g(!0)}else if(o.parentNode===t){a=M(o);var _=0,V,xe=d.parentNode!==t,j=!Ao(d.animated&&d.toRect||r,o.animated&&o.toRect||a,v),ye=v?"top":"left",oe=jt(o,"top","top")||jt(d,"top","top"),we=oe?oe.scrollTop:void 0;fe!==o&&(V=a[ye],Me=!1,Fe=!j&&l.invertSwap||xe),_=Ro(e,o,a,v,j?1:l.swapThreshold,l.invertedSwapThreshold==null?l.swapThreshold:l.invertedSwapThreshold,Fe,fe===o);var Z;if(_!==0){var le=W(d);do le-=_,Z=T.children[le];while(Z&&(m(Z,"display")==="none"||Z===x))}if(_===0||Z===o)return g(!1);fe=o,Oe=_;var Ee=o.nextElementSibling,ie=!1;ie=_===1;var ze=je(A,t,d,r,o,a,e,ie);if(ze!==!1)return(ze===1||ze===-1)&&(ie=ze===1),bt=!0,setTimeout(_o,30),D(),ie&&!Ee?t.appendChild(d):o.parentNode.insertBefore(d,ie?Ee:o),oe&&Qt(oe,0,we-oe.scrollTop),T=d.parentNode,V!==void 0&&!Fe&&(We=Math.abs(V-M(o)[ye])),w(),g(!0)}if(t.contains(d))return g(!1)}return!1},_ignoreWhileAnimating:null,_offMoveEvents:function(){E(document,"mousemove",this._onTouchMove),E(document,"touchmove",this._onTouchMove),E(document,"pointermove",this._onTouchMove),E(document,"dragover",de),E(document,"mousemove",de),E(document,"touchmove",de)},_offUpEvents:function(){var e=this.el.ownerDocument;E(e,"mouseup",this._onDrop),E(e,"touchend",this._onDrop),E(e,"pointerup",this._onDrop),E(e,"pointercancel",this._onDrop),E(e,"touchcancel",this._onDrop),E(document,"selectstart",this)},_onDrop:function(e){var t=this.el,o=this.options;if(q=W(d),ae=W(d,o.draggable),F("drop",this,{evt:e}),T=d&&d.parentNode,q=W(d),ae=W(d,o.draggable),b.eventCanceled){this._nulling();return}ge=!1,Fe=!1,Me=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),vt(this.cloneId),vt(this._dragStartId),this.nativeDraggable&&(E(document,"drop",this),E(t,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),Pe&&m(document.body,"user-select",""),m(d,"transform",""),e&&(De&&(e.cancelable&&e.preventDefault(),!o.dropBubble&&e.stopPropagation()),x&&x.parentNode&&x.parentNode.removeChild(x),(A===T||N&&N.lastPutMode!=="clone")&&P&&P.parentNode&&P.parentNode.removeChild(P),d&&(this.nativeDraggable&&E(d,"dragend",this),ut(d),d.style["will-change"]="",De&&!ge&&H(d,N?N.options.ghostClass:this.options.ghostClass,!1),H(d,this.options.chosenClass,!1),L({sortable:this,name:"unchoose",toEl:T,newIndex:null,newDraggableIndex:null,originalEvent:e}),A!==T?(q>=0&&(L({rootEl:T,name:"add",toEl:T,fromEl:A,originalEvent:e}),L({sortable:this,name:"remove",toEl:T,originalEvent:e}),L({rootEl:T,name:"sort",toEl:T,fromEl:A,originalEvent:e}),L({sortable:this,name:"sort",toEl:T,originalEvent:e})),N&&N.save()):q!==me&&q>=0&&(L({sortable:this,name:"update",toEl:T,originalEvent:e}),L({sortable:this,name:"sort",toEl:T,originalEvent:e})),b.active&&((q==null||q===-1)&&(q=me,ae=_e),L({sortable:this,name:"end",toEl:T,originalEvent:e}),this.save()))),this._nulling()},_nulling:function(){F("nulling",this),A=d=T=x=pe=P=qe=ne=ce=U=De=q=ae=me=_e=fe=Oe=N=Le=b.dragged=b.ghost=b.clone=b.active=null,Ve.forEach(function(e){e.checked=!0}),Ve.length=dt=pt=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":d&&(this._onDragOver(e),To(e));break;case"selectstart":e.preventDefault();break}},toArray:function(){for(var e=[],t,o=this.el.children,r=0,a=o.length,n=this.options;r<a;r++)t=o[r],X(t,n.draggable,this.el,!1)&&e.push(t.getAttribute(n.dataIdAttr)||No(t));return e},sort:function(e,t){var o={},r=this.el;this.toArray().forEach(function(a,n){var l=r.children[n];X(l,this.options.draggable,r,!1)&&(o[a]=l)},this),t&&this.captureAnimationState(),e.forEach(function(a){o[a]&&(r.removeChild(o[a]),r.appendChild(o[a]))}),t&&this.animateAll()},save:function(){var e=this.options.store;e&&e.set&&e.set(this)},closest:function(e,t){return X(e,t||this.options.draggable,this.el,!1)},option:function(e,t){var o=this.options;if(t===void 0)return o[e];var r=Be.modifyOption(this,e,t);typeof r<"u"?o[e]=r:o[e]=t,e==="group"&&io(o)},destroy:function(){F("destroy",this);var e=this.el;e[$]=null,E(e,"mousedown",this._onTapStart),E(e,"touchstart",this._onTapStart),E(e,"pointerdown",this._onTapStart),this.nativeDraggable&&(E(e,"dragover",this),E(e,"dragenter",this)),Array.prototype.forEach.call(e.querySelectorAll("[draggable]"),function(t){t.removeAttribute("draggable")}),this._onDrop(),this._disableDelayedDragEvents(),Ke.splice(Ke.indexOf(this.el),1),this.el=e=null},_hideClone:function(){if(!ne){if(F("hideClone",this),b.eventCanceled)return;m(P,"display","none"),this.options.removeCloneOnHide&&P.parentNode&&P.parentNode.removeChild(P),ne=!0}},_showClone:function(e){if(e.lastPutMode!=="clone"){this._hideClone();return}if(ne){if(F("showClone",this),b.eventCanceled)return;d.parentNode==A&&!this.options.group.revertClone?A.insertBefore(P,d):pe?A.insertBefore(P,pe):A.appendChild(P),this.options.group.revertClone&&this.animate(d,P),m(P,"display",""),ne=!1}}};function To(i){i.dataTransfer&&(i.dataTransfer.dropEffect="move"),i.cancelable&&i.preventDefault()}function je(i,e,t,o,r,a,n,l){var s,c=i[$],h=c.options.onMove,p;return window.CustomEvent&&!te&&!Re?s=new CustomEvent("move",{bubbles:!0,cancelable:!0}):(s=document.createEvent("Event"),s.initEvent("move",!0,!0)),s.to=e,s.from=i,s.dragged=t,s.draggedRect=o,s.related=r||e,s.relatedRect=a||M(e),s.willInsertAfter=l,s.originalEvent=n,i.dispatchEvent(s),h&&(p=h.call(c,s,n)),p}function ut(i){i.draggable=!1}function _o(){bt=!1}function Oo(i,e,t){var o=M(ve(t.el,0,t.options,!0)),r=eo(t.el,t.options,x),a=10;return e?i.clientX<r.left-a||i.clientY<o.top&&i.clientX<o.right:i.clientY<r.top-a||i.clientY<o.bottom&&i.clientX<o.left}function Mo(i,e,t){var o=M(Et(t.el,t.options.draggable)),r=eo(t.el,t.options,x),a=10;return e?i.clientX>r.right+a||i.clientY>o.bottom&&i.clientX>o.left:i.clientY>r.bottom+a||i.clientX>o.right&&i.clientY>o.top}function Ro(i,e,t,o,r,a,n,l){var s=o?i.clientY:i.clientX,c=o?t.height:t.width,h=o?t.top:t.left,p=o?t.bottom:t.right,u=!1;if(!n){if(l&&We<c*r){if(!Me&&(Oe===1?s>h+c*a/2:s<p-c*a/2)&&(Me=!0),Me)u=!0;else if(Oe===1?s<h+We:s>p-We)return-Oe}else if(s>h+c*(1-r)/2&&s<p-c*(1-r)/2)return Bo(e)}return u=u||n,u&&(s<h+c*a/2||s>p-c*a/2)?s>h+c/2?1:-1:0}function Bo(i){return W(d)<W(i)?1:-1}function No(i){for(var e=i.tagName+i.className+i.src+i.href+i.textContent,t=e.length,o=0;t--;)o+=e.charCodeAt(t);return o.toString(36)}function zo(i){Ve.length=0;for(var e=i.getElementsByTagName("input"),t=e.length;t--;){var o=e[t];o.checked&&Ve.push(o)}}function Ue(i){return setTimeout(i,0)}function vt(i){return clearTimeout(i)}Qe&&S(document,"touchmove",function(i){(b.active||ge)&&i.cancelable&&i.preventDefault()});b.utils={on:S,off:E,css:m,find:Vt,is:function(e,t){return!!X(e,t,e,!1)},extend:xo,throttle:Zt,closest:X,toggleClass:H,clone:Jt,index:W,nextTick:Ue,cancelNextTick:vt,detectDirection:oo,getChild:ve,expando:$};b.get=function(i){return i[$]};b.mount=function(){for(var i=arguments.length,e=new Array(i),t=0;t<i;t++)e[t]=arguments[t];e[0].constructor===Array&&(e=e[0]),e.forEach(function(o){if(!o.prototype||!o.prototype.constructor)throw"Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(o));o.utils&&(b.utils=K(K({},b.utils),o.utils)),Be.mount(o)})};b.create=function(i,e){return new b(i,e)};b.version=bo;var O=[],Ae,xt,yt=!1,ft,gt,Ze,Ie;function Lo(){function i(){this.defaults={scroll:!0,forceAutoScrollFallback:!1,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:!0};for(var e in this)e.charAt(0)==="_"&&typeof this[e]=="function"&&(this[e]=this[e].bind(this))}return i.prototype={dragStarted:function(t){var o=t.originalEvent;this.sortable.nativeDraggable?S(document,"dragover",this._handleAutoScroll):this.options.supportPointer?S(document,"pointermove",this._handleFallbackAutoScroll):o.touches?S(document,"touchmove",this._handleFallbackAutoScroll):S(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(t){var o=t.originalEvent;!this.options.dragOverBubble&&!o.rootEl&&this._handleAutoScroll(o)},drop:function(){this.sortable.nativeDraggable?E(document,"dragover",this._handleAutoScroll):(E(document,"pointermove",this._handleFallbackAutoScroll),E(document,"touchmove",this._handleFallbackAutoScroll),E(document,"mousemove",this._handleFallbackAutoScroll)),Xt(),Xe(),yo()},nulling:function(){Ze=xt=Ae=yt=Ie=ft=gt=null,O.length=0},_handleFallbackAutoScroll:function(t){this._handleAutoScroll(t,!0)},_handleAutoScroll:function(t,o){var r=this,a=(t.touches?t.touches[0]:t).clientX,n=(t.touches?t.touches[0]:t).clientY,l=document.elementFromPoint(a,n);if(Ze=t,o||this.options.forceAutoScrollFallback||Re||te||Pe){mt(t,this.options,l,o);var s=se(l,!0);yt&&(!Ie||a!==ft||n!==gt)&&(Ie&&Xt(),Ie=setInterval(function(){var c=se(document.elementFromPoint(a,n),!0);c!==s&&(s=c,Xe()),mt(t,r.options,c,o)},10),ft=a,gt=n)}else{if(!this.options.bubbleScroll||se(l,!0)===Y()){Xe();return}mt(t,this.options,se(l,!1),!1)}}},ee(i,{pluginName:"scroll",initializeByDefault:!0})}function Xe(){O.forEach(function(i){clearInterval(i.pid)}),O=[]}function Xt(){clearInterval(Ie)}var mt=Zt(function(i,e,t,o){if(e.scroll){var r=(i.touches?i.touches[0]:i).clientX,a=(i.touches?i.touches[0]:i).clientY,n=e.scrollSensitivity,l=e.scrollSpeed,s=Y(),c=!1,h;xt!==t&&(xt=t,Xe(),Ae=e.scroll,h=e.scrollFn,Ae===!0&&(Ae=se(t,!0)));var p=0,u=Ae;do{var v=u,f=M(v),y=f.top,I=f.bottom,D=f.left,g=f.right,w=f.width,C=f.height,k=void 0,_=void 0,V=v.scrollWidth,xe=v.scrollHeight,j=m(v),ye=v.scrollLeft,oe=v.scrollTop;v===s?(k=w<V&&(j.overflowX==="auto"||j.overflowX==="scroll"||j.overflowX==="visible"),_=C<xe&&(j.overflowY==="auto"||j.overflowY==="scroll"||j.overflowY==="visible")):(k=w<V&&(j.overflowX==="auto"||j.overflowX==="scroll"),_=C<xe&&(j.overflowY==="auto"||j.overflowY==="scroll"));var we=k&&(Math.abs(g-r)<=n&&ye+w<V)-(Math.abs(D-r)<=n&&!!ye),Z=_&&(Math.abs(I-a)<=n&&oe+C<xe)-(Math.abs(y-a)<=n&&!!oe);if(!O[p])for(var le=0;le<=p;le++)O[le]||(O[le]={});(O[p].vx!=we||O[p].vy!=Z||O[p].el!==v)&&(O[p].el=v,O[p].vx=we,O[p].vy=Z,clearInterval(O[p].pid),(we!=0||Z!=0)&&(c=!0,O[p].pid=setInterval(function(){o&&this.layer===0&&b.active._onTouchMove(Ze);var Ee=O[this.layer].vy?O[this.layer].vy*l:0,ie=O[this.layer].vx?O[this.layer].vx*l:0;typeof h=="function"&&h.call(b.dragged.parentNode[$],ie,Ee,i,Ze,O[this.layer].el)!=="continue"||Qt(O[this.layer].el,ie,Ee)}.bind({layer:p}),24))),p++}while(e.bubbleScroll&&u!==s&&(u=se(u,!1)));yt=c}},30),no=function(e){var t=e.originalEvent,o=e.putSortable,r=e.dragEl,a=e.activeSortable,n=e.dispatchSortableEvent,l=e.hideGhostForTarget,s=e.unhideGhostForTarget;if(t){var c=o||a;l();var h=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:t,p=document.elementFromPoint(h.clientX,h.clientY);s(),c&&!c.el.contains(p)&&(n("spill"),this.onSpill({dragEl:r,putSortable:o}))}};function St(){}St.prototype={startIndex:null,dragStart:function(e){var t=e.oldDraggableIndex;this.startIndex=t},onSpill:function(e){var t=e.dragEl,o=e.putSortable;this.sortable.captureAnimationState(),o&&o.captureAnimationState();var r=ve(this.sortable.el,this.startIndex,this.options);r?this.sortable.el.insertBefore(t,r):this.sortable.el.appendChild(t),this.sortable.animateAll(),o&&o.animateAll()},drop:no};ee(St,{pluginName:"revertOnSpill"});function Ct(){}Ct.prototype={onSpill:function(e){var t=e.dragEl,o=e.putSortable,r=o||this.sortable;r.captureAnimationState(),t.parentNode&&t.parentNode.removeChild(t),r.animateAll()},drop:no};ee(Ct,{pluginName:"removeOnSpill"});b.mount(new Lo);b.mount(Ct,St);var so=b;var lo=`
|
|
2
2
|
.cropper-container {
|
|
3
3
|
direction: ltr;
|
|
4
4
|
font-size: 0;
|
|
@@ -283,9 +283,9 @@ import{j as R,k as Bt,q as nt}from"./chunk-HS6GDZIS.js";import{a as re,b as O,c
|
|
|
283
283
|
.cropper-disabled .cropper-point {
|
|
284
284
|
cursor: not-allowed;
|
|
285
285
|
}
|
|
286
|
-
`;var Je=class extends HTMLElement{#e=[];#t=null;#
|
|
286
|
+
`;var Je=class extends HTMLElement{#e=[];#t=null;#c=null;#d=null;#r=!1;#o=null;#h=new Set;#u=null;#a=!0;#l=!0;constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){this.#r||(this.#b(),this.#r=!0),this.#i()}disconnectedCallback(){if(this.#c){try{this.#c.destroy()}catch(o){console.warn("Error destroying Sortable:",o)}this.#c=null}if(this.#t){try{this.#t.destroy()}catch(o){console.warn("Error destroying Cropper:",o)}this.#t=null}this.#d=null,this.stopCamera(),this.#f(),this.#o&&(this.#o.abort(),this.#o=null);let e=this.shadowRoot.querySelector(".file-input"),t=this.shadowRoot.querySelector(".camera-input");e&&(e.onchange=null),t&&(t.onchange=null),this.#r=!1}setCameraStream(e){this.stopCamera(),this.#u=e||null}stopCamera(){if(this.#u){try{(typeof this.#u.getTracks=="function"?this.#u.getTracks():[]).forEach(t=>{typeof t.stop=="function"&&t.stop()})}catch(e){console.warn("Error stopping camera tracks:",e)}this.#u=null}}#p(e){return e&&typeof e=="string"&&e.startsWith("blob:")&&this.#h.add(e),e}#m(e){if(this.#h.has(e)){try{URL.revokeObjectURL(e)}catch{}this.#h.delete(e)}}#f(){for(let e of this.#h)try{URL.revokeObjectURL(e)}catch{}this.#h.clear()}#b(){let e=`
|
|
287
287
|
<style>
|
|
288
|
-
${
|
|
288
|
+
${lo}
|
|
289
289
|
</style>
|
|
290
290
|
<style>
|
|
291
291
|
.container {
|
|
@@ -431,40 +431,6 @@ import{j as R,k as Bt,q as nt}from"./chunk-HS6GDZIS.js";import{a as re,b as O,c
|
|
|
431
431
|
padding: 0.5rem 0.75rem;
|
|
432
432
|
}
|
|
433
433
|
}
|
|
434
|
-
.markdown-card {
|
|
435
|
-
width: 100%;
|
|
436
|
-
height: 100%;
|
|
437
|
-
border: 1px solid #334155;
|
|
438
|
-
border-radius: 4px;
|
|
439
|
-
background: #0f172a;
|
|
440
|
-
color: #f8fafc;
|
|
441
|
-
padding: 10px;
|
|
442
|
-
box-sizing: border-box;
|
|
443
|
-
font-family: monospace;
|
|
444
|
-
font-size: 0.72rem;
|
|
445
|
-
overflow: hidden;
|
|
446
|
-
display: flex;
|
|
447
|
-
flex-direction: column;
|
|
448
|
-
}
|
|
449
|
-
.markdown-card-header {
|
|
450
|
-
display: flex;
|
|
451
|
-
align-items: center;
|
|
452
|
-
gap: 4px;
|
|
453
|
-
font-weight: bold;
|
|
454
|
-
font-size: 0.75rem;
|
|
455
|
-
color: #38bdf8;
|
|
456
|
-
margin-bottom: 6px;
|
|
457
|
-
white-space: nowrap;
|
|
458
|
-
overflow: hidden;
|
|
459
|
-
text-overflow: ellipsis;
|
|
460
|
-
}
|
|
461
|
-
.markdown-card-body {
|
|
462
|
-
flex: 1;
|
|
463
|
-
opacity: 0.8;
|
|
464
|
-
word-break: break-word;
|
|
465
|
-
overflow: hidden;
|
|
466
|
-
line-height: 1.35;
|
|
467
|
-
}
|
|
468
434
|
button.add-btn {
|
|
469
435
|
width: 100%;
|
|
470
436
|
aspect-ratio: 1;
|
|
@@ -497,17 +463,9 @@ import{j as R,k as Bt,q as nt}from"./chunk-HS6GDZIS.js";import{a as re,b as O,c
|
|
|
497
463
|
${e}
|
|
498
464
|
<div class="container"></div>
|
|
499
465
|
|
|
500
|
-
<input type="file" class="file-input" accept="image/*,application/pdf
|
|
466
|
+
<input type="file" class="file-input" accept="image/*,application/pdf" multiple style="display: none">
|
|
501
467
|
<input type="file" class="camera-input" accept="image/*" capture="environment" style="display: none">
|
|
502
468
|
|
|
503
|
-
<sl-dialog label="Edit Markdown Text" class="text-dialog" style="--width: min(92%, 560px)">
|
|
504
|
-
<div style="margin-bottom: 1rem;">
|
|
505
|
-
<sl-textarea class="text-editor" rows="12" placeholder="Enter markdown content..."></sl-textarea>
|
|
506
|
-
</div>
|
|
507
|
-
<sl-button slot="footer" variant="default" class="cancel-text">Cancel</sl-button>
|
|
508
|
-
<sl-button slot="footer" variant="primary" class="apply-text">Save Text</sl-button>
|
|
509
|
-
</sl-dialog>
|
|
510
|
-
|
|
511
469
|
<sl-dialog label="Image Data" class="data-dialog">
|
|
512
470
|
<div class="exif-data" style="font-size: 0.85rem; line-height: 1.6;"></div>
|
|
513
471
|
<sl-button slot="footer" variant="primary" class="close-data">Close</sl-button>
|
|
@@ -520,30 +478,10 @@ import{j as R,k as Bt,q as nt}from"./chunk-HS6GDZIS.js";import{a as re,b as O,c
|
|
|
520
478
|
<sl-button slot="footer" variant="default" class="cancel-crop">Cancel</sl-button>
|
|
521
479
|
<sl-button slot="footer" variant="primary" class="apply-crop">Apply</sl-button>
|
|
522
480
|
</sl-dialog>
|
|
523
|
-
`,this.#
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
<sl-icon name="file-earmark-text"></sl-icon> ${p}
|
|
528
|
-
</div>
|
|
529
|
-
<div class="markdown-card-body">${d}</div>
|
|
530
|
-
</div>
|
|
531
|
-
<sl-dropdown class="image-menu" data-index="${s}">
|
|
532
|
-
<sl-button slot="trigger" variant="default" size="small" circle>
|
|
533
|
-
<sl-icon name="three-dots-vertical"></sl-icon>
|
|
534
|
-
</sl-button>
|
|
535
|
-
<sl-menu>
|
|
536
|
-
<sl-menu-item value="edittext">Edit Text</sl-menu-item>
|
|
537
|
-
<sl-menu-item value="download">Download Markdown</sl-menu-item>
|
|
538
|
-
<sl-divider></sl-divider>
|
|
539
|
-
<sl-menu-item value="delete">Delete</sl-menu-item>
|
|
540
|
-
</sl-menu>
|
|
541
|
-
</sl-dropdown>
|
|
542
|
-
</div>
|
|
543
|
-
`}let l=Pt(n.edits),c=n.edits?.filter==="bw";return`
|
|
544
|
-
<div class="image-wrapper" data-index="${s}">
|
|
545
|
-
<img src="${n.src}" draggable="false">
|
|
546
|
-
<sl-dropdown class="image-menu" data-index="${s}">
|
|
481
|
+
`,this.#o&&this.#o.abort(),this.#o=new AbortController;let{signal:t}=this.#o,o=this.shadowRoot.querySelector(".close-data");o&&o.addEventListener("click",()=>{this.shadowRoot.querySelector(".data-dialog")?.hide()},{signal:t});let r=this.shadowRoot.querySelector(".file-input"),a=this.shadowRoot.querySelector(".camera-input"),n=!1,l=async g=>{if(n)return;let w=Array.from(g.target?.files||[]);if(w.length!==0){n=!0;try{await this.addFiles(w)}finally{g.target&&(g.target.value=""),n=!1}}};r&&(r.onchange=l,r.addEventListener("change",l,{signal:t})),a&&(a.onchange=l,a.addEventListener("change",l,{signal:t}));let s=0,c=g=>{let w=g.dataTransfer;if(!w)return!1;if(!w.types||w.types.length===0)return!0;let C=Array.from(w.types);return C.includes("Files")||C.some(k=>k.startsWith("image/")||k.startsWith("public.")||k.includes("pdf")||k.includes("file")||k==="text/uri-list")},h=g=>{c(g)&&(g.preventDefault(),s++,f.classList.add("drag-over"))},p=g=>{c(g)&&(g.preventDefault(),g.stopPropagation(),g.dataTransfer&&(g.dataTransfer.dropEffect="copy"),f.classList.add("drag-over"))},u=()=>{s--,s<=0&&(s=0,f.classList.remove("drag-over"))},v=async g=>{s=0,f.classList.remove("drag-over"),g.preventDefault(),g.stopPropagation();let w=[];if(g.dataTransfer?.files?.length>0)w=Array.from(g.dataTransfer.files);else if(g.dataTransfer?.items?.length>0){for(let C of g.dataTransfer.items)if(C.kind==="file"){let k=C.getAsFile();k&&w.push(k)}}else g.detail?.files&&(w=Array.from(g.detail.files));w.length>0&&await this.addFiles(w)},f=this.shadowRoot.querySelector(".container");f&&(f.addEventListener("dragenter",h,{signal:t}),f.addEventListener("dragover",p,{signal:t}),f.addEventListener("dragleave",u,{signal:t}),f.addEventListener("drop",v,{signal:t}),f.addEventListener("dragend",()=>{s=0,f.classList.remove("drag-over")},{signal:t}),f.addEventListener("click",g=>{g.target===f&&r?.click()},{signal:t}));let y=this.shadowRoot.querySelector(".cancel-crop"),I=this.shadowRoot.querySelector(".apply-crop");y&&y.addEventListener("click",()=>this.closeCropDialog(),{signal:t}),I&&I.addEventListener("click",()=>this.applyCrop(),{signal:t});let D=this.shadowRoot.querySelector(".crop-dialog");D&&D.addEventListener("sl-hide",()=>{this.#t&&(this.#t.destroy(),this.#t=null),this.#d=null},{signal:t})}#i(){let e=this.shadowRoot.querySelector(".container");if(!e)return;let t=this.#e.map((a,n)=>{let l=Tt(a.edits),s=a.edits?.filter==="bw";return`
|
|
482
|
+
<div class="image-wrapper" data-index="${n}">
|
|
483
|
+
<img src="${a.src}" draggable="false">
|
|
484
|
+
<sl-dropdown class="image-menu" data-index="${n}">
|
|
547
485
|
<sl-button slot="trigger" variant="default" size="small" circle>
|
|
548
486
|
<sl-icon name="three-dots-vertical"></sl-icon>
|
|
549
487
|
</sl-button>
|
|
@@ -557,8 +495,8 @@ import{j as R,k as Bt,q as nt}from"./chunk-HS6GDZIS.js";import{a as re,b as O,c
|
|
|
557
495
|
<sl-menu-item value="crop">Crop</sl-menu-item>
|
|
558
496
|
<sl-menu-item value="rotate">Rotate</sl-menu-item>
|
|
559
497
|
<sl-menu-item value="threshold">
|
|
560
|
-
<sl-icon slot="prefix" name="${
|
|
561
|
-
${
|
|
498
|
+
<sl-icon slot="prefix" name="${s?"check-lg":"circle"}"></sl-icon>
|
|
499
|
+
${s?"Remove Black & White":"Black & White"}
|
|
562
500
|
</sl-menu-item>
|
|
563
501
|
<sl-menu-item value="reset" ?disabled=${!l}>
|
|
564
502
|
<sl-icon slot="prefix" name="arrow-counterclockwise"></sl-icon>
|
|
@@ -573,16 +511,13 @@ import{j as R,k as Bt,q as nt}from"./chunk-HS6GDZIS.js";import{a as re,b as O,c
|
|
|
573
511
|
</div>
|
|
574
512
|
`}).join("");e.innerHTML=`
|
|
575
513
|
${t}
|
|
576
|
-
<button class="add-btn add-image-btn" title="Add image
|
|
514
|
+
<button class="add-btn add-image-btn" title="Add image or PDF" aria-label="Add image or PDF">
|
|
577
515
|
<sl-icon name="plus-lg"></sl-icon>
|
|
578
516
|
</button>
|
|
579
517
|
<button class="add-btn add-camera-btn" title="Capture from camera" aria-label="Capture from camera">
|
|
580
518
|
<sl-icon name="camera"></sl-icon>
|
|
581
519
|
</button>
|
|
582
|
-
|
|
583
|
-
<sl-icon name="file-earmark-plus"></sl-icon>
|
|
584
|
-
</button>
|
|
585
|
-
`;let o=e.querySelector(".add-image-btn");o&&(o.onclick=()=>{this.shadowRoot.querySelector(".file-input").click()});let r=e.querySelector(".add-camera-btn");r&&(r.onclick=()=>{this.shadowRoot.querySelector(".camera-input").click()});let a=e.querySelector(".add-note-btn");a&&(a.onclick=()=>{this.addBlankNote()}),e.querySelectorAll(".image-menu").forEach(n=>{n.querySelector("sl-menu").addEventListener("sl-select",l=>{l.stopPropagation();let c=parseInt(n.dataset.index),p=l.detail.item.value;if(p==="ocr")n.hide(),this.dispatchEvent(new CustomEvent("copio:ocr-page",{bubbles:!0,composed:!0,detail:{page:this.#e[c],pageIndex:c}}));else if(p==="crop")n.hide(),this.openCropDialog(c);else if(p==="rotate")this.rotateImage(c);else if(p==="threshold")this.thresholdImage(c);else if(p==="reset")n.hide(),this.resetImage(c);else if(p==="showdata")n.hide(),this.showImageData(c);else if(p==="edittext")n.hide(),this.openTextDialog(c);else if(p==="download")this.downloadImage(c);else if(p==="delete"){let[d]=this.#e.splice(c,1);this.#o();let u=d.name||(d.type==="markdown"?"Markdown Note":`Page ${c+1}`);Y.undo(`Deleted ${u}`,()=>{this.#e.splice(c,0,d),this.#o(),Y.success(`Restored ${u}`)},{duration:5e3})}})}),this.#x(e)}#x(e){if(this.#s){try{this.#s.destroy()}catch(t){console.warn("Error destroying Sortable:",t)}this.#s=null}this.#s=no.create(e,{animation:150,draggable:".image-wrapper",chosenClass:"dragging",ghostClass:"sortable-ghost",filter:"sl-dropdown",preventOnFilter:!1,delay:150,delayOnTouchOnly:!0,touchStartThreshold:5,onEnd:t=>{if(t.to!==e)return;let o=t.oldDraggableIndex,r=t.newDraggableIndex;if(o===r)return;let a=this.#e[o];this.#e.splice(o,1),this.#e.splice(r,0,a),this.#o()}})}async openCropDialog(e){this.#d=e;let t=this.#e[e];if(!t||t.type==="markdown")return;let o=this.shadowRoot.querySelector(".crop-dialog"),r=this.shadowRoot.querySelector("#crop-image");t.originalSrc=t.originalSrc||t.src,t.edits=ue(t.edits),r.src=t.originalSrc,o.show();let a=await Rt(),n=t.edits?.crop,s=()=>{this.#t&&this.#t.destroy(),this.#t=new a(r,{viewMode:1,autoCropArea:.88,responsive:!0,ready:()=>{if(n)try{if(n.width>0&&n.height>0)this.#t.setData({x:n.x,y:n.y,width:n.width,height:n.height});else if(n.normalized&&n.normalized.w>0){let l=this.#t.getImageData();this.#t.setData({x:Math.round(n.normalized.x*l.naturalWidth),y:Math.round(n.normalized.y*l.naturalHeight),width:Math.round(n.normalized.w*l.naturalWidth),height:Math.round(n.normalized.h*l.naturalHeight)})}else if(typeof n.w=="number"&&n.w>0){let l=this.#t.getImageData();this.#t.setData({x:Math.round(n.x*l.naturalWidth),y:Math.round(n.y*l.naturalHeight),width:Math.round(n.w*l.naturalWidth),height:Math.round(n.h*l.naturalHeight)})}}catch(l){console.warn("Failed restoring prior crop box:",l)}}})};r.onload=s,r.complete&&r.naturalWidth>0&&!this.#t&&s()}closeCropDialog(){let e=this.shadowRoot.querySelector(".crop-dialog"),t=this.shadowRoot.querySelector("#crop-image");if(t&&(t.onload=null),this.#t){try{this.#t.destroy()}catch(o){console.warn("Error destroying Cropper:",o)}this.#t=null}this.#d=null,e?.hide()}applyCrop(){if(this.#t&&this.#d!==null){let e=this.#e[this.#d];if(!e)return;e.originalSrc=e.originalSrc||e.src||"";let t=this.#t.getData(!0),o=this.#t.getImageData(),r=o?.naturalWidth||1,a=o?.naturalHeight||1,n=Math.max(0,Math.min(1,t.x/r)),s=Math.max(0,Math.min(1,t.y/a)),l=Math.max(0,Math.min(1,t.width/r)),c=Math.max(0,Math.min(1,t.height/a));e.edits={...ue(e.edits),crop:{x:Math.round(t.x),y:Math.round(t.y),width:Math.round(t.width),height:Math.round(t.height),normalized:{x:Number(n.toFixed(4)),y:Number(s.toFixed(4)),w:Number(l.toFixed(4)),h:Number(c.toFixed(4))}}};let p=this.#t.getCroppedCanvas();if(p){let d=Mt(p,{crop:null,rotation:e.edits.rotation,filter:e.edits.filter}),u=e.originalSrc.startsWith("data:image/png"),v=u?"image/png":"image/jpeg";e.src=d.toDataURL(v,u?void 0:.82)}this.#o(),this.closeCropDialog()}}async rotateImage(e){let t=this.#e[e];!t||t.type==="markdown"||(t.originalSrc=t.originalSrc||t.src,t.edits={...ue(t.edits),rotation:((t.edits?.rotation||0)+90)%360},t.src=await at(t.originalSrc,t.edits),this.#o())}async thresholdImage(e){let t=this.#e[e];if(!t||t.type==="markdown")return;t.originalSrc=t.originalSrc||t.src;let o=t.edits?.filter==="bw";t.edits={...ue(t.edits),filter:o?"none":"bw"},t.src=await at(t.originalSrc,t.edits),this.#o(),o?Y.info("Restored color (removed B&W filter)"):Y.success("Applied B&W threshold filter")}resetImage(e){let t=this.#e[e];!t||t.type==="markdown"||(t.edits={crop:null,rotation:0,filter:"none"},t.src=t.originalSrc||t.src,this.#o(),Y.success("Reset page to original"))}addBlankNote(){let e={id:ce(),type:"markdown",name:"New Note",content:""};this.#e.push(e),this.#o(),this.openTextDialog(this.#e.length-1)}downloadImage(e){let t=this.#e[e];if(!t)return;if(t.type==="markdown"){let n=new Blob([t.content||""],{type:"text/markdown;charset=utf-8"}),s=this.#m(URL.createObjectURL(n)),l=document.createElement("a"),c=t.name||`document-${e+1}.md`;l.href=s,l.download=c,l.click(),this.#f(s),Y.success(`Downloaded "${c}"`);return}if(!t.src)return;let o="jpg";if(t.src.startsWith("data:")){let n=t.src.match(/^data:(image\/[a-zA-Z+]+);base64,/);n&&n[1].includes("png")&&(o="png")}let r=document.createElement("a"),a=`image-${e+1}.${o}`;r.href=t.src,r.download=a,r.click(),Y.success(`Downloaded "${a}"`)}openTextDialog(e){this.#r=e;let t=this.shadowRoot.querySelector(".text-dialog"),o=this.shadowRoot.querySelector(".text-editor");o.value=this.#e[e].content||"",t.label=this.#e[e].name||"Note",t.show()}applyTextEdit(){if(this.#r!==null&&this.#e[this.#r]){let e=this.shadowRoot.querySelector(".text-editor");this.#e[this.#r].content=e.value,this.#o(),this.closeTextDialog()}}closeTextDialog(){let e=this.shadowRoot.querySelector(".text-dialog");this.#r=null,e.hide()}showImageData(e){let{src:t,exif:o}=this.#e[e],r=this.shadowRoot.querySelector(`img[src="${t}"]`),a=[];if(a.push(`<strong>Dimensions:</strong> ${r?`${r.naturalWidth} \xD7 ${r.naturalHeight}`:"unknown"}`),o){let n=new Set(["MakerNote","UserComment","FlashPixVersion","ExifVersion","ComponentsConfiguration","SceneType","thumbnail"]);for(let[s,l]of Object.entries(o)){if(n.has(s)||l===void 0||l===null)continue;let c=l instanceof Array?l.join(", "):String(l);c.length>200||a.push(`<strong>${s}:</strong> ${c}`)}}else a.push("<em>No EXIF data available</em>");this.shadowRoot.querySelector(".exif-data").innerHTML=a.join("<br>"),this.shadowRoot.querySelector(".data-dialog").show()}async pdfToImages(e){let t=await e.arrayBuffer();return(await Nt(t)).map(r=>({id:ce(),src:r,originalSrc:r,edits:{crop:null,rotation:0,filter:"none"}}))}async addFiles(e){if(!e||e.length===0)return;let t=[];try{for(let r of e)if(r.type==="application/pdf"){let a=await this.pdfToImages(r);t.push(...a)}else if(r.name?.endsWith(".md")||r.name?.endsWith(".markdown")||r.type==="text/markdown"||r.type==="text/plain"){let a=await r.text();t.push({id:ce(),type:"markdown",name:r.name,content:a})}else{let[a,n]=await Promise.all([Tt(r),It(r)]);t.push({id:ce(),src:a,originalSrc:a,edits:{crop:null,rotation:0,filter:"none"},exif:n})}this.#e.push(...t),this.#o();let o=t.length;Y.success(`Imported ${o} page${o!==1?"s":""}`)}catch(o){console.error("Failed to import files:",o),Y.error("Failed to import files")}}get ocr(){return this.#l!==!1}set ocr(e){this.#l=!!e,this.#i&&this.#o()}get pdf(){return this.#c!==!1}set pdf(e){this.#c=!!e,this.#i&&this.#o()}get images(){return this.#e}set images(e){let t=Array.isArray(e)?e:[];this.#e=t.map(o=>!o||o.type==="markdown"?o:{...o,originalSrc:o.originalSrc||o.src||"",edits:ue(o.edits)}),this.#i&&this.#o()}};customElements.define("copio-images",Je);var et=class extends K{disconnectedCallback(){super.disconnectedCallback(),this.activeSlideIndex=0}updated(e){super.updated(e),e.has("images")&&Array.isArray(this.images)&&this.images.some(t=>t.type==="markdown")&&(!window.marked||!window.marked.parse)&&Ot().then(()=>this.requestUpdate())}static properties={docId:{type:String},docName:{type:String},images:{type:Array},activeSlideIndex:{type:Number,state:!0},ocr:{type:Boolean},pdf:{type:Boolean}};get hasImages(){return(this.images||[]).some(e=>e.type!=="markdown"&&!!e.src)}get hasMarkdown(){return(this.images||[]).some(e=>e.type==="markdown")}get pageCount(){return(this.images||[]).length}static styles=re`
|
|
520
|
+
`;let o=e.querySelector(".add-image-btn");o&&(o.onclick=()=>{this.shadowRoot.querySelector(".file-input").click()});let r=e.querySelector(".add-camera-btn");r&&(r.onclick=()=>{this.shadowRoot.querySelector(".camera-input").click()}),e.querySelectorAll(".image-menu").forEach(a=>{a.querySelector("sl-menu").addEventListener("sl-select",l=>{l.stopPropagation();let s=parseInt(a.dataset.index),c=l.detail.item.value;if(c==="ocr")a.hide(),this.dispatchEvent(new CustomEvent("copio:ocr-page",{bubbles:!0,composed:!0,detail:{page:this.#e[s],pageIndex:s}}));else if(c==="crop")a.hide(),this.openCropDialog(s);else if(c==="rotate")this.rotateImage(s);else if(c==="threshold")this.thresholdImage(s);else if(c==="reset")a.hide(),this.resetImage(s);else if(c==="showdata")a.hide(),this.showImageData(s);else if(c==="download")this.downloadImage(s);else if(c==="delete"){let[h]=this.#e.splice(s,1);this.#i();let p=h.name||`Page ${s+1}`;Q.undo(`Deleted ${p}`,()=>{this.#e.splice(s,0,h),this.#i(),Q.success(`Restored ${p}`)},{duration:5e3})}})}),this.#n(e)}#n(e){if(this.#c){try{this.#c.destroy()}catch(t){console.warn("Error destroying Sortable:",t)}this.#c=null}this.#c=so.create(e,{animation:150,draggable:".image-wrapper",chosenClass:"dragging",ghostClass:"sortable-ghost",filter:"sl-dropdown",preventOnFilter:!1,delay:150,delayOnTouchOnly:!0,touchStartThreshold:5,onEnd:t=>{if(t.to!==e)return;let o=t.oldDraggableIndex,r=t.newDraggableIndex;if(o===r)return;let a=this.#e[o];this.#e.splice(o,1),this.#e.splice(r,0,a),this.#i()}})}async openCropDialog(e){this.#d=e;let t=this.#e[e];if(!t)return;let o=this.shadowRoot.querySelector(".crop-dialog"),r=this.shadowRoot.querySelector("#crop-image");t.originalSrc=t.originalSrc||t.src,t.edits=he(t.edits),r.src=t.originalSrc,o.show();let a=await Mt(),n=t.edits?.crop,l=()=>{this.#t&&this.#t.destroy(),this.#t=new a(r,{viewMode:1,autoCropArea:.88,responsive:!0,ready:()=>{if(n)try{if(n.width>0&&n.height>0)this.#t.setData({x:n.x,y:n.y,width:n.width,height:n.height});else if(n.normalized&&n.normalized.w>0){let s=this.#t.getImageData();this.#t.setData({x:Math.round(n.normalized.x*s.naturalWidth),y:Math.round(n.normalized.y*s.naturalHeight),width:Math.round(n.normalized.w*s.naturalWidth),height:Math.round(n.normalized.h*s.naturalHeight)})}else if(typeof n.w=="number"&&n.w>0){let s=this.#t.getImageData();this.#t.setData({x:Math.round(n.x*s.naturalWidth),y:Math.round(n.y*s.naturalHeight),width:Math.round(n.w*s.naturalWidth),height:Math.round(n.h*s.naturalHeight)})}}catch(s){console.warn("Failed restoring prior crop box:",s)}}})};r.onload=l,r.complete&&r.naturalWidth>0&&!this.#t&&l()}closeCropDialog(){let e=this.shadowRoot.querySelector(".crop-dialog"),t=this.shadowRoot.querySelector("#crop-image");if(t&&(t.onload=null),this.#t){try{this.#t.destroy()}catch(o){console.warn("Error destroying Cropper:",o)}this.#t=null}this.#d=null,e?.hide()}applyCrop(){if(this.#t&&this.#d!==null){let e=this.#e[this.#d];if(!e)return;e.originalSrc=e.originalSrc||e.src||"";let t=this.#t.getData(!0),o=this.#t.getImageData(),r=o?.naturalWidth||1,a=o?.naturalHeight||1,n=Math.max(0,Math.min(1,t.x/r)),l=Math.max(0,Math.min(1,t.y/a)),s=Math.max(0,Math.min(1,t.width/r)),c=Math.max(0,Math.min(1,t.height/a));e.edits={...he(e.edits),crop:{x:Math.round(t.x),y:Math.round(t.y),width:Math.round(t.width),height:Math.round(t.height),normalized:{x:Number(n.toFixed(4)),y:Number(l.toFixed(4)),w:Number(s.toFixed(4)),h:Number(c.toFixed(4))}}};let h=this.#t.getCroppedCanvas();if(h){let p=_t(h,{crop:null,rotation:e.edits.rotation,filter:e.edits.filter}),u=typeof e.originalSrc=="string"&&e.originalSrc.startsWith("data:image/png")||e.originalBlob?.type==="image/png"||e.mimeType==="image/png",v=u?"image/png":"image/jpeg";e.src=p.toDataURL(v,u?void 0:.82)}this.#i(),this.closeCropDialog()}}async rotateImage(e){let t=this.#e[e];t&&(t.originalSrc=t.originalSrc||t.src,t.edits={...he(t.edits),rotation:((t.edits?.rotation||0)+90)%360},t.src=await at(t.originalSrc,t.edits),this.#i())}async thresholdImage(e){let t=this.#e[e];if(!t)return;t.originalSrc=t.originalSrc||t.src;let o=t.edits?.filter==="bw";t.edits={...he(t.edits),filter:o?"none":"bw"},t.src=await at(t.originalSrc,t.edits),this.#i(),o?Q.info("Restored color (removed B&W filter)"):Q.success("Applied B&W threshold filter")}resetImage(e){let t=this.#e[e];t&&(t.edits={crop:null,rotation:0,filter:"none"},t.src=t.originalSrc||t.src,this.#i(),Q.success("Reset page to original"))}downloadImage(e){let t=this.#e[e];if(!t)return;let o="jpg",r=t.src,a=!1;if(t.blob instanceof Blob)t.blob.type&&t.blob.type.includes("png")&&(o="png"),r=this.#p(URL.createObjectURL(t.blob)),a=!0;else if(t.src){if(t.src.startsWith("data:")){let s=t.src.match(/^data:(image\/[a-zA-Z+]+);base64,/);s&&s[1].includes("png")&&(o="png")}}else return;let n=document.createElement("a"),l=`image-${e+1}.${o}`;n.href=r,n.download=l,n.click(),a&&this.#m(r),Q.success(`Downloaded "${l}"`)}showImageData(e){let{src:t,exif:o}=this.#e[e],r=this.shadowRoot.querySelector(`img[src="${t}"]`),a=[];if(a.push(`<strong>Dimensions:</strong> ${r?`${r.naturalWidth} \xD7 ${r.naturalHeight}`:"unknown"}`),o){let n=new Set(["MakerNote","UserComment","FlashPixVersion","ExifVersion","ComponentsConfiguration","SceneType","thumbnail"]);for(let[l,s]of Object.entries(o)){if(n.has(l)||s===void 0||s===null)continue;let c=s instanceof Array?s.join(", "):String(s);c.length>200||a.push(`<strong>${l}:</strong> ${c}`)}}else a.push("<em>No EXIF data available</em>");this.shadowRoot.querySelector(".exif-data").innerHTML=a.join("<br>"),this.shadowRoot.querySelector(".data-dialog").show()}async pdfToImages(e){let t=await e.arrayBuffer();return(await zt(t)).map(r=>({id:Ce(),src:r,originalSrc:r,edits:{crop:null,rotation:0,filter:"none"}}))}async addFiles(e){if(!e||e.length===0)return;let t=[];try{for(let r of e)if(r.type==="application/pdf"){let a=await this.pdfToImages(r);t.push(...a)}else{let[a,n]=await Promise.all([Pt(r),It(r)]);t.push({id:Ce(),src:a,originalSrc:a,edits:{crop:null,rotation:0,filter:"none"},exif:n})}this.#e.push(...t),this.#i();let o=t.length;Q.success(`Imported ${o} page${o!==1?"s":""}`)}catch(o){console.error("Failed to import files:",o),Q.error("Failed to import files")}}get ocr(){return this.#a!==!1}set ocr(e){this.#a=!!e,this.#r&&this.#i()}get pdf(){return this.#l!==!1}set pdf(e){this.#l=!!e,this.#r&&this.#i()}get images(){return this.#e}set images(e){let t=Array.isArray(e)?e:[];this.#e=t.map(o=>o&&{...o,originalSrc:o.originalSrc||o.src||"",edits:he(o.edits)}),this.#r&&this.#i()}};customElements.define("copio-images",Je);var et=class extends G{disconnectedCallback(){super.disconnectedCallback(),this.activeSlideIndex=0}static properties={docId:{type:String},docName:{type:String},images:{type:Array},activeSlideIndex:{type:Number,state:!0},ocr:{type:Boolean},pdf:{type:Boolean}};get visibleImages(){return this.images||[]}get hasImages(){return(this.images||[]).some(e=>!!e.src)}get pageCount(){return this.visibleImages.length}static styles=re`
|
|
586
521
|
:host {
|
|
587
522
|
display: block;
|
|
588
523
|
position: absolute;
|
|
@@ -693,87 +628,11 @@ import{j as R,k as Bt,q as nt}from"./chunk-HS6GDZIS.js";import{a as re,b as O,c
|
|
|
693
628
|
background: rgba(15, 23, 42, 0.95);
|
|
694
629
|
border-color: rgba(255, 255, 255, 0.4);
|
|
695
630
|
}
|
|
696
|
-
|
|
697
|
-
width: 100%;
|
|
698
|
-
height: 100%;
|
|
699
|
-
box-sizing: border-box;
|
|
700
|
-
padding: 60px 24px 24px 24px;
|
|
701
|
-
overflow-y: auto;
|
|
702
|
-
background: #151f2a;
|
|
703
|
-
color: #f8fafc;
|
|
704
|
-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
|
|
705
|
-
line-height: 1.6;
|
|
706
|
-
}
|
|
707
|
-
.markdown-body {
|
|
708
|
-
max-width: 800px;
|
|
709
|
-
margin: 0 auto;
|
|
710
|
-
}
|
|
711
|
-
.markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4 {
|
|
712
|
-
color: #f1f5f9;
|
|
713
|
-
margin-top: 1.5em;
|
|
714
|
-
margin-bottom: 0.5em;
|
|
715
|
-
font-weight: 600;
|
|
716
|
-
line-height: 1.25;
|
|
717
|
-
border-bottom: 1px solid rgba(255,255,255,0.1);
|
|
718
|
-
padding-bottom: 0.3em;
|
|
719
|
-
}
|
|
720
|
-
.markdown-body h1 { font-size: 2em; }
|
|
721
|
-
.markdown-body h2 { font-size: 1.5em; }
|
|
722
|
-
.markdown-body h3 { font-size: 1.25em; }
|
|
723
|
-
.markdown-body p { margin-top: 0; margin-bottom: 1em; }
|
|
724
|
-
.markdown-body ul, .markdown-body ol { padding-left: 2em; margin-bottom: 1em; }
|
|
725
|
-
.markdown-body li { margin-bottom: 0.3em; }
|
|
726
|
-
.markdown-body code {
|
|
727
|
-
background: rgba(255,255,255,0.1);
|
|
728
|
-
padding: 0.2em 0.4em;
|
|
729
|
-
border-radius: 4px;
|
|
730
|
-
font-family: monospace;
|
|
731
|
-
font-size: 0.9em;
|
|
732
|
-
}
|
|
733
|
-
.markdown-body pre {
|
|
734
|
-
background: #0f172a;
|
|
735
|
-
padding: 1em;
|
|
736
|
-
border-radius: 8px;
|
|
737
|
-
overflow-x: auto;
|
|
738
|
-
border: 1px solid rgba(255,255,255,0.1);
|
|
739
|
-
}
|
|
740
|
-
.markdown-body pre code { background: none; padding: 0; }
|
|
741
|
-
.markdown-body blockquote {
|
|
742
|
-
border-left: 4px solid #38bdf8;
|
|
743
|
-
margin: 1em 0;
|
|
744
|
-
padding-left: 1em;
|
|
745
|
-
color: #cbd5e1;
|
|
746
|
-
font-style: italic;
|
|
747
|
-
}
|
|
748
|
-
.markdown-body table {
|
|
749
|
-
border-collapse: collapse;
|
|
750
|
-
width: 100%;
|
|
751
|
-
margin-bottom: 1em;
|
|
752
|
-
}
|
|
753
|
-
.markdown-body th, .markdown-body td {
|
|
754
|
-
border: 1px solid rgba(255,255,255,0.15);
|
|
755
|
-
padding: 8px 12px;
|
|
756
|
-
text-align: left;
|
|
757
|
-
}
|
|
758
|
-
.markdown-body th {
|
|
759
|
-
background: rgba(255,255,255,0.1);
|
|
760
|
-
}
|
|
761
|
-
.markdown-body img {
|
|
762
|
-
max-width: 100%;
|
|
763
|
-
height: auto;
|
|
764
|
-
border-radius: 6px;
|
|
765
|
-
}
|
|
766
|
-
`;constructor(){super(),this.docId="",this.docName="",this.images=[],this.activeSlideIndex=0,this.ocr=!0,this.pdf=!0}handleBackClick(){this.dispatchEvent(new CustomEvent("dialog:close",{bubbles:!0,composed:!1}))}handleOcrClick(){let e=this.images[this.activeSlideIndex];!e||e.type==="markdown"||!e.src||this.dispatchEvent(new CustomEvent("copio:ocr-page",{bubbles:!0,composed:!0,detail:{page:e,pageIndex:this.activeSlideIndex}}))}handleExportSelect(e){if(e.detail?.item?.disabled)return;let t=e.detail?.item?.value,o={docId:this.docId,docName:this.docName,pages:this.images};t==="pdf"?this.dispatchEvent(new CustomEvent("doc:download-pdf",{bubbles:!0,composed:!1,detail:o})):t==="images"?this.dispatchEvent(new CustomEvent("doc:download-images",{bubbles:!0,composed:!1,detail:o})):t==="markdown"&&this.dispatchEvent(new CustomEvent("doc:download-markdown",{bubbles:!0,composed:!1,detail:o}))}handleSlideChange(e){this.activeSlideIndex=e.detail?.index||0}renderItem(e){if(e.type==="markdown"){let t=e.content||"",o=window.marked&&window.marked.parse?window.marked.parse(t):t;return O`
|
|
767
|
-
<sl-carousel-item data-id="${e.id}">
|
|
768
|
-
<div class="markdown-container">
|
|
769
|
-
<div class="markdown-body" .innerHTML=${o}></div>
|
|
770
|
-
</div>
|
|
771
|
-
</sl-carousel-item>
|
|
772
|
-
`}return O`
|
|
631
|
+
`;constructor(){super(),this.docId="",this.docName="",this.images=[],this.activeSlideIndex=0,this.ocr=!0,this.pdf=!0}handleBackClick(){this.dispatchEvent(new CustomEvent("dialog:close",{bubbles:!0,composed:!1}))}handleOcrClick(){let e=this.images[this.activeSlideIndex];!e||!e.src||this.dispatchEvent(new CustomEvent("copio:ocr-page",{bubbles:!0,composed:!0,detail:{page:e,pageIndex:this.activeSlideIndex}}))}handleExportSelect(e){if(e.detail?.item?.disabled)return;let t=e.detail?.item?.value,o={docId:this.docId,docName:this.docName,pages:this.images};t==="pdf"?this.dispatchEvent(new CustomEvent("doc:download-pdf",{bubbles:!0,composed:!1,detail:{...o,searchable:!1}})):t==="searchable-pdf"?this.dispatchEvent(new CustomEvent("doc:download-pdf",{bubbles:!0,composed:!1,detail:{...o,searchable:!0}})):t==="images"&&this.dispatchEvent(new CustomEvent("doc:download-images",{bubbles:!0,composed:!1,detail:o}))}handleSlideChange(e){this.activeSlideIndex=e.detail?.index||0}renderItem(e){return R`
|
|
773
632
|
<sl-carousel-item data-id="${e.id}">
|
|
774
633
|
<div class="item" style="background-image: url('${e.src}')"></div>
|
|
775
634
|
</sl-carousel-item>
|
|
776
|
-
`}render(){let e=this.
|
|
635
|
+
`}render(){let e=this.visibleImages[this.activeSlideIndex],t=this.ocr!==!1&&e&&!!e.src;return R`
|
|
777
636
|
<div class="top-bar">
|
|
778
637
|
<div class="top-bar-left">
|
|
779
638
|
<button class="back" @click=${this.handleBackClick} aria-label="Back">←</button>
|
|
@@ -781,7 +640,7 @@ import{j as R,k as Bt,q as nt}from"./chunk-HS6GDZIS.js";import{a as re,b as O,c
|
|
|
781
640
|
</div>
|
|
782
641
|
|
|
783
642
|
<div class="top-bar-right">
|
|
784
|
-
${t?
|
|
643
|
+
${t?R`
|
|
785
644
|
<button class="ocr-btn" @click=${this.handleOcrClick} aria-label="Extract text">
|
|
786
645
|
<sl-icon name="card-text"></sl-icon>
|
|
787
646
|
<span>Extract Text</span>
|
|
@@ -795,20 +654,22 @@ import{j as R,k as Bt,q as nt}from"./chunk-HS6GDZIS.js";import{a as re,b as O,c
|
|
|
795
654
|
<sl-icon name="chevron-down" style="font-size: 0.75rem;"></sl-icon>
|
|
796
655
|
</button>
|
|
797
656
|
<sl-menu @sl-select=${this.handleExportSelect}>
|
|
798
|
-
${this.pdf!==!1?
|
|
657
|
+
${this.pdf!==!1?R`
|
|
799
658
|
<sl-menu-item value="pdf" ?disabled=${this.pageCount===0}>
|
|
800
659
|
<sl-icon slot="prefix" name="file-earmark-pdf"></sl-icon>
|
|
801
660
|
Download as PDF
|
|
802
661
|
</sl-menu-item>
|
|
662
|
+
${this.ocr!==!1?R`
|
|
663
|
+
<sl-menu-item value="searchable-pdf" ?disabled=${this.pageCount===0}>
|
|
664
|
+
<sl-icon slot="prefix" name="file-earmark-text"></sl-icon>
|
|
665
|
+
Download Searchable PDF
|
|
666
|
+
</sl-menu-item>
|
|
667
|
+
`:""}
|
|
803
668
|
`:""}
|
|
804
669
|
<sl-menu-item value="images" ?disabled=${this.pageCount===0}>
|
|
805
670
|
<sl-icon slot="prefix" name="images"></sl-icon>
|
|
806
671
|
Download as Images (ZIP)
|
|
807
672
|
</sl-menu-item>
|
|
808
|
-
<sl-menu-item value="markdown" ?disabled=${!this.hasMarkdown}>
|
|
809
|
-
<sl-icon slot="prefix" name="markdown"></sl-icon>
|
|
810
|
-
Download as Markdown
|
|
811
|
-
</sl-menu-item>
|
|
812
673
|
</sl-menu>
|
|
813
674
|
</sl-dropdown>
|
|
814
675
|
</div>
|
|
@@ -819,14 +680,14 @@ import{j as R,k as Bt,q as nt}from"./chunk-HS6GDZIS.js";import{a as re,b as O,c
|
|
|
819
680
|
orientation="vertical"
|
|
820
681
|
@sl-slide-change=${this.handleSlideChange}
|
|
821
682
|
>
|
|
822
|
-
${this.
|
|
683
|
+
${this.visibleImages.map(o=>this.renderItem(o))}
|
|
823
684
|
</sl-carousel>
|
|
824
|
-
`}};customElements.define("copio-carousel",et);var tt=class extends
|
|
685
|
+
`}};customElements.define("copio-carousel",et);var tt=class extends G{createRenderRoot(){return this}disconnectedCallback(){super.disconnectedCallback(),this.#e()}#e=()=>{let e=this.querySelector(".dialog-add-edit-input-name"),t=this.querySelector(".dialog-name-error");if(t&&(t.style.display="none"),e&&(e.classList.remove("input-invalid"),e.style.removeProperty("--sl-input-border-color"),e.style.removeProperty("--sl-input-border-color-focus"),typeof e.setCustomValidity=="function"))try{e.setCustomValidity("")}catch{}};#t=e=>{e.target?.value?.trim()&&this.#e()};#c=e=>{if(e.target!==e.currentTarget)return;this.#e();let t=this.querySelector(".dialog-add-edit-input-id"),o=this.querySelector(".dialog-add-edit-input-name"),r=this.querySelector("copio-images");t&&(t.value=""),o&&(o.value=""),r&&(r.images=[]),this.dispatchEvent(new CustomEvent("dialog:close",{bubbles:!0,composed:!1}))};#d=e=>{if(e.key!=="Enter"||this.querySelector("sl-dialog[open]"))return;if(e.target?.classList?.contains("dialog-add-edit-input-name")){e.preventDefault(),this.#r();return}let t=e.target?.tagName;t==="TEXTAREA"||t==="SL-TEXTAREA"||t==="INPUT"||t==="SL-INPUT"||e.target?.tagName==="SL-BUTTON"||e.target?.tagName==="BUTTON"||(e.preventDefault(),this.#r())};async open(){await this.updateComplete,this.#e();let e=this.querySelector(".dialog-add-edit");e&&(await e.show(),this.querySelector(".dialog-add-edit-input-name")?.focus())}async openEdit(e,t,o){await this.updateComplete,this.#e();let r=this.querySelector(".dialog-add-edit");if(!r)return;let a=this.querySelector(".dialog-add-edit-input-id"),n=this.querySelector(".dialog-add-edit-input-name"),l=this.querySelector("copio-images");a.value=e,n.value=t,await customElements.whenDefined("copio-images"),l.images=o.map(({id:s,src:c,originalSrc:h,edits:p,exif:u})=>({id:s,src:c,originalSrc:h||c,edits:p||{crop:null,rotation:0,filter:"none"},exif:u})),r.open||(await r.show(),n.focus())}#r=()=>{let e=this.querySelector(".dialog-add-edit-input-id"),t=this.querySelector(".dialog-add-edit-input-name"),o=this.querySelector(".dialog-name-error"),r=this.querySelector("copio-images"),a=t?.value?.trim();if(!a){o&&(o.style.display="block"),t&&(t.classList.add("input-invalid"),t.style.setProperty("--sl-input-border-color","#ef4444"),t.style.setProperty("--sl-input-border-color-focus","#ef4444"),typeof t.setCustomValidity=="function"&&(t.setCustomValidity("Please enter a document name"),t.reportValidity?.()),t.focus());return}let n=(r?.images||[]).map(({id:s,src:c,originalSrc:h,edits:p,exif:u,type:v,name:f,content:y})=>({id:s,src:c,originalSrc:h||c,edits:p||{crop:null,rotation:0,filter:"none"},exif:u,type:v,name:f,content:y})),l=e?.value||Ce();this.dispatchEvent(new CustomEvent("dialog:save",{bubbles:!0,composed:!1,detail:{id:l,name:a,pages:n}})),this.querySelector(".dialog-add-edit")?.hide()};render(){return R`
|
|
825
686
|
<sl-dialog
|
|
826
687
|
label="Add / Edit"
|
|
827
688
|
class="dialog-add-edit"
|
|
828
689
|
style="--width: min(94%, 640px)"
|
|
829
|
-
@sl-after-hide=${this.#
|
|
690
|
+
@sl-after-hide=${this.#c}
|
|
830
691
|
@keydown=${this.#d}
|
|
831
692
|
>
|
|
832
693
|
<div style="min-height: min(65cqh, 420px); min-height: 350px;">
|
|
@@ -866,7 +727,7 @@ import{j as R,k as Bt,q as nt}from"./chunk-HS6GDZIS.js";import{a as re,b as O,c
|
|
|
866
727
|
>
|
|
867
728
|
</div>
|
|
868
729
|
</sl-dialog>
|
|
869
|
-
`}};customElements.define("copio-add-edit-dialog",tt);var ot=class extends
|
|
730
|
+
`}};customElements.define("copio-add-edit-dialog",tt);var ot=class extends G{static properties={name:{type:String},pages:{type:Array},isRenaming:{type:Boolean,state:!0},renameValue:{type:String,state:!0},ocr:{type:Boolean},pdf:{type:Boolean}};constructor(){super(),this.name="",this.pages=[],this.isRenaming=!1,this.renameValue="",this.ocr=!0,this.pdf=!0}get hasImages(){return(this.pages||[]).some(e=>!!e.src)}get visiblePages(){return this.pages||[]}get pageCount(){return this.visiblePages.length}static styles=re`
|
|
870
731
|
.wrapper {
|
|
871
732
|
margin-left: auto;
|
|
872
733
|
margin-right: auto;
|
|
@@ -925,7 +786,7 @@ import{j as R,k as Bt,q as nt}from"./chunk-HS6GDZIS.js";import{a as re,b as O,c
|
|
|
925
786
|
background: white;
|
|
926
787
|
cursor: pointer;
|
|
927
788
|
}
|
|
928
|
-
`;#e(e){this.isRenaming||e.target.closest("sl-dropdown")||e.target.closest(".rename-container")||this.handleView()}#t(e){if(e.detail?.item?.disabled)return;let t=e.detail?.item?.value;t==="delete"&&this.handleDelete(),t==="rename"&&this.startRename(),t==="edit"&&this.handleEdit(),t==="extract-ocr"&&this.handleExtractOcr(),t==="download"&&this.handleDownload(),t==="download-
|
|
789
|
+
`;#e(e){this.isRenaming||e.target.closest("sl-dropdown")||e.target.closest(".rename-container")||this.handleView()}#t(e){if(e.detail?.item?.disabled)return;let t=e.detail?.item?.value;t==="delete"&&this.handleDelete(),t==="rename"&&this.startRename(),t==="edit"&&this.handleEdit(),t==="extract-ocr"&&this.handleExtractOcr(),t==="download"&&this.handleDownload(),t==="download-searchable-pdf"&&this.handleDownloadSearchablePdf(),t==="download-images"&&this.handleDownloadImages()}startRename(e){e&&(e.preventDefault(),e.stopPropagation()),this.renameValue=this.name||"",this.isRenaming=!0,this.updateComplete.then(()=>{let t=this.shadowRoot.querySelector(".rename-input");t&&(t.focus(),typeof t.select=="function"&&t.select())})}cancelRename(e){e&&(e.preventDefault(),e.stopPropagation()),this.isRenaming=!1,this.renameValue=this.name||""}commitRename(e){e&&(e.preventDefault(),e.stopPropagation());let t=(this.renameValue||"").trim();if(!t){this.cancelRename();return}if(t!==this.name){let o={id:this.getAttribute("id"),name:t};this.dispatchEvent(new CustomEvent("doc:rename",{bubbles:!0,composed:!1,detail:o})),this.name=t}this.isRenaming=!1}handleRenameKeyDown(e){e.key==="Enter"?(e.preventDefault(),this.commitRename()):e.key==="Escape"&&(e.preventDefault(),this.cancelRename())}handleExtractOcr(){let e={id:this.getAttribute("id")};this.dispatchEvent(new CustomEvent("doc:extract-ocr",{bubbles:!0,composed:!1,detail:e}))}handleView(){let e={id:this.getAttribute("id")};this.dispatchEvent(new CustomEvent("doc:view",{bubbles:!0,composed:!1,detail:e}))}handleDelete(){let e={id:this.getAttribute("id")};this.dispatchEvent(new CustomEvent("doc:delete",{bubbles:!0,composed:!1,detail:e}))}handleEdit(){let e={id:this.getAttribute("id")};this.dispatchEvent(new CustomEvent("doc:edit",{bubbles:!0,composed:!1,detail:e}))}handleDownload(){let e={id:this.getAttribute("id")};this.dispatchEvent(new CustomEvent("doc:download",{bubbles:!0,composed:!1,detail:e}))}handleDownloadSearchablePdf(){let e={id:this.getAttribute("id"),searchable:!0};this.dispatchEvent(new CustomEvent("doc:download",{bubbles:!0,composed:!1,detail:e}))}handleDownloadImages(){let e={id:this.getAttribute("id")};this.dispatchEvent(new CustomEvent("doc:download-images",{bubbles:!0,composed:!1,detail:e}))}render(){return R`
|
|
929
790
|
<div class="wrapper" @click=${this.#e}>
|
|
930
791
|
<div class="inner">
|
|
931
792
|
<sl-avatar label="Document icon">
|
|
@@ -933,7 +794,7 @@ import{j as R,k as Bt,q as nt}from"./chunk-HS6GDZIS.js";import{a as re,b as O,c
|
|
|
933
794
|
</sl-avatar>
|
|
934
795
|
|
|
935
796
|
<div class="titles">
|
|
936
|
-
${this.isRenaming?
|
|
797
|
+
${this.isRenaming?R`
|
|
937
798
|
<div class="rename-container" @click=${e=>e.stopPropagation()}>
|
|
938
799
|
<sl-input
|
|
939
800
|
class="rename-input"
|
|
@@ -953,7 +814,7 @@ import{j as R,k as Bt,q as nt}from"./chunk-HS6GDZIS.js";import{a as re,b as O,c
|
|
|
953
814
|
@click=${this.cancelRename}
|
|
954
815
|
></sl-icon-button>
|
|
955
816
|
</div>
|
|
956
|
-
`:
|
|
817
|
+
`:R`
|
|
957
818
|
<div class="doc-title">${this.name||"Untitled Document"}</div>
|
|
958
819
|
<div class="doc-page-count">
|
|
959
820
|
${this.pageCount} ${this.pageCount===1?"page":"pages"}
|
|
@@ -975,7 +836,7 @@ import{j as R,k as Bt,q as nt}from"./chunk-HS6GDZIS.js";import{a as re,b as O,c
|
|
|
975
836
|
<sl-icon slot="prefix" name="pencil"></sl-icon>
|
|
976
837
|
Rename
|
|
977
838
|
</sl-menu-item>
|
|
978
|
-
${this.ocr!==!1?
|
|
839
|
+
${this.ocr!==!1?R`
|
|
979
840
|
<sl-menu-item
|
|
980
841
|
value="extract-ocr"
|
|
981
842
|
?disabled=${!this.hasImages}
|
|
@@ -986,7 +847,7 @@ import{j as R,k as Bt,q as nt}from"./chunk-HS6GDZIS.js";import{a as re,b as O,c
|
|
|
986
847
|
</sl-menu-item>
|
|
987
848
|
`:""}
|
|
988
849
|
<sl-divider></sl-divider>
|
|
989
|
-
${this.pdf!==!1?
|
|
850
|
+
${this.pdf!==!1?R`
|
|
990
851
|
<sl-menu-item
|
|
991
852
|
value="download"
|
|
992
853
|
?disabled=${this.pageCount===0}
|
|
@@ -995,6 +856,16 @@ import{j as R,k as Bt,q as nt}from"./chunk-HS6GDZIS.js";import{a as re,b as O,c
|
|
|
995
856
|
<sl-icon slot="prefix" name="file-earmark-pdf"></sl-icon>
|
|
996
857
|
Download as PDF
|
|
997
858
|
</sl-menu-item>
|
|
859
|
+
${this.ocr!==!1?R`
|
|
860
|
+
<sl-menu-item
|
|
861
|
+
value="download-searchable-pdf"
|
|
862
|
+
?disabled=${this.pageCount===0||!this.hasImages}
|
|
863
|
+
title=${this.pageCount===0?"Document is empty":"Download as Searchable PDF (with OCR text layer)"}
|
|
864
|
+
>
|
|
865
|
+
<sl-icon slot="prefix" name="file-earmark-text"></sl-icon>
|
|
866
|
+
Download Searchable PDF
|
|
867
|
+
</sl-menu-item>
|
|
868
|
+
`:""}
|
|
998
869
|
`:""}
|
|
999
870
|
<sl-menu-item
|
|
1000
871
|
value="download-images"
|
|
@@ -1004,14 +875,6 @@ import{j as R,k as Bt,q as nt}from"./chunk-HS6GDZIS.js";import{a as re,b as O,c
|
|
|
1004
875
|
<sl-icon slot="prefix" name="images"></sl-icon>
|
|
1005
876
|
Download as Images
|
|
1006
877
|
</sl-menu-item>
|
|
1007
|
-
<sl-menu-item
|
|
1008
|
-
value="download-markdown"
|
|
1009
|
-
?disabled=${!this.hasMarkdown}
|
|
1010
|
-
title=${this.hasMarkdown?"Download as Markdown":"No markdown notes in document"}
|
|
1011
|
-
>
|
|
1012
|
-
<sl-icon slot="prefix" name="markdown"></sl-icon>
|
|
1013
|
-
Download as Markdown
|
|
1014
|
-
</sl-menu-item>
|
|
1015
878
|
<sl-divider></sl-divider>
|
|
1016
879
|
<sl-menu-item value="delete">
|
|
1017
880
|
<sl-icon slot="prefix" name="trash"></sl-icon>
|
|
@@ -1020,7 +883,7 @@ import{j as R,k as Bt,q as nt}from"./chunk-HS6GDZIS.js";import{a as re,b as O,c
|
|
|
1020
883
|
</sl-menu>
|
|
1021
884
|
</sl-dropdown>
|
|
1022
885
|
</div>
|
|
1023
|
-
`}};customElements.define("copio-row",ot);var it=class extends
|
|
886
|
+
`}};customElements.define("copio-row",ot);var it=class extends G{static styles=re`
|
|
1024
887
|
header {
|
|
1025
888
|
background-color: #151f2a;
|
|
1026
889
|
color: white;
|
|
@@ -1049,7 +912,7 @@ import{j as R,k as Bt,q as nt}from"./chunk-HS6GDZIS.js";import{a as re,b as O,c
|
|
|
1049
912
|
align-items: center;
|
|
1050
913
|
justify-content: center;
|
|
1051
914
|
}
|
|
1052
|
-
`;static properties={_storageEstimate:{state:!0},_isPersisted:{state:!0}};async connectedCallback(){super.connectedCallback(),await this.#e()}disconnectedCallback(){super.disconnectedCallback()}async#e(){navigator.storage&&(navigator.storage.persisted&&(this._isPersisted=await navigator.storage.persisted()),navigator.storage.estimate&&(this._storageEstimate=await navigator.storage.estimate()))}_formatBytes(e){if(e==null)return"Unknown";if(e===0)return"0 B";let t=1024,o=["B","KB","MB","GB"],r=Math.floor(Math.log(e)/Math.log(t));return parseFloat((e/Math.pow(t,r)).toFixed(1))+" "+o[r]}#t(e){if(e.detail
|
|
915
|
+
`;static properties={_storageEstimate:{state:!0},_isPersisted:{state:!0},storageKind:{type:String}};constructor(){super()}async connectedCallback(){super.connectedCallback(),await this.#e()}disconnectedCallback(){super.disconnectedCallback()}async#e(){navigator.storage&&(navigator.storage.persisted&&(this._isPersisted=await navigator.storage.persisted()),navigator.storage.estimate&&(this._storageEstimate=await navigator.storage.estimate()))}_formatBytes(e){if(e==null)return"Unknown";if(e===0)return"0 B";let t=1024,o=["B","KB","MB","GB"],r=Math.floor(Math.log(e)/Math.log(t));return parseFloat((e/Math.pow(t,r)).toFixed(1))+" "+o[r]}#t(e){if(e.detail?.item?.value==="link-device"){this.dispatchEvent(new CustomEvent("header:link-device",{bubbles:!0,composed:!1}));return}if(e.detail?.item?.value==="clear-cache"){this.dispatchEvent(new CustomEvent("header:clear-cache",{bubbles:!0,composed:!1}));return}}render(){return R`
|
|
1053
916
|
<header>
|
|
1054
917
|
<div class="header-left">
|
|
1055
918
|
<sl-dropdown @sl-show=${this.#e}>
|
|
@@ -1064,8 +927,10 @@ import{j as R,k as Bt,q as nt}from"./chunk-HS6GDZIS.js";import{a as re,b as O,c
|
|
|
1064
927
|
<sl-menu-item value="clear-cache">Clear cache & update</sl-menu-item>
|
|
1065
928
|
<sl-divider></sl-divider>
|
|
1066
929
|
<sl-menu-item disabled>
|
|
1067
|
-
Storage: ${this._formatBytes(this._storageEstimate?.usage)}
|
|
1068
|
-
|
|
930
|
+
Storage: ${this._formatBytes(this._storageEstimate?.usage)} / ${this._formatBytes(this._storageEstimate?.quota)}
|
|
931
|
+
</sl-menu-item>
|
|
932
|
+
<sl-menu-item disabled>
|
|
933
|
+
Backend: ${(this.storageKind||"opfs").toUpperCase()} (${this._isPersisted?"Persisted":"Volatile"})
|
|
1069
934
|
</sl-menu-item>
|
|
1070
935
|
</sl-menu>
|
|
1071
936
|
</sl-dropdown>
|
|
@@ -1073,7 +938,7 @@ import{j as R,k as Bt,q as nt}from"./chunk-HS6GDZIS.js";import{a as re,b as O,c
|
|
|
1073
938
|
<h1>COPIO</h1>
|
|
1074
939
|
<div class="header-right"></div>
|
|
1075
940
|
</header>
|
|
1076
|
-
`}};customElements.define("copio-header",it);var rt=class extends
|
|
941
|
+
`}};customElements.define("copio-header",it);var rt=class extends G{disconnectedCallback(){super.disconnectedCallback()}static styles=re`
|
|
1077
942
|
.lds-roller {
|
|
1078
943
|
display: inline-block;
|
|
1079
944
|
position: relative;
|
|
@@ -1158,7 +1023,7 @@ import{j as R,k as Bt,q as nt}from"./chunk-HS6GDZIS.js";import{a as re,b as O,c
|
|
|
1158
1023
|
transform: rotate(360deg);
|
|
1159
1024
|
}
|
|
1160
1025
|
}
|
|
1161
|
-
`;render(){return
|
|
1026
|
+
`;render(){return R`
|
|
1162
1027
|
<div
|
|
1163
1028
|
style="
|
|
1164
1029
|
background: #151f2a;
|
|
@@ -1204,7 +1069,7 @@ import{j as R,k as Bt,q as nt}from"./chunk-HS6GDZIS.js";import{a as re,b as O,c
|
|
|
1204
1069
|
<div></div>
|
|
1205
1070
|
</div>
|
|
1206
1071
|
</div>
|
|
1207
|
-
`}};customElements.define("copio-loader",rt);var
|
|
1072
|
+
`}};customElements.define("copio-loader",rt);var kt=`
|
|
1208
1073
|
:host {
|
|
1209
1074
|
all: initial;
|
|
1210
1075
|
display: block;
|
|
@@ -1989,6 +1854,7 @@ import{j as R,k as Bt,q as nt}from"./chunk-HS6GDZIS.js";import{a as re,b as O,c
|
|
|
1989
1854
|
overflow-x: auto;
|
|
1990
1855
|
min-height: 80px;
|
|
1991
1856
|
flex-shrink: 0;
|
|
1857
|
+
scrollbar-width: thin;
|
|
1992
1858
|
}
|
|
1993
1859
|
|
|
1994
1860
|
.copio-filmstrip-scroll {
|
|
@@ -2011,10 +1877,13 @@ import{j as R,k as Bt,q as nt}from"./chunk-HS6GDZIS.js";import{a as re,b as O,c
|
|
|
2011
1877
|
height: 70px;
|
|
2012
1878
|
border-radius: var(--copio-radius-sm);
|
|
2013
1879
|
overflow: hidden;
|
|
2014
|
-
background: #
|
|
1880
|
+
background: var(--copio-color-surface-elevated, #1c2736);
|
|
2015
1881
|
border: 2px solid var(--copio-color-border);
|
|
2016
1882
|
cursor: pointer;
|
|
2017
1883
|
transition: all var(--copio-transition-fast);
|
|
1884
|
+
display: flex;
|
|
1885
|
+
align-items: center;
|
|
1886
|
+
justify-content: center;
|
|
2018
1887
|
}
|
|
2019
1888
|
|
|
2020
1889
|
.copio-filmstrip-item.is-active .copio-thumb-container {
|
|
@@ -2062,9 +1931,11 @@ import{j as R,k as Bt,q as nt}from"./chunk-HS6GDZIS.js";import{a as re,b as O,c
|
|
|
2062
1931
|
}
|
|
2063
1932
|
|
|
2064
1933
|
.copio-thumb-img {
|
|
2065
|
-
width: 100%;
|
|
2066
|
-
height: 100%;
|
|
2067
|
-
|
|
1934
|
+
max-width: 100%;
|
|
1935
|
+
max-height: 100%;
|
|
1936
|
+
width: auto;
|
|
1937
|
+
height: auto;
|
|
1938
|
+
object-fit: contain;
|
|
2068
1939
|
}
|
|
2069
1940
|
|
|
2070
1941
|
/* Edit Action Toolbar & Primary Completion Dock */
|
|
@@ -2360,7 +2231,7 @@ import{j as R,k as Bt,q as nt}from"./chunk-HS6GDZIS.js";import{a as re,b as O,c
|
|
|
2360
2231
|
}
|
|
2361
2232
|
.copio-thumb-container {
|
|
2362
2233
|
width: 112px;
|
|
2363
|
-
height:
|
|
2234
|
+
height: 140px;
|
|
2364
2235
|
}
|
|
2365
2236
|
.copio-toolbar,
|
|
2366
2237
|
.copio-controls-dock {
|
|
@@ -2377,7 +2248,7 @@ import{j as R,k as Bt,q as nt}from"./chunk-HS6GDZIS.js";import{a as re,b as O,c
|
|
|
2377
2248
|
min-width: 200px;
|
|
2378
2249
|
}
|
|
2379
2250
|
}
|
|
2380
|
-
`,Ne=null;function
|
|
2251
|
+
`,Ne=null;function co(){if(Ne)return Ne;if(typeof CSSStyleSheet<"u"&&typeof Document<"u"&&"adoptedStyleSheets"in Document.prototype&&"replaceSync"in CSSStyleSheet.prototype)try{return Ne=new CSSStyleSheet,Ne.replaceSync(kt),Ne}catch{return null}return null}function po(i){if(!i)return;let e=co();if(e&&"adoptedStyleSheets"in i){let t=i.adoptedStyleSheets||[];t.includes(e)||(i.adoptedStyleSheets=[...t,e])}else if(!i.querySelector("style[data-copio-encapsulated-styles]")){let t=document.createElement("style");t.setAttribute("data-copio-encapsulated-styles",""),t.textContent=kt,i.appendChild(t)}}var Fo=typeof HTMLElement<"u"?HTMLElement:class{},Dt=class extends Fo{#e=null;#t=null;#c=null;#d=!1;#r="viewfinder";#o=0;#h=0;#u=!1;#a=!1;#l=null;#p=null;#m=0;#f=null;#b=null;#i=null;onShutter=null;get#n(){return this.docId?this.docId:(this.#b||(this.#b=`doc_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,6)}`),this.#b)}static get observedAttributes(){return["mode","aspect","stage","doc-id","features","export-formats","ocr-languages","max-pages","asset-base","license-key","theme","ocr","pdf"]}constructor(){super(),typeof this.attachShadow=="function"&&this.attachShadow({mode:"open"}),this.#D()}#D(){let e={storage:this.#t};typeof this.getAttribute=="function"&&(this.hasAttribute("features")&&(e.features=this.getAttribute("features")),this.hasAttribute("export-formats")&&(e.exportFormats=this.getAttribute("export-formats")),this.hasAttribute("ocr-languages")&&(e.ocrLanguages=this.getAttribute("ocr-languages")),this.hasAttribute("max-pages")&&(e.maxPages=this.getAttribute("max-pages")),this.hasAttribute("asset-base")&&(e.assetBase=this.getAttribute("asset-base")),this.hasAttribute("license-key")&&(e.licenseKey=this.getAttribute("license-key")),this.hasAttribute("ocr")&&(e.ocr=this.getAttribute("ocr")!=="false"),this.hasAttribute("pdf")&&(e.pdf=this.getAttribute("pdf")!=="false")),this.#e=new nt(e)}connectedCallback(){this.shadowRoot&&(po(this.shadowRoot),this.#A()),typeof ke=="function"&&typeof document<"u"&&st()===document.body&&ke(this.shadowRoot?.querySelector(".copio-scanner-container")||this),this.#e&&(this.#c=this.#e.subscribe(async()=>{let e=await this.getPages();this.dispatch(B.PAGES_CHANGED,{pages:e,docId:this.docId}),this.#s()})),this.hasAttribute&&this.hasAttribute("asset-base")&&Ot(this.getAttribute("asset-base")),this.#g(),this.#s()}disconnectedCallback(){if(this.#v(),typeof this.#c=="function"&&(this.#c(),this.#c=null),this.#p&&(clearInterval(this.#p),this.#p=null),typeof ke=="function"&&typeof document<"u"){let e=this.shadowRoot?.querySelector(".copio-scanner-container")||this;st()===e&&ke(null)}}attributeChangedCallback(e,t,o){if(!(t===o||!this.#e))switch(e){case"features":this.#e.setFeatures(o),this.#g();break;case"export-formats":this.#e.exportFormats=o,this.#g();break;case"ocr-languages":this.#e.ocrLanguages=o;break;case"asset-base":this.#e.assetBase=o;break;case"license-key":this.#e.licenseKey=o;break;case"ocr":this.#e.ocr=o!=="false",this.#g();break;case"pdf":this.#e.pdf=o!=="false",this.#g();break;case"stage":if(o==="viewfinder"||o==="workbench"){this.#r=o;let r=this.shadowRoot;if(r){let a=r.getElementById("viewfinder-section"),n=r.getElementById("workbench-section");a&&n&&(a.style.display=o==="viewfinder"?"flex":"none",n.style.display=o==="workbench"?"flex":"none")}this.#s()}break;case"max-pages":this.#e.maxPages=o,this.#s();break;case"mode":case"aspect":case"theme":this.#s();break}}#g(){if(typeof this.querySelectorAll!="function")return;let e=[];this.shadowRoot&&e.push(this.shadowRoot),e.push(this);for(let t of e){let o=t.querySelectorAll("copio-carousel, copio-row, copio-images");for(let r of o)"ocr"in r&&(r.ocr=this.ocrEnabled),"pdf"in r&&(r.pdf=this.pdf)}}#A(){if(!this.shadowRoot||this.shadowRoot.innerHTML)return;let e="Align Document Inside Frame";this.aspect==="card"?e="Step 1 of 2: Capture Front of ID Card":this.mode==="batch"&&(e="Batch Capture \xB7 Page 1"),this.shadowRoot.innerHTML=`
|
|
2381
2252
|
<div class="copio-scanner-container copio-scanner-host" part="scanner-root">
|
|
2382
2253
|
<header class="copio-header" part="header">
|
|
2383
2254
|
<div class="copio-header-left">
|
|
@@ -2554,7 +2425,7 @@ import{j as R,k as Bt,q as nt}from"./chunk-HS6GDZIS.js";import{a as re,b as O,c
|
|
|
2554
2425
|
<input type="file" id="internal-file-input" accept="image/*" style="display: none;" />
|
|
2555
2426
|
<slot></slot>
|
|
2556
2427
|
</div>
|
|
2557
|
-
`,this.#I()}#I(){let e=this.shadowRoot;if(!e)return;e.getElementById("tab-viewfinder")?.addEventListener("click",()=>{this.stage="viewfinder"}),e.getElementById("tab-workbench")?.addEventListener("click",()=>{this.stage="workbench"});let t=e.getElementById("internal-file-input");e.getElementById("btn-import-file")?.addEventListener("click",()=>{t?.click()}),t?.addEventListener("change",async o=>{let r=o.target;r.files&&r.files.length>0&&(await this.addFiles(r.files),r.value="")}),e.getElementById("btn-shutter")?.addEventListener("click",async()=>{await this.#
|
|
2428
|
+
`,this.#I()}#I(){let e=this.shadowRoot;if(!e)return;e.getElementById("tab-viewfinder")?.addEventListener("click",()=>{this.stage="viewfinder"}),e.getElementById("tab-workbench")?.addEventListener("click",()=>{this.stage="workbench"});let t=e.getElementById("internal-file-input");e.getElementById("btn-import-file")?.addEventListener("click",()=>{t?.click()}),t?.addEventListener("change",async o=>{let r=o.target;r.files&&r.files.length>0&&(await this.addFiles(r.files),r.value="")}),e.getElementById("btn-shutter")?.addEventListener("click",async()=>{await this.#_()}),e.getElementById("btn-review")?.addEventListener("click",()=>{this.stage="workbench"}),e.getElementById("btn-retake")?.addEventListener("click",()=>{this.#u=!0,this.#a=!1,this.stage="viewfinder"}),e.getElementById("btn-rotate")?.addEventListener("click",async()=>{await this.#E()}),e.getElementById("btn-filter-bw")?.addEventListener("click",async()=>{await this.#S()}),e.getElementById("btn-crop")?.addEventListener("click",async()=>{await this.#C()}),e.getElementById("btn-delete")?.addEventListener("click",async()=>{await this.#k()}),e.getElementById("btn-ocr")?.addEventListener("click",async()=>{await this.#M()}),e.getElementById("btn-close-ocr")?.addEventListener("click",()=>{this.#R()}),e.getElementById("btn-primary-complete")?.addEventListener("click",async()=>{await this.#B()}),e.getElementById("btn-card-front")?.addEventListener("click",()=>{this.#a=!1,this.#o=0,this.#s()}),e.getElementById("btn-card-back")?.addEventListener("click",()=>{this.#a=!1,this.#o=1,this.#s()}),this.#x()}#x(){let e=this.shadowRoot;if(!e)return;let t=e.getElementById("crop-box"),o=e.querySelectorAll(".copio-crop-handle");if(!t||o.length===0)return;let r=null,a=!1,n=0,l=0,s=null,c=u=>{let v=u.target.closest(".copio-crop-handle");if(v)r=v.getAttribute("data-handle"),a=!1;else if(u.target===t||u.target.classList.contains("copio-crop-grid"))r=null,a=!0;else return;u.preventDefault(),u.stopPropagation(),n=u.clientX,l=u.clientY,s=this.#l?{...this.#l}:{x:.05,y:.05,w:.9,h:.9},window.addEventListener("pointermove",h),window.addEventListener("pointerup",p)},h=u=>{if(!r&&!a||!s)return;let f=(e.getElementById("canvas-wrapper")||e.getElementById("canvas-viewport"))?.getBoundingClientRect()||{width:300,height:400},y=(u.clientX-n)/Math.max(f.width,1),I=(u.clientY-l)/Math.max(f.height,1),{x:D,y:g,w,h:C}=s;if(a)D=Math.min(Math.max(0,D+y),1-w),g=Math.min(Math.max(0,g+I),1-C);else if(r){if(r.includes("w")){let k=Math.min(Math.max(0,D+y),D+w-.1);w+=D-k,D=k}if(r.includes("e")&&(w=Math.min(Math.max(.1,w+y),1-D)),r.includes("n")){let k=Math.min(Math.max(0,g+I),g+C-.1);C+=g-k,g=k}r.includes("s")&&(C=Math.min(Math.max(.1,C+I),1-g))}this.#l={x:D,y:g,w,h:C},this.#y()},p=()=>{r=null,a=!1,s=null,window.removeEventListener("pointermove",h),window.removeEventListener("pointerup",p)};t.addEventListener("pointerdown",c),o.forEach(u=>{u.addEventListener("pointerdown",c)})}#y(){let e=this.shadowRoot;if(!e||!this.#l)return;let t=e.getElementById("crop-box");t&&(t.style.left=`${(this.#l.x*100).toFixed(1)}%`,t.style.top=`${(this.#l.y*100).toFixed(1)}%`,t.style.width=`${(this.#l.w*100).toFixed(1)}%`,t.style.height=`${(this.#l.h*100).toFixed(1)}%`)}async#s(){if(this.shadowRoot)return this.#f?this.#f:(this.#f=(async()=>{try{await Promise.resolve(),await this.#P()}finally{this.#f=null}})(),this.#f)}async#P(){if(this.shadowRoot)try{let e=await this.getPages();this.#h=e.length;let t=this.shadowRoot,o=t.getElementById("mode-badge");o&&(o.textContent=(this.mode||"single").toUpperCase());let r=t.getElementById("tab-viewfinder"),a=t.getElementById("tab-workbench");r&&r.setAttribute("aria-selected",String(this.#r==="viewfinder")),a&&a.setAttribute("aria-selected",String(this.#r==="workbench"));let n=t.getElementById("viewfinder-section"),l=t.getElementById("workbench-section");n&&l&&(this.#r==="viewfinder"?(n.style.display="flex",l.style.display="none"):(n.style.display="none",l.style.display="flex"));let s=t.getElementById("framing-guide");s&&s.setAttribute("data-aspect",this.aspect||"auto");let c=t.getElementById("step-pill-text");c&&(this.#i?c.textContent="Camera Active \xB7 Tap Shutter to Snap":this.aspect==="card"&&this.maxPages===2?c.textContent=e.length===0?"Step 1 of 2: Capture Front of ID Card":"Step 2 of 2: Capture Back of ID Card":this.aspect==="card"?c.textContent="Align Card Inside Frame":this.mode==="batch"?c.textContent=`Batch Capture \xB7 Page ${e.length+1}`:c.textContent="Align Document Inside Frame");let h=t.getElementById("btn-ocr");h&&(h.style.display=this.ocrEnabled&&this.hasFeature("ocr")?"":"none");let p=t.getElementById("btn-review"),u=t.getElementById("review-pill-text");if(p&&u&&(e.length>0?(p.style.display="inline-flex",u.textContent=`Review (${e.length}) \u2192`):p.style.display="none"),e.length===0){this.#r==="workbench"&&(this.stage="viewfinder");return}this.#o>=e.length&&(this.#o=Math.max(0,e.length-1));let v=e[this.#o],f=t.getElementById("card-side-switcher");if(f){let C=this.aspect==="card"&&this.maxPages===2;f.style.display=C?"flex":"none";let k=t.getElementById("btn-card-front"),_=t.getElementById("btn-card-back");k&&(k.classList.toggle("active",this.#o===0),k.setAttribute("aria-selected",String(this.#o===0))),_&&(_.classList.toggle("active",this.#o===1),_.setAttribute("aria-selected",String(this.#o===1)))}let y=t.getElementById("canvas-viewport");y&&y.classList.toggle("is-cropping",this.#a);let I=t.getElementById("stage-img");if(I)if(this.#a){let C=v.edits?.rotate||0,k=v.edits?.filter||"none",_=v.originalSrc||v.src||"";if(C!==0||k!=="none"){let V=this.#e?await this.#e.renderEdits(_,{rotate:C,filter:k}):_;I.src=V||_}else I.src=_}else I.src=v.src||v.originalSrc||"";let D=t.getElementById("crop-layer");if(this.#a){if(!D){let _=t.getElementById("canvas-wrapper");D=document.createElement("div"),D.className="copio-crop-layer",D.id="crop-layer",D.innerHTML=`
|
|
2558
2429
|
<div class="copio-crop-box" id="crop-box">
|
|
2559
2430
|
<div class="copio-crop-grid"></div>
|
|
2560
2431
|
<span class="copio-crop-handle nw" data-handle="nw"></span>
|
|
@@ -2566,7 +2437,7 @@ import{j as R,k as Bt,q as nt}from"./chunk-HS6GDZIS.js";import{a as re,b as O,c
|
|
|
2566
2437
|
<span class="copio-crop-handle s edge-s" data-handle="s"></span>
|
|
2567
2438
|
<span class="copio-crop-handle w edge-w" data-handle="w"></span>
|
|
2568
2439
|
</div>
|
|
2569
|
-
`,
|
|
2440
|
+
`,_?.appendChild(D),this.#x()}D.style.display="block";let C=v.edits?.rotate||0,k=v.edits?.crop;this.#l=k?Rt(k,C):{x:.05,y:.05,w:.9,h:.9},this.#y()}else D&&D.remove();let g=t.getElementById("crop-btn-label");g&&(g.textContent=this.#a?"Apply":"Crop");let w=t.getElementById("btn-primary-complete");w&&(this.aspect==="card"&&this.maxPages===2&&e.length===1?w.textContent="Next: Capture Back (Step 2/2) \u2192":this.aspect==="card"&&e.length>=2?w.textContent="\u2713 Complete ID Scan (2 Sides)":this.mode==="batch"?w.textContent=`\u2713 Complete Scan (${e.length} Pages)`:w.textContent="\u2713 Use Photo"),this.#T(e)}catch{}}#T(e){let t=this.shadowRoot;if(!t)return;let o=t.getElementById("filmstrip-scroll");o&&(o.innerHTML="",e.forEach((r,a)=>{let n=document.createElement("div");n.className=`copio-filmstrip-item ${a===this.#o?"is-active":""}`,n.setAttribute("data-index",String(a)),n.innerHTML=`
|
|
2570
2441
|
<div class="copio-thumb-container">
|
|
2571
2442
|
<img src="${r.src||r.originalSrc}" alt="Page ${a+1}" class="copio-thumb-img" />
|
|
2572
2443
|
<span class="copio-thumb-num">${a+1}</span>
|
|
@@ -2577,25 +2448,25 @@ import{j as R,k as Bt,q as nt}from"./chunk-HS6GDZIS.js";import{a as re,b as O,c
|
|
|
2577
2448
|
<button type="button" class="copio-reorder-btn move-right" title="Move Right" ${a===e.length-1?"disabled":""}>\u25B6</button>
|
|
2578
2449
|
</div>
|
|
2579
2450
|
`:""}
|
|
2580
|
-
`,n.querySelector(".copio-thumb-container")?.addEventListener("click",()=>{this.#
|
|
2451
|
+
`,n.querySelector(".copio-thumb-container")?.addEventListener("click",()=>{this.#o=a,this.#a=!1,this.#s()}),this.mode==="batch"&&(n.querySelector(".move-left")?.addEventListener("click",async l=>{l.stopPropagation(),await this.#w(a,a-1)}),n.querySelector(".move-right")?.addEventListener("click",async l=>{l.stopPropagation(),await this.#w(a,a+1)})),o.appendChild(n)}))}async#w(e,t){let o=await this.getPages();if(t<0||t>=o.length||e===t)return;let r=o.map(n=>n.id),[a]=r.splice(e,1);r.splice(t,0,a),await this.#e.reorderPages(this.#n,r),this.#o=t,this.#s()}#v(){this.#i&&(this.#i.getTracks().forEach(r=>r.stop()),this.#i=null);let e=this.shadowRoot,t=e?.getElementById("camera-video");t&&(t.srcObject=null,t.style.display="none");let o=e?.querySelector(".copio-camera-placeholder");o&&(o.style.display="")}async#_(){if(typeof this.onShutter=="function"&&await this.onShutter()!==!1)return;let e=this.shadowRoot,t=e?.getElementById("camera-video");if(this.#i&&t&&t.readyState>=2){let a=document.createElement("canvas");a.width=t.videoWidth||1280,a.height=t.videoHeight||720;let n=a.getContext("2d");if(n){n.drawImage(t,0,0,a.width,a.height);let l=await new Promise(s=>a.toBlob(s,"image/jpeg",.92));if(l){this.#v();let s=new File([l],`capture_${Date.now()}.jpg`,{type:"image/jpeg"});await this.addFiles([s]);return}}}if(!(typeof navigator<"u"&&navigator.webdriver===!0)&&typeof navigator<"u"&&navigator.mediaDevices?.getUserMedia&&t)try{this.#i=await navigator.mediaDevices.getUserMedia({video:{facingMode:{ideal:"environment"},width:{ideal:1920},height:{ideal:1080}},audio:!1}),t.srcObject=this.#i,t.style.display="block",await t.play();let a=e?.querySelector(".copio-camera-placeholder");a&&(a.style.display="none");let n=e?.getElementById("step-pill-text");n&&(n.textContent="Camera Active \xB7 Tap Shutter to Snap");return}catch{}let r=e?.getElementById("internal-file-input");r&&typeof r.click=="function"&&r.click()}async#E(){let t=(await this.getPages())[this.#o];if(!t)return;this.#a&&(this.#a=!1,this.#l=null);let r=((t.edits?.rotate||0)+90)%360;await this.#e.applyEdit(this.#n,t.id,{rotate:r}),await this.#s()}async#S(){let t=(await this.getPages())[this.#o];if(!t)return;this.#a&&(this.#a=!1,this.#l=null);let r=(t.edits?.filter||"none")==="bw"?"none":"bw";await this.#e.applyEdit(this.#n,t.id,{filter:r}),await this.#s()}async#C(){let t=(await this.getPages())[this.#o];if(t){if(this.#a){this.#a=!1;let o=this.#l;if(this.#l=null,o){let r=t.edits?.rotate||0,a=Bt(o,r);await this.#e.applyEdit(this.#n,t.id,{crop:a})}}else this.#a=!0;await this.#s()}}async#k(){let e=await this.getPages(),t=e[this.#o];if(!t)return;let o=t.id;await this.#e.deletePage(this.#n,o),this.dispatch(B.PAGE_REMOVED,{pageId:o,docId:this.docId}),this.#o>=e.length-1&&(this.#o=Math.max(0,e.length-2)),this.#O(),await this.#s()}#O(){let e=this.shadowRoot;if(!e)return;let t=e.getElementById("toast-region");if(!t)return;this.#p&&clearInterval(this.#p),this.#m=5;let o=()=>{t.innerHTML=`
|
|
2581
2452
|
<div class="copio-toast copio-toast-undo">
|
|
2582
2453
|
<span>Page deleted</span>
|
|
2583
2454
|
<button type="button" class="copio-btn-toast-undo" id="btn-toast-undo">
|
|
2584
2455
|
Undo (${this.#m}s)
|
|
2585
2456
|
</button>
|
|
2586
2457
|
</div>
|
|
2587
|
-
`,e.getElementById("btn-toast-undo")?.addEventListener("click",async()=>{clearInterval(this.#
|
|
2458
|
+
`,e.getElementById("btn-toast-undo")?.addEventListener("click",async()=>{clearInterval(this.#p),this.#p=null,t.innerHTML="",await this.#e.undo(this.#n),await this.#s()})};o(),this.#p=setInterval(()=>{this.#m-=1,this.#m<=0?(clearInterval(this.#p),this.#p=null,t.innerHTML=""):o()},1e3)}async#M(){let e=this.shadowRoot;if(!e)return;let t=e.getElementById("ocr-sheet"),o=e.getElementById("ocr-body");if(!(!t||!o)){t.style.display="block",o.innerHTML='<p class="copio-ocr-loading">Recognizing text...</p>';try{let a=(await this.getPages())[this.#o],n=await this.ocr(a?.id||null),l=n.averageConfidence||0,s=l<=1&&l>0?Math.round(l*100):Math.round(l);o.innerHTML=`
|
|
2588
2459
|
<div class="copio-ocr-content">
|
|
2589
2460
|
<pre class="copio-ocr-text">${n.text||"No text detected."}</pre>
|
|
2590
2461
|
<div class="copio-ocr-meta">
|
|
2591
|
-
<span>Confidence: ${
|
|
2462
|
+
<span>Confidence: ${s}%</span>
|
|
2592
2463
|
</div>
|
|
2593
2464
|
</div>
|
|
2594
|
-
`}catch(r){o.innerHTML=`<p class="copio-ocr-error">OCR recognition failed: ${r.message}</p>`}}}#
|
|
2465
|
+
`}catch(r){o.innerHTML=`<p class="copio-ocr-error">OCR recognition failed: ${r.message}</p>`}}}#R(){let e=this.shadowRoot;if(!e)return;let t=e.getElementById("ocr-sheet");t&&(t.style.display="none")}async#B(){if(this.aspect==="card"&&this.maxPages===2&&this.#h===1){this.stage="viewfinder";return}let e=await this.getPages();if(this.aspect==="card"&&this.maxPages===2&&e.length===1){this.stage="viewfinder";return}let t=e.map((r,a)=>({id:r.id,pageNumber:a+1,label:r.label||`Page ${a+1}`,originalSrc:r.originalSrc,src:r.src,originalPreserved:!0,dimensions:{width:r.width||0,height:r.height||0},edits:r.edits||{crop:{x:0,y:0,w:1,h:1},rotate:0,filter:"none"},ocrText:r.ocrText||null,blob:r.blob||null})),o={mode:this.mode,aspect:this.aspect,docId:this.docId,pageCount:t.length,pages:t};this.mode==="single"&&(o.page=t[0]||null,this.maxPages>1&&(o.maxPages=this.maxPages)),this.dispatch(B.SCAN_COMPLETE,o)}get theme(){return typeof this.getAttribute=="function"&&this.getAttribute("theme")||"dark"}set theme(e){typeof this.setAttribute=="function"&&(e?this.setAttribute("theme",e):this.removeAttribute("theme"))}get mode(){return typeof this.getAttribute=="function"&&this.getAttribute("mode")||"document"}set mode(e){typeof this.setAttribute=="function"&&this.setAttribute("mode",e)}get aspect(){return typeof this.getAttribute=="function"&&this.getAttribute("aspect")||"auto"}set aspect(e){typeof this.setAttribute=="function"&&this.setAttribute("aspect",e)}get stage(){return this.#r}set stage(e){if(e==="viewfinder"||e==="workbench"){this.#r=e,typeof this.setAttribute=="function"&&this.getAttribute("stage")!==e&&this.setAttribute("stage",e);let t=this.shadowRoot;if(t){let o=t.getElementById("viewfinder-section"),r=t.getElementById("workbench-section");o&&r&&(o.style.display=e==="viewfinder"?"flex":"none",r.style.display=e==="workbench"?"flex":"none")}this.#s()}}get docId(){return typeof this.getAttribute=="function"?this.getAttribute("doc-id"):null}set docId(e){typeof this.setAttribute=="function"&&(e?this.setAttribute("doc-id",e):this.removeAttribute("doc-id"))}async rotateActivePage(){return this.#E()}async toggleActivePageBw(){return this.#S()}async toggleCropMode(){return this.#C()}async deleteActivePageWithUndo(){return this.#k()}get features(){return this.#e?this.#e.features:[]}set features(e){if(typeof this.setAttribute=="function"){let t=Array.isArray(e)?e.join(" "):String(e||"");this.setAttribute("features",t)}this.#e&&this.#e.setFeatures(e)}hasFeature(e){return this.#e?this.#e.hasFeature(e):!1}get ocrEnabled(){return this.#e?this.#e.ocr:!0}set ocrEnabled(e){let t=!!e;typeof this.setAttribute=="function"&&this.setAttribute("ocr",t?"true":"false"),this.#e&&(this.#e.ocr=t),this.#g()}get pdf(){return this.#e?this.#e.pdf:!0}set pdf(e){let t=!!e;typeof this.setAttribute=="function"&&this.setAttribute("pdf",t?"true":"false"),this.#e&&(this.#e.pdf=t),this.#g()}get exportFormats(){return this.#e?this.#e.exportFormats:[]}set exportFormats(e){if(typeof this.setAttribute=="function"){let t=Array.isArray(e)?e.join(","):String(e||"");this.setAttribute("export-formats",t)}this.#e&&(this.#e.exportFormats=e)}get ocrLanguages(){return this.#e?this.#e.ocrLanguages:[]}set ocrLanguages(e){if(typeof this.setAttribute=="function"){let t=Array.isArray(e)?e.join(","):String(e||"");this.setAttribute("ocr-languages",t)}this.#e&&(this.#e.ocrLanguages=e)}get maxPages(){return this.#e?this.#e.maxPages:0}set maxPages(e){typeof this.setAttribute=="function"&&this.setAttribute("max-pages",String(e)),this.#e&&(this.#e.maxPages=e)}get assetBase(){return this.#e?this.#e.assetBase:""}set assetBase(e){typeof this.setAttribute=="function"&&this.setAttribute("asset-base",String(e||"")),this.#e&&(this.#e.assetBase=e)}get licenseKey(){return this.#e?this.#e.licenseKey:""}set licenseKey(e){typeof this.setAttribute=="function"&&this.setAttribute("license-key",String(e||"")),this.#e&&(this.#e.licenseKey=e)}get storage(){return this.#t}set storage(e){this.#t=e,this.#e&&this.#e.setStorage(e)}get engine(){return this.#e}set engine(e){e instanceof nt&&(this.#e=e)}dispatch(e,t={}){return Nt(this,e,t)}async open(){this.#d=!0,typeof this.focus=="function"&&this.focus()}async close(){this.#d=!1,this.#v()}get isOpen(){return this.#d}async capture(){return new Promise(e=>{let t=document.createElement("input");t.type="file",t.accept="image/*",t.capture="environment",t.style.display="none",t.onchange=async()=>{try{if(t.files&&t.files.length>0){let o=await this.addFiles([t.files[0]]);e(o[0]||null)}else e(null)}catch(o){this.dispatch(B.ERROR,{code:"CAPTURE_FAILED",message:o.message,error:o}),e(null)}finally{t.remove()}},t.onerror=()=>{t.remove(),e(null)},document.body.appendChild(t),t.click()})}async addFiles(e){try{let t=await this.getPages(),o=null;if(t.length>0){if(this.mode==="single"&&this.maxPages<=1)await this.#e.clear(this.#n);else if(this.#u||this.maxPages>0&&t.length>=this.maxPages){let n=Math.min(this.#o,t.length-1),l=t[n];l&&(o=n,await this.#e.deletePage(this.#n,l.id))}}this.#u=!1;let r=await this.#e.addFiles(e,this.#n);for(let n=0;n<r.length;n++)this.dispatch(B.PAGE_ADDED,{page:r[n],pageNumber:n+1,docId:this.docId,source:"file"});let a=await this.getPages();if(o!==null&&r.length===1&&o<a.length-1){let n=a.map(s=>s.id),l=n.pop();l&&(n.splice(o,0,l),await this.#e.reorderPages(this.#n,n),a=await this.getPages())}return this.#h=a.length,r.length>0&&(this.#o=o!==null?Math.min(o,Math.max(0,a.length-1)):Math.max(0,a.length-1),this.mode==="single"&&(this.#r="workbench",typeof this.setAttribute=="function"&&this.getAttribute("stage")!=="workbench"&&this.setAttribute("stage","workbench"))),this.dispatch(B.PAGES_CHANGED,{pages:a,docId:this.docId}),this.mode==="single"&&r.length>0&&this.maxPages<=1&&this.dispatch(B.SCAN_COMPLETE,{mode:this.mode,aspect:this.aspect,docId:this.docId,pages:a,page:a[a.length-1]||null,pageCount:a.length}),await this.#s(),r}catch(t){throw this.dispatch(B.ERROR,{code:t.code||"ADD_FILES_FAILED",message:t.message,error:t}),t}}async getPages(){return this.#e.getPages(this.#n)}async clear(){this.#v(),this.#o=0,this.#h=0,this.#u=!1,this.#a=!1,await this.#e.clear(this.#n),this.dispatch(B.PAGES_CHANGED,{pages:[],docId:this.docId}),await this.#s()}async exportPdf(e={}){try{let t=await this.#e.exportPdf(this.#n,e);return this.dispatch(B.EXPORT_COMPLETE,{type:"pdf",format:"pdf",blob:t,searchable:!!e.searchable,docId:this.docId}),t}catch(t){throw this.dispatch(B.ERROR,{code:t.code||"EXPORT_FAILED",message:t.message,error:t}),t}}async exportZip(e={}){try{let t=await this.#e.exportZip(this.#n,e);return this.dispatch(B.EXPORT_COMPLETE,{type:"zip",format:"zip",blob:t,docId:this.docId}),t}catch(t){throw this.dispatch(B.ERROR,{code:t.code||"EXPORT_FAILED",message:t.message,error:t}),t}}async ocr(e=null,t={}){try{let o=await this.#e.runOcr(this.#n,e,t);return this.dispatch(B.OCR_COMPLETE,{text:o.text,pages:o.pagesResults,averageConfidence:o.averageConfidence,docId:this.docId,pageId:e}),o}catch(o){throw this.dispatch(B.ERROR,{code:o.code||"OCR_FAILED",message:o.message,error:o}),o}}async runOcr(e=null,t={}){return this.ocr(e,t)}async sync(e={}){try{return await this.#e.sync({onStateChange:o=>{o&&(o.step==="connected"||o.step==="syncing")&&this.dispatch(B.SYNC_CONNECTED,{peerId:o.peerId,mode:o.mode}),e.onStateChange&&e.onStateChange(o)}})}catch(t){throw this.dispatch(B.ERROR,{code:t.code||"SYNC_FAILED",message:t.message,error:t}),t}}};typeof customElements<"u"&&!customElements.get("copio-scanner")&&customElements.define("copio-scanner",Dt);export{Je as a,et as b,tt as c,ot as d,it as e,rt as f,kt as g,co as h,po as i,Dt as j};
|
|
2595
2466
|
/**!
|
|
2596
2467
|
* Sortable 1.15.6
|
|
2597
2468
|
* @author RubaXa <trash@rubaxa.org>
|
|
2598
2469
|
* @author owenm <owen23355@gmail.com>
|
|
2599
2470
|
* @license MIT
|
|
2600
2471
|
*/
|
|
2601
|
-
//# sourceMappingURL=chunk-
|
|
2472
|
+
//# sourceMappingURL=chunk-4XWSVHFW.js.map
|