@copio/sdk 0.1.3 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +154 -151
- package/dist/adapters/image/canvas2d-adapter.js +1 -1
- package/dist/adapters/image/index.js +1 -1
- package/dist/adapters/index.js +1 -1
- package/dist/adapters/indexeddb-adapter.js +1 -1
- package/dist/adapters/pdf/index.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/cdn.js +42 -1119
- package/dist/{chunk-534NMCRQ.js → chunk-G5EUMLYT.js} +2 -2
- package/dist/{chunk-4YYY7PHH.js → chunk-GGERQ3CJ.js} +11 -11
- package/dist/chunk-K4NR6OAC.js +2 -0
- package/dist/chunk-L4OVZN23.js +2 -0
- package/dist/chunk-NQW6FFN7.js +50 -0
- package/dist/{chunk-DOKG4LX2.js → chunk-O7IV7A6O.js} +2 -2
- package/dist/chunk-Q7XPZMZA.js +1395 -0
- package/dist/core.js +1 -1
- package/dist/custom-elements.json +260 -1770
- package/dist/index.js +2 -2
- package/dist/scanner.js +16 -1120
- package/dist/sync.js +1 -1
- package/dist/types/sdk/elements.d.ts +0 -12
- package/dist/types/sdk/index.d.ts +0 -6
- package/dist/types/sdk/scanner.d.ts +2 -7
- package/dist/types/sdk/version.d.ts +1 -1
- package/package.json +2 -2
- package/sdk/index.js +0 -6
- package/sdk/scanner.js +5 -12
- package/sdk/version.js +1 -1
- package/dist/chunk-4XWSVHFW.js +0 -2472
- package/dist/chunk-5KUKBKWL.js +0 -33
- package/dist/chunk-DY5ZSP4Q.js +0 -2
- package/dist/chunk-IH2AI54D.js +0 -2
- package/dist/chunk-RDCHJL6F.js +0 -2
- package/dist/chunk-XEN5VKAV.js +0 -19
- package/dist/types/js/components/copio-header.d.ts +0 -23
- package/dist/types/js/components/copio-loader.d.ts +0 -6
- package/dist/types/js/core/store.d.ts +0 -2
- package/dist/types/js/routes/add-edit/copio-add-edit-dialog.d.ts +0 -9
- package/dist/types/js/routes/doc/copio-carousel.d.ts +0 -42
- package/dist/types/js/routes/doc/copio-images.d.ts +0 -33
- package/dist/types/js/routes/home/copio-row.d.ts +0 -49
- package/dist/types/js/styles/cropper-styles.d.ts +0 -5
package/dist/chunk-4XWSVHFW.js
DELETED
|
@@ -1,2472 +0,0 @@
|
|
|
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
|
-
.cropper-container {
|
|
3
|
-
direction: ltr;
|
|
4
|
-
font-size: 0;
|
|
5
|
-
line-height: 0;
|
|
6
|
-
position: relative;
|
|
7
|
-
-ms-touch-action: none;
|
|
8
|
-
touch-action: none;
|
|
9
|
-
-webkit-user-select: none;
|
|
10
|
-
-moz-user-select: none;
|
|
11
|
-
-ms-user-select: none;
|
|
12
|
-
user-select: none;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.cropper-container img {
|
|
16
|
-
display: block;
|
|
17
|
-
height: 100%;
|
|
18
|
-
image-orientation: 0deg;
|
|
19
|
-
max-height: none !important;
|
|
20
|
-
max-width: none !important;
|
|
21
|
-
min-height: 0 !important;
|
|
22
|
-
min-width: 0 !important;
|
|
23
|
-
width: 100%;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.cropper-wrap-box,
|
|
27
|
-
.cropper-canvas,
|
|
28
|
-
.cropper-drag-box,
|
|
29
|
-
.cropper-crop-box,
|
|
30
|
-
.cropper-modal {
|
|
31
|
-
bottom: 0;
|
|
32
|
-
left: 0;
|
|
33
|
-
position: absolute;
|
|
34
|
-
right: 0;
|
|
35
|
-
top: 0;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.cropper-wrap-box,
|
|
39
|
-
.cropper-canvas {
|
|
40
|
-
overflow: hidden;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.cropper-drag-box {
|
|
44
|
-
background-color: #fff;
|
|
45
|
-
opacity: 0;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.cropper-modal {
|
|
49
|
-
background-color: #000;
|
|
50
|
-
opacity: 0.5;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.cropper-view-box {
|
|
54
|
-
display: block;
|
|
55
|
-
height: 100%;
|
|
56
|
-
outline-color: rgba(51, 153, 255, 0.75);
|
|
57
|
-
outline: 1px solid #39f;
|
|
58
|
-
overflow: hidden;
|
|
59
|
-
width: 100%;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
.cropper-dashed {
|
|
63
|
-
border: 0 dashed #eee;
|
|
64
|
-
display: block;
|
|
65
|
-
opacity: 0.5;
|
|
66
|
-
position: absolute;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
.cropper-dashed.dashed-h {
|
|
70
|
-
border-bottom-width: 1px;
|
|
71
|
-
border-top-width: 1px;
|
|
72
|
-
height: 33.33333%;
|
|
73
|
-
left: 0;
|
|
74
|
-
top: 33.33333%;
|
|
75
|
-
width: 100%;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
.cropper-dashed.dashed-v {
|
|
79
|
-
border-left-width: 1px;
|
|
80
|
-
border-right-width: 1px;
|
|
81
|
-
height: 100%;
|
|
82
|
-
left: 33.33333%;
|
|
83
|
-
top: 0;
|
|
84
|
-
width: 33.33333%;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
.cropper-center {
|
|
88
|
-
display: block;
|
|
89
|
-
height: 0;
|
|
90
|
-
left: 50%;
|
|
91
|
-
opacity: 0.75;
|
|
92
|
-
position: absolute;
|
|
93
|
-
top: 50%;
|
|
94
|
-
width: 0;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
.cropper-center:before,
|
|
98
|
-
.cropper-center:after {
|
|
99
|
-
background-color: #eee;
|
|
100
|
-
content: ' ';
|
|
101
|
-
display: block;
|
|
102
|
-
position: absolute;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
.cropper-center:before {
|
|
106
|
-
height: 1px;
|
|
107
|
-
left: -3px;
|
|
108
|
-
top: 0;
|
|
109
|
-
width: 7px;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
.cropper-center:after {
|
|
113
|
-
height: 7px;
|
|
114
|
-
left: 0;
|
|
115
|
-
top: -3px;
|
|
116
|
-
width: 1px;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
.cropper-face,
|
|
120
|
-
.cropper-line,
|
|
121
|
-
.cropper-point {
|
|
122
|
-
display: block;
|
|
123
|
-
height: 100%;
|
|
124
|
-
opacity: 0.1;
|
|
125
|
-
position: absolute;
|
|
126
|
-
width: 100%;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
.cropper-face {
|
|
130
|
-
background-color: #fff;
|
|
131
|
-
left: 0;
|
|
132
|
-
top: 0;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
.cropper-line {
|
|
136
|
-
background-color: #39f;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
.cropper-line.line-e {
|
|
140
|
-
cursor: ew-resize;
|
|
141
|
-
right: -3px;
|
|
142
|
-
top: 0;
|
|
143
|
-
width: 5px;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
.cropper-line.line-n {
|
|
147
|
-
cursor: ns-resize;
|
|
148
|
-
height: 5px;
|
|
149
|
-
left: 0;
|
|
150
|
-
top: -3px;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
.cropper-line.line-w {
|
|
154
|
-
cursor: ew-resize;
|
|
155
|
-
left: -3px;
|
|
156
|
-
top: 0;
|
|
157
|
-
width: 5px;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
.cropper-line.line-s {
|
|
161
|
-
bottom: -3px;
|
|
162
|
-
cursor: ns-resize;
|
|
163
|
-
height: 5px;
|
|
164
|
-
left: 0;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
.cropper-point {
|
|
168
|
-
width: var(--copio-crop-handle-hit, 48px);
|
|
169
|
-
height: var(--copio-crop-handle-hit, 48px);
|
|
170
|
-
min-width: 44px;
|
|
171
|
-
min-height: 44px;
|
|
172
|
-
background-color: transparent;
|
|
173
|
-
opacity: 1;
|
|
174
|
-
display: flex;
|
|
175
|
-
align-items: center;
|
|
176
|
-
justify-content: center;
|
|
177
|
-
box-sizing: border-box;
|
|
178
|
-
touch-action: none;
|
|
179
|
-
z-index: 10;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
.cropper-point::after {
|
|
183
|
-
content: '';
|
|
184
|
-
display: block;
|
|
185
|
-
width: var(--copio-crop-handle-visual, 16px);
|
|
186
|
-
height: var(--copio-crop-handle-visual, 16px);
|
|
187
|
-
border-radius: 50%;
|
|
188
|
-
background-color: var(--copio-color-primary, #38bdf8);
|
|
189
|
-
border: 2.5px solid #ffffff;
|
|
190
|
-
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
|
|
191
|
-
transition: transform 120ms ease;
|
|
192
|
-
box-sizing: border-box;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
.cropper-point:hover::after,
|
|
196
|
-
.cropper-point:active::after {
|
|
197
|
-
transform: scale(1.25);
|
|
198
|
-
background-color: var(--copio-color-success, #22c55e);
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
.cropper-point.point-e {
|
|
202
|
-
cursor: ew-resize;
|
|
203
|
-
margin-top: calc(-1 * var(--copio-crop-handle-hit, 48px) / 2);
|
|
204
|
-
right: calc(-1 * var(--copio-crop-handle-hit, 48px) / 2);
|
|
205
|
-
top: 50%;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
.cropper-point.point-n {
|
|
209
|
-
cursor: ns-resize;
|
|
210
|
-
left: 50%;
|
|
211
|
-
margin-left: calc(-1 * var(--copio-crop-handle-hit, 48px) / 2);
|
|
212
|
-
top: calc(-1 * var(--copio-crop-handle-hit, 48px) / 2);
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
.cropper-point.point-w {
|
|
216
|
-
cursor: ew-resize;
|
|
217
|
-
left: calc(-1 * var(--copio-crop-handle-hit, 48px) / 2);
|
|
218
|
-
margin-top: calc(-1 * var(--copio-crop-handle-hit, 48px) / 2);
|
|
219
|
-
top: 50%;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
.cropper-point.point-s {
|
|
223
|
-
bottom: calc(-1 * var(--copio-crop-handle-hit, 48px) / 2);
|
|
224
|
-
cursor: s-resize;
|
|
225
|
-
left: 50%;
|
|
226
|
-
margin-left: calc(-1 * var(--copio-crop-handle-hit, 48px) / 2);
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
.cropper-point.point-ne {
|
|
230
|
-
cursor: nesw-resize;
|
|
231
|
-
right: calc(-1 * var(--copio-crop-handle-hit, 48px) / 2);
|
|
232
|
-
top: calc(-1 * var(--copio-crop-handle-hit, 48px) / 2);
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
.cropper-point.point-nw {
|
|
236
|
-
cursor: nwse-resize;
|
|
237
|
-
left: calc(-1 * var(--copio-crop-handle-hit, 48px) / 2);
|
|
238
|
-
top: calc(-1 * var(--copio-crop-handle-hit, 48px) / 2);
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
.cropper-point.point-sw {
|
|
242
|
-
bottom: calc(-1 * var(--copio-crop-handle-hit, 48px) / 2);
|
|
243
|
-
cursor: nesw-resize;
|
|
244
|
-
left: calc(-1 * var(--copio-crop-handle-hit, 48px) / 2);
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
.cropper-point.point-se {
|
|
248
|
-
bottom: calc(-1 * var(--copio-crop-handle-hit, 48px) / 2);
|
|
249
|
-
cursor: nwse-resize;
|
|
250
|
-
right: calc(-1 * var(--copio-crop-handle-hit, 48px) / 2);
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
.cropper-invisible {
|
|
254
|
-
opacity: 0;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
.cropper-bg {
|
|
258
|
-
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA3NCSVQICAjb4U/gAAAABlBMVEXMzMz////TjRV2AAAACXBIWXMAAArrAAAK6wGCiw1aAAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M26LyyjAAAABFJREFUCJlj+M/AgBVhF/0PAH6/D/HkDxOGAAAAAElFTkSuQmCC');
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
.cropper-hide {
|
|
262
|
-
display: block;
|
|
263
|
-
height: 0;
|
|
264
|
-
position: absolute;
|
|
265
|
-
width: 0;
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
.cropper-hidden {
|
|
269
|
-
display: none !important;
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
.cropper-move {
|
|
273
|
-
cursor: move;
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
.cropper-crop {
|
|
277
|
-
cursor: crosshair;
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
.cropper-disabled .cropper-drag-box,
|
|
281
|
-
.cropper-disabled .cropper-face,
|
|
282
|
-
.cropper-disabled .cropper-line,
|
|
283
|
-
.cropper-disabled .cropper-point {
|
|
284
|
-
cursor: not-allowed;
|
|
285
|
-
}
|
|
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
|
-
<style>
|
|
288
|
-
${lo}
|
|
289
|
-
</style>
|
|
290
|
-
<style>
|
|
291
|
-
.container {
|
|
292
|
-
display: grid;
|
|
293
|
-
grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
|
|
294
|
-
gap: 0.75rem;
|
|
295
|
-
max-width: 100%;
|
|
296
|
-
min-height: 140px;
|
|
297
|
-
padding: 0.5rem;
|
|
298
|
-
border-radius: 8px;
|
|
299
|
-
border: 2px dashed transparent;
|
|
300
|
-
box-sizing: border-box;
|
|
301
|
-
transition: border-color 0.2s, background-color 0.2s;
|
|
302
|
-
}
|
|
303
|
-
.container.drag-over {
|
|
304
|
-
border-color: #3b82f6;
|
|
305
|
-
background-color: rgba(59, 130, 246, 0.08);
|
|
306
|
-
box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.2);
|
|
307
|
-
}
|
|
308
|
-
@container copio-scanner (max-width: 400px) {
|
|
309
|
-
.container {
|
|
310
|
-
grid-template-columns: repeat(2, 1fr);
|
|
311
|
-
gap: 0.5rem;
|
|
312
|
-
padding: 0.25rem;
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
@container copio-scanner (min-width: 401px) and (max-width: 767px) {
|
|
316
|
-
.container {
|
|
317
|
-
grid-template-columns: repeat(3, 1fr);
|
|
318
|
-
gap: 0.75rem;
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
@container copio-scanner (min-width: 768px) {
|
|
322
|
-
.container {
|
|
323
|
-
grid-template-columns: repeat(4, 1fr);
|
|
324
|
-
gap: 1rem;
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
/* Fallbacks if container queries are unsupported or outside named container */
|
|
328
|
-
@supports not (container-type: size) {
|
|
329
|
-
@media (min-width: 640px) {
|
|
330
|
-
.container {
|
|
331
|
-
grid-template-columns: repeat(3, 1fr);
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
@media (min-width: 1024px) {
|
|
335
|
-
.container {
|
|
336
|
-
grid-template-columns: repeat(4, 1fr);
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
.image-wrapper {
|
|
341
|
-
cursor: grab;
|
|
342
|
-
position: relative;
|
|
343
|
-
user-select: none;
|
|
344
|
-
-webkit-user-select: none;
|
|
345
|
-
width: 100%;
|
|
346
|
-
aspect-ratio: 1;
|
|
347
|
-
}
|
|
348
|
-
.image-wrapper:active {
|
|
349
|
-
cursor: grabbing;
|
|
350
|
-
}
|
|
351
|
-
.image-wrapper.dragging {
|
|
352
|
-
opacity: 0.4;
|
|
353
|
-
cursor: grabbing;
|
|
354
|
-
}
|
|
355
|
-
.image-wrapper.sortable-ghost {
|
|
356
|
-
opacity: 0.2;
|
|
357
|
-
}
|
|
358
|
-
.image-menu {
|
|
359
|
-
position: absolute;
|
|
360
|
-
top: 4px;
|
|
361
|
-
right: 4px;
|
|
362
|
-
}
|
|
363
|
-
img {
|
|
364
|
-
width: 100%;
|
|
365
|
-
height: 100%;
|
|
366
|
-
object-fit: cover;
|
|
367
|
-
border: 1px solid #ccc;
|
|
368
|
-
border-radius: 4px;
|
|
369
|
-
display: block;
|
|
370
|
-
}
|
|
371
|
-
#crop-image {
|
|
372
|
-
max-width: 100%;
|
|
373
|
-
max-height: 100%;
|
|
374
|
-
display: block;
|
|
375
|
-
}
|
|
376
|
-
.crop-wrapper {
|
|
377
|
-
width: 100%;
|
|
378
|
-
height: 360px;
|
|
379
|
-
max-height: min(50vh, 380px);
|
|
380
|
-
min-height: 200px;
|
|
381
|
-
position: relative;
|
|
382
|
-
display: flex;
|
|
383
|
-
align-items: center;
|
|
384
|
-
justify-content: center;
|
|
385
|
-
overflow: visible;
|
|
386
|
-
box-sizing: border-box;
|
|
387
|
-
margin-bottom: 0.5rem;
|
|
388
|
-
}
|
|
389
|
-
sl-dialog::part(base) {
|
|
390
|
-
position: absolute;
|
|
391
|
-
}
|
|
392
|
-
sl-dialog::part(overlay) {
|
|
393
|
-
position: absolute;
|
|
394
|
-
}
|
|
395
|
-
sl-dialog::part(panel) {
|
|
396
|
-
max-width: calc(100% - 20px);
|
|
397
|
-
max-height: calc(100% - 20px);
|
|
398
|
-
}
|
|
399
|
-
.crop-dialog::part(panel) {
|
|
400
|
-
max-width: min(94%, 560px);
|
|
401
|
-
max-height: calc(100% - 16px);
|
|
402
|
-
display: flex;
|
|
403
|
-
flex-direction: column;
|
|
404
|
-
}
|
|
405
|
-
.crop-dialog::part(body) {
|
|
406
|
-
padding: 24px;
|
|
407
|
-
overflow: hidden;
|
|
408
|
-
display: flex;
|
|
409
|
-
align-items: center;
|
|
410
|
-
justify-content: center;
|
|
411
|
-
flex: 1 1 auto;
|
|
412
|
-
min-height: 0;
|
|
413
|
-
}
|
|
414
|
-
@container copio-scanner (max-width: 400px) {
|
|
415
|
-
.crop-wrapper {
|
|
416
|
-
height: 240px;
|
|
417
|
-
max-height: 42cqh;
|
|
418
|
-
min-height: 160px;
|
|
419
|
-
}
|
|
420
|
-
.crop-dialog::part(panel) {
|
|
421
|
-
max-width: calc(100% - 12px);
|
|
422
|
-
max-height: calc(100% - 12px);
|
|
423
|
-
}
|
|
424
|
-
.crop-dialog::part(body) {
|
|
425
|
-
padding: 16px;
|
|
426
|
-
}
|
|
427
|
-
.crop-dialog::part(header) {
|
|
428
|
-
padding: 0.5rem 0.75rem;
|
|
429
|
-
}
|
|
430
|
-
.crop-dialog::part(footer) {
|
|
431
|
-
padding: 0.5rem 0.75rem;
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
button.add-btn {
|
|
435
|
-
width: 100%;
|
|
436
|
-
aspect-ratio: 1;
|
|
437
|
-
font-size: 1.6rem;
|
|
438
|
-
border: 2px dashed #888;
|
|
439
|
-
border-radius: 4px;
|
|
440
|
-
background: none;
|
|
441
|
-
cursor: pointer;
|
|
442
|
-
display: flex;
|
|
443
|
-
align-items: center;
|
|
444
|
-
justify-content: center;
|
|
445
|
-
color: #64748b;
|
|
446
|
-
transition: border-color 0.15s, color 0.15s, background-color 0.15s;
|
|
447
|
-
}
|
|
448
|
-
button.add-btn:hover {
|
|
449
|
-
border-color: #3b82f6;
|
|
450
|
-
color: #3b82f6;
|
|
451
|
-
background-color: rgba(59, 130, 246, 0.04);
|
|
452
|
-
}
|
|
453
|
-
dialog {
|
|
454
|
-
border: none;
|
|
455
|
-
border-radius: 6px;
|
|
456
|
-
padding: 1rem;
|
|
457
|
-
}
|
|
458
|
-
dialog::backdrop {
|
|
459
|
-
background: rgba(0, 0, 0, 0.3);
|
|
460
|
-
}
|
|
461
|
-
</style>
|
|
462
|
-
`;this.shadowRoot.innerHTML=`
|
|
463
|
-
${e}
|
|
464
|
-
<div class="container"></div>
|
|
465
|
-
|
|
466
|
-
<input type="file" class="file-input" accept="image/*,application/pdf" multiple style="display: none">
|
|
467
|
-
<input type="file" class="camera-input" accept="image/*" capture="environment" style="display: none">
|
|
468
|
-
|
|
469
|
-
<sl-dialog label="Image Data" class="data-dialog">
|
|
470
|
-
<div class="exif-data" style="font-size: 0.85rem; line-height: 1.6;"></div>
|
|
471
|
-
<sl-button slot="footer" variant="primary" class="close-data">Close</sl-button>
|
|
472
|
-
</sl-dialog>
|
|
473
|
-
|
|
474
|
-
<sl-dialog label="Crop Image" class="crop-dialog" style="--width: min(94%, 560px)">
|
|
475
|
-
<div class="crop-wrapper">
|
|
476
|
-
<img id="crop-image" />
|
|
477
|
-
</div>
|
|
478
|
-
<sl-button slot="footer" variant="default" class="cancel-crop">Cancel</sl-button>
|
|
479
|
-
<sl-button slot="footer" variant="primary" class="apply-crop">Apply</sl-button>
|
|
480
|
-
</sl-dialog>
|
|
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}">
|
|
485
|
-
<sl-button slot="trigger" variant="default" size="small" circle>
|
|
486
|
-
<sl-icon name="three-dots-vertical"></sl-icon>
|
|
487
|
-
</sl-button>
|
|
488
|
-
<sl-menu>
|
|
489
|
-
${this.ocr!==!1?`
|
|
490
|
-
<sl-menu-item value="ocr">
|
|
491
|
-
<sl-icon slot="prefix" name="card-text"></sl-icon> Extract Text
|
|
492
|
-
</sl-menu-item>
|
|
493
|
-
<sl-divider></sl-divider>
|
|
494
|
-
`:""}
|
|
495
|
-
<sl-menu-item value="crop">Crop</sl-menu-item>
|
|
496
|
-
<sl-menu-item value="rotate">Rotate</sl-menu-item>
|
|
497
|
-
<sl-menu-item value="threshold">
|
|
498
|
-
<sl-icon slot="prefix" name="${s?"check-lg":"circle"}"></sl-icon>
|
|
499
|
-
${s?"Remove Black & White":"Black & White"}
|
|
500
|
-
</sl-menu-item>
|
|
501
|
-
<sl-menu-item value="reset" ?disabled=${!l}>
|
|
502
|
-
<sl-icon slot="prefix" name="arrow-counterclockwise"></sl-icon>
|
|
503
|
-
Reset to Original
|
|
504
|
-
</sl-menu-item>
|
|
505
|
-
<sl-menu-item value="showdata">Show Data</sl-menu-item>
|
|
506
|
-
<sl-menu-item value="download">Download Image</sl-menu-item>
|
|
507
|
-
<sl-divider></sl-divider>
|
|
508
|
-
<sl-menu-item value="delete">Delete</sl-menu-item>
|
|
509
|
-
</sl-menu>
|
|
510
|
-
</sl-dropdown>
|
|
511
|
-
</div>
|
|
512
|
-
`}).join("");e.innerHTML=`
|
|
513
|
-
${t}
|
|
514
|
-
<button class="add-btn add-image-btn" title="Add image or PDF" aria-label="Add image or PDF">
|
|
515
|
-
<sl-icon name="plus-lg"></sl-icon>
|
|
516
|
-
</button>
|
|
517
|
-
<button class="add-btn add-camera-btn" title="Capture from camera" aria-label="Capture from camera">
|
|
518
|
-
<sl-icon name="camera"></sl-icon>
|
|
519
|
-
</button>
|
|
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`
|
|
521
|
-
:host {
|
|
522
|
-
display: block;
|
|
523
|
-
position: absolute;
|
|
524
|
-
top: 0;
|
|
525
|
-
left: 0;
|
|
526
|
-
right: 0;
|
|
527
|
-
bottom: 0;
|
|
528
|
-
width: 100%;
|
|
529
|
-
height: 100%;
|
|
530
|
-
z-index: 10;
|
|
531
|
-
overflow: hidden;
|
|
532
|
-
background: #000;
|
|
533
|
-
box-sizing: border-box;
|
|
534
|
-
}
|
|
535
|
-
sl-carousel {
|
|
536
|
-
position: absolute;
|
|
537
|
-
top: 0;
|
|
538
|
-
padding-top: 16px;
|
|
539
|
-
background: white;
|
|
540
|
-
z-index: 4;
|
|
541
|
-
height: 100%;
|
|
542
|
-
width: 100%;
|
|
543
|
-
}
|
|
544
|
-
sl-carousel-item {
|
|
545
|
-
height: 100%;
|
|
546
|
-
}
|
|
547
|
-
.item {
|
|
548
|
-
width: 100%;
|
|
549
|
-
height: 100%;
|
|
550
|
-
background-repeat: no-repeat;
|
|
551
|
-
background-size: contain;
|
|
552
|
-
background-position: center;
|
|
553
|
-
}
|
|
554
|
-
.top-bar {
|
|
555
|
-
position: absolute;
|
|
556
|
-
top: 0;
|
|
557
|
-
left: 0;
|
|
558
|
-
right: 0;
|
|
559
|
-
height: 56px;
|
|
560
|
-
z-index: 10;
|
|
561
|
-
display: flex;
|
|
562
|
-
align-items: center;
|
|
563
|
-
justify-content: space-between;
|
|
564
|
-
padding: 0 16px;
|
|
565
|
-
background: linear-gradient(to bottom, rgba(15, 23, 42, 0.85) 0%, rgba(15, 23, 42, 0.3) 80%, transparent 100%);
|
|
566
|
-
pointer-events: none;
|
|
567
|
-
box-sizing: border-box;
|
|
568
|
-
}
|
|
569
|
-
.top-bar > * {
|
|
570
|
-
pointer-events: auto;
|
|
571
|
-
}
|
|
572
|
-
.top-bar-left {
|
|
573
|
-
display: flex;
|
|
574
|
-
align-items: center;
|
|
575
|
-
gap: 10px;
|
|
576
|
-
min-width: 0;
|
|
577
|
-
}
|
|
578
|
-
.top-bar-right {
|
|
579
|
-
display: flex;
|
|
580
|
-
align-items: center;
|
|
581
|
-
gap: 8px;
|
|
582
|
-
}
|
|
583
|
-
.back {
|
|
584
|
-
font-size: 26px;
|
|
585
|
-
cursor: pointer;
|
|
586
|
-
appearance: none;
|
|
587
|
-
background: rgba(15, 23, 42, 0.6);
|
|
588
|
-
border: 1px solid rgba(255, 255, 255, 0.2);
|
|
589
|
-
border-radius: 8px;
|
|
590
|
-
color: white;
|
|
591
|
-
width: 36px;
|
|
592
|
-
height: 36px;
|
|
593
|
-
display: flex;
|
|
594
|
-
align-items: center;
|
|
595
|
-
justify-content: center;
|
|
596
|
-
transition: background 0.15s;
|
|
597
|
-
}
|
|
598
|
-
.back:hover {
|
|
599
|
-
background: rgba(15, 23, 42, 0.9);
|
|
600
|
-
}
|
|
601
|
-
.doc-heading {
|
|
602
|
-
color: #f8fafc;
|
|
603
|
-
font-size: 1.05rem;
|
|
604
|
-
font-weight: 600;
|
|
605
|
-
white-space: nowrap;
|
|
606
|
-
overflow: hidden;
|
|
607
|
-
text-overflow: ellipsis;
|
|
608
|
-
max-width: 240px;
|
|
609
|
-
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
|
|
610
|
-
}
|
|
611
|
-
.ocr-btn, .export-btn {
|
|
612
|
-
background: rgba(15, 23, 42, 0.75);
|
|
613
|
-
backdrop-filter: blur(8px);
|
|
614
|
-
color: white;
|
|
615
|
-
border: 1px solid rgba(255, 255, 255, 0.2);
|
|
616
|
-
border-radius: 8px;
|
|
617
|
-
padding: 6px 12px;
|
|
618
|
-
height: 36px;
|
|
619
|
-
font-size: 13px;
|
|
620
|
-
display: flex;
|
|
621
|
-
align-items: center;
|
|
622
|
-
gap: 6px;
|
|
623
|
-
cursor: pointer;
|
|
624
|
-
transition: background 0.15s, border-color 0.15s;
|
|
625
|
-
box-sizing: border-box;
|
|
626
|
-
}
|
|
627
|
-
.ocr-btn:hover, .export-btn:hover {
|
|
628
|
-
background: rgba(15, 23, 42, 0.95);
|
|
629
|
-
border-color: rgba(255, 255, 255, 0.4);
|
|
630
|
-
}
|
|
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`
|
|
632
|
-
<sl-carousel-item data-id="${e.id}">
|
|
633
|
-
<div class="item" style="background-image: url('${e.src}')"></div>
|
|
634
|
-
</sl-carousel-item>
|
|
635
|
-
`}render(){let e=this.visibleImages[this.activeSlideIndex],t=this.ocr!==!1&&e&&!!e.src;return R`
|
|
636
|
-
<div class="top-bar">
|
|
637
|
-
<div class="top-bar-left">
|
|
638
|
-
<button class="back" @click=${this.handleBackClick} aria-label="Back">←</button>
|
|
639
|
-
<span class="doc-heading">${this.docName||"Document"}</span>
|
|
640
|
-
</div>
|
|
641
|
-
|
|
642
|
-
<div class="top-bar-right">
|
|
643
|
-
${t?R`
|
|
644
|
-
<button class="ocr-btn" @click=${this.handleOcrClick} aria-label="Extract text">
|
|
645
|
-
<sl-icon name="card-text"></sl-icon>
|
|
646
|
-
<span>Extract Text</span>
|
|
647
|
-
</button>
|
|
648
|
-
`:""}
|
|
649
|
-
|
|
650
|
-
<sl-dropdown>
|
|
651
|
-
<button slot="trigger" class="export-btn" aria-label="Export document">
|
|
652
|
-
<sl-icon name="box-arrow-up"></sl-icon>
|
|
653
|
-
<span>Export</span>
|
|
654
|
-
<sl-icon name="chevron-down" style="font-size: 0.75rem;"></sl-icon>
|
|
655
|
-
</button>
|
|
656
|
-
<sl-menu @sl-select=${this.handleExportSelect}>
|
|
657
|
-
${this.pdf!==!1?R`
|
|
658
|
-
<sl-menu-item value="pdf" ?disabled=${this.pageCount===0}>
|
|
659
|
-
<sl-icon slot="prefix" name="file-earmark-pdf"></sl-icon>
|
|
660
|
-
Download as PDF
|
|
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
|
-
`:""}
|
|
668
|
-
`:""}
|
|
669
|
-
<sl-menu-item value="images" ?disabled=${this.pageCount===0}>
|
|
670
|
-
<sl-icon slot="prefix" name="images"></sl-icon>
|
|
671
|
-
Download as Images (ZIP)
|
|
672
|
-
</sl-menu-item>
|
|
673
|
-
</sl-menu>
|
|
674
|
-
</sl-dropdown>
|
|
675
|
-
</div>
|
|
676
|
-
</div>
|
|
677
|
-
|
|
678
|
-
<sl-carousel
|
|
679
|
-
class="sl-carousel"
|
|
680
|
-
orientation="vertical"
|
|
681
|
-
@sl-slide-change=${this.handleSlideChange}
|
|
682
|
-
>
|
|
683
|
-
${this.visibleImages.map(o=>this.renderItem(o))}
|
|
684
|
-
</sl-carousel>
|
|
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`
|
|
686
|
-
<sl-dialog
|
|
687
|
-
label="Add / Edit"
|
|
688
|
-
class="dialog-add-edit"
|
|
689
|
-
style="--width: min(94%, 640px)"
|
|
690
|
-
@sl-after-hide=${this.#c}
|
|
691
|
-
@keydown=${this.#d}
|
|
692
|
-
>
|
|
693
|
-
<div style="min-height: min(65cqh, 420px); min-height: 350px;">
|
|
694
|
-
<sl-input
|
|
695
|
-
disabled
|
|
696
|
-
class="dialog-add-edit-input-id"
|
|
697
|
-
placeholder="id"
|
|
698
|
-
style="display: none"
|
|
699
|
-
></sl-input>
|
|
700
|
-
<div class="dialog-name-field" style="max-width: 300px">
|
|
701
|
-
<sl-input
|
|
702
|
-
class="dialog-add-edit-input-name"
|
|
703
|
-
placeholder="Enter name of document or image"
|
|
704
|
-
@sl-input=${this.#t}
|
|
705
|
-
></sl-input>
|
|
706
|
-
<div
|
|
707
|
-
class="dialog-name-error"
|
|
708
|
-
style="color: #ef4444; font-size: 0.8rem; margin-top: 4px; display: none;"
|
|
709
|
-
>
|
|
710
|
-
Please enter a document name
|
|
711
|
-
</div>
|
|
712
|
-
</div>
|
|
713
|
-
|
|
714
|
-
<copio-images
|
|
715
|
-
style="display: block; margin-top: 1.5rem"
|
|
716
|
-
></copio-images>
|
|
717
|
-
|
|
718
|
-
<br />
|
|
719
|
-
|
|
720
|
-
<sl-button
|
|
721
|
-
class="dialog-add-edit-savebtn"
|
|
722
|
-
style="width: 100%; margin-top: auto;"
|
|
723
|
-
slot="footer"
|
|
724
|
-
variant="primary"
|
|
725
|
-
@click=${this.#r}
|
|
726
|
-
>Save</sl-button
|
|
727
|
-
>
|
|
728
|
-
</div>
|
|
729
|
-
</sl-dialog>
|
|
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`
|
|
731
|
-
.wrapper {
|
|
732
|
-
margin-left: auto;
|
|
733
|
-
margin-right: auto;
|
|
734
|
-
display: flex;
|
|
735
|
-
justify-content: space-between;
|
|
736
|
-
align-items: center;
|
|
737
|
-
max-width: 768px;
|
|
738
|
-
padding: 10px 12px;
|
|
739
|
-
border-bottom: 1px solid #e2e8f0;
|
|
740
|
-
cursor: pointer;
|
|
741
|
-
user-select: none;
|
|
742
|
-
}
|
|
743
|
-
.inner {
|
|
744
|
-
display: flex;
|
|
745
|
-
align-items: center;
|
|
746
|
-
flex: 1;
|
|
747
|
-
min-width: 0;
|
|
748
|
-
}
|
|
749
|
-
.titles {
|
|
750
|
-
display: flex;
|
|
751
|
-
flex-direction: column;
|
|
752
|
-
margin-left: 12px;
|
|
753
|
-
padding: 2px 0;
|
|
754
|
-
flex: 1;
|
|
755
|
-
min-width: 0;
|
|
756
|
-
}
|
|
757
|
-
.doc-title {
|
|
758
|
-
font-weight: 600;
|
|
759
|
-
font-size: 0.95rem;
|
|
760
|
-
color: #151f2a;
|
|
761
|
-
white-space: nowrap;
|
|
762
|
-
overflow: hidden;
|
|
763
|
-
text-overflow: ellipsis;
|
|
764
|
-
line-height: 1.3;
|
|
765
|
-
}
|
|
766
|
-
.doc-page-count {
|
|
767
|
-
font-size: 0.8rem;
|
|
768
|
-
color: #64748b;
|
|
769
|
-
margin-top: 2px;
|
|
770
|
-
}
|
|
771
|
-
.rename-container {
|
|
772
|
-
display: flex;
|
|
773
|
-
align-items: center;
|
|
774
|
-
gap: 6px;
|
|
775
|
-
width: 100%;
|
|
776
|
-
max-width: 320px;
|
|
777
|
-
}
|
|
778
|
-
.rename-container sl-input {
|
|
779
|
-
flex: 1;
|
|
780
|
-
}
|
|
781
|
-
button {
|
|
782
|
-
appearance: none;
|
|
783
|
-
border: none;
|
|
784
|
-
color: black;
|
|
785
|
-
padding: 3px 4px 3px 7px;
|
|
786
|
-
background: white;
|
|
787
|
-
cursor: pointer;
|
|
788
|
-
}
|
|
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`
|
|
790
|
-
<div class="wrapper" @click=${this.#e}>
|
|
791
|
-
<div class="inner">
|
|
792
|
-
<sl-avatar label="Document icon">
|
|
793
|
-
<sl-icon slot="icon" name="file-earmark-text"></sl-icon>
|
|
794
|
-
</sl-avatar>
|
|
795
|
-
|
|
796
|
-
<div class="titles">
|
|
797
|
-
${this.isRenaming?R`
|
|
798
|
-
<div class="rename-container" @click=${e=>e.stopPropagation()}>
|
|
799
|
-
<sl-input
|
|
800
|
-
class="rename-input"
|
|
801
|
-
size="small"
|
|
802
|
-
.value=${this.renameValue}
|
|
803
|
-
@sl-input=${e=>this.renameValue=e.target.value}
|
|
804
|
-
@keydown=${this.handleRenameKeyDown}
|
|
805
|
-
></sl-input>
|
|
806
|
-
<sl-icon-button
|
|
807
|
-
name="check-lg"
|
|
808
|
-
label="Save rename"
|
|
809
|
-
@click=${this.commitRename}
|
|
810
|
-
></sl-icon-button>
|
|
811
|
-
<sl-icon-button
|
|
812
|
-
name="x-lg"
|
|
813
|
-
label="Cancel rename"
|
|
814
|
-
@click=${this.cancelRename}
|
|
815
|
-
></sl-icon-button>
|
|
816
|
-
</div>
|
|
817
|
-
`:R`
|
|
818
|
-
<div class="doc-title">${this.name||"Untitled Document"}</div>
|
|
819
|
-
<div class="doc-page-count">
|
|
820
|
-
${this.pageCount} ${this.pageCount===1?"page":"pages"}
|
|
821
|
-
</div>
|
|
822
|
-
`}
|
|
823
|
-
</div>
|
|
824
|
-
</div>
|
|
825
|
-
|
|
826
|
-
<sl-dropdown>
|
|
827
|
-
<sl-button slot="trigger" variant="default" size="small" circle>
|
|
828
|
-
<sl-icon name="three-dots-vertical"></sl-icon>
|
|
829
|
-
</sl-button>
|
|
830
|
-
<sl-menu @sl-select=${this.#t}>
|
|
831
|
-
<sl-menu-item value="edit">
|
|
832
|
-
<sl-icon slot="prefix" name="sliders"></sl-icon>
|
|
833
|
-
Edit
|
|
834
|
-
</sl-menu-item>
|
|
835
|
-
<sl-menu-item value="rename">
|
|
836
|
-
<sl-icon slot="prefix" name="pencil"></sl-icon>
|
|
837
|
-
Rename
|
|
838
|
-
</sl-menu-item>
|
|
839
|
-
${this.ocr!==!1?R`
|
|
840
|
-
<sl-menu-item
|
|
841
|
-
value="extract-ocr"
|
|
842
|
-
?disabled=${!this.hasImages}
|
|
843
|
-
title=${this.hasImages?"Extract text with OCR":"No image pages in document"}
|
|
844
|
-
>
|
|
845
|
-
<sl-icon slot="prefix" name="card-text"></sl-icon>
|
|
846
|
-
Extract All Text (OCR)
|
|
847
|
-
</sl-menu-item>
|
|
848
|
-
`:""}
|
|
849
|
-
<sl-divider></sl-divider>
|
|
850
|
-
${this.pdf!==!1?R`
|
|
851
|
-
<sl-menu-item
|
|
852
|
-
value="download"
|
|
853
|
-
?disabled=${this.pageCount===0}
|
|
854
|
-
title=${this.pageCount===0?"Document is empty":"Download as PDF"}
|
|
855
|
-
>
|
|
856
|
-
<sl-icon slot="prefix" name="file-earmark-pdf"></sl-icon>
|
|
857
|
-
Download as PDF
|
|
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
|
-
`:""}
|
|
869
|
-
`:""}
|
|
870
|
-
<sl-menu-item
|
|
871
|
-
value="download-images"
|
|
872
|
-
?disabled=${this.pageCount===0}
|
|
873
|
-
title=${this.pageCount===0?"Document is empty":"Download as Images"}
|
|
874
|
-
>
|
|
875
|
-
<sl-icon slot="prefix" name="images"></sl-icon>
|
|
876
|
-
Download as Images
|
|
877
|
-
</sl-menu-item>
|
|
878
|
-
<sl-divider></sl-divider>
|
|
879
|
-
<sl-menu-item value="delete">
|
|
880
|
-
<sl-icon slot="prefix" name="trash"></sl-icon>
|
|
881
|
-
Delete
|
|
882
|
-
</sl-menu-item>
|
|
883
|
-
</sl-menu>
|
|
884
|
-
</sl-dropdown>
|
|
885
|
-
</div>
|
|
886
|
-
`}};customElements.define("copio-row",ot);var it=class extends G{static styles=re`
|
|
887
|
-
header {
|
|
888
|
-
background-color: #151f2a;
|
|
889
|
-
color: white;
|
|
890
|
-
display: flex;
|
|
891
|
-
align-items: center;
|
|
892
|
-
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
|
893
|
-
padding: 8px;
|
|
894
|
-
}
|
|
895
|
-
.header-left,
|
|
896
|
-
.header-right {
|
|
897
|
-
flex: 1;
|
|
898
|
-
display: flex;
|
|
899
|
-
align-items: center;
|
|
900
|
-
}
|
|
901
|
-
.header-right {
|
|
902
|
-
justify-content: flex-end;
|
|
903
|
-
}
|
|
904
|
-
h1 {
|
|
905
|
-
font-size: 24px;
|
|
906
|
-
margin: 0;
|
|
907
|
-
}
|
|
908
|
-
sl-icon-button::part(base) {
|
|
909
|
-
min-width: 44px;
|
|
910
|
-
min-height: 44px;
|
|
911
|
-
display: inline-flex;
|
|
912
|
-
align-items: center;
|
|
913
|
-
justify-content: center;
|
|
914
|
-
}
|
|
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`
|
|
916
|
-
<header>
|
|
917
|
-
<div class="header-left">
|
|
918
|
-
<sl-dropdown @sl-show=${this.#e}>
|
|
919
|
-
<sl-icon-button
|
|
920
|
-
slot="trigger"
|
|
921
|
-
name="list"
|
|
922
|
-
label="Menu"
|
|
923
|
-
style="font-size: 1.5rem; color: white;"
|
|
924
|
-
></sl-icon-button>
|
|
925
|
-
<sl-menu @sl-select=${this.#t}>
|
|
926
|
-
<sl-menu-item value="link-device">Link another device</sl-menu-item>
|
|
927
|
-
<sl-menu-item value="clear-cache">Clear cache & update</sl-menu-item>
|
|
928
|
-
<sl-divider></sl-divider>
|
|
929
|
-
<sl-menu-item disabled>
|
|
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"})
|
|
934
|
-
</sl-menu-item>
|
|
935
|
-
</sl-menu>
|
|
936
|
-
</sl-dropdown>
|
|
937
|
-
</div>
|
|
938
|
-
<h1>COPIO</h1>
|
|
939
|
-
<div class="header-right"></div>
|
|
940
|
-
</header>
|
|
941
|
-
`}};customElements.define("copio-header",it);var rt=class extends G{disconnectedCallback(){super.disconnectedCallback()}static styles=re`
|
|
942
|
-
.lds-roller {
|
|
943
|
-
display: inline-block;
|
|
944
|
-
position: relative;
|
|
945
|
-
width: 80px;
|
|
946
|
-
height: 80px;
|
|
947
|
-
}
|
|
948
|
-
.lds-roller div {
|
|
949
|
-
animation: lds-roller 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
|
|
950
|
-
transform-origin: 40px 40px;
|
|
951
|
-
}
|
|
952
|
-
.lds-roller div:after {
|
|
953
|
-
content: ' ';
|
|
954
|
-
display: block;
|
|
955
|
-
position: absolute;
|
|
956
|
-
width: 7px;
|
|
957
|
-
height: 7px;
|
|
958
|
-
border-radius: 50%;
|
|
959
|
-
background: #fff;
|
|
960
|
-
margin: -4px 0 0 -4px;
|
|
961
|
-
}
|
|
962
|
-
.lds-roller div:nth-child(1) {
|
|
963
|
-
animation-delay: -0.036s;
|
|
964
|
-
}
|
|
965
|
-
.lds-roller div:nth-child(1):after {
|
|
966
|
-
top: 63px;
|
|
967
|
-
left: 63px;
|
|
968
|
-
}
|
|
969
|
-
.lds-roller div:nth-child(2) {
|
|
970
|
-
animation-delay: -0.072s;
|
|
971
|
-
}
|
|
972
|
-
.lds-roller div:nth-child(2):after {
|
|
973
|
-
top: 68px;
|
|
974
|
-
left: 56px;
|
|
975
|
-
}
|
|
976
|
-
.lds-roller div:nth-child(3) {
|
|
977
|
-
animation-delay: -0.108s;
|
|
978
|
-
}
|
|
979
|
-
.lds-roller div:nth-child(3):after {
|
|
980
|
-
top: 71px;
|
|
981
|
-
left: 48px;
|
|
982
|
-
}
|
|
983
|
-
.lds-roller div:nth-child(4) {
|
|
984
|
-
animation-delay: -0.144s;
|
|
985
|
-
}
|
|
986
|
-
.lds-roller div:nth-child(4):after {
|
|
987
|
-
top: 72px;
|
|
988
|
-
left: 40px;
|
|
989
|
-
}
|
|
990
|
-
.lds-roller div:nth-child(5) {
|
|
991
|
-
animation-delay: -0.18s;
|
|
992
|
-
}
|
|
993
|
-
.lds-roller div:nth-child(5):after {
|
|
994
|
-
top: 71px;
|
|
995
|
-
left: 32px;
|
|
996
|
-
}
|
|
997
|
-
.lds-roller div:nth-child(6) {
|
|
998
|
-
animation-delay: -0.216s;
|
|
999
|
-
}
|
|
1000
|
-
.lds-roller div:nth-child(6):after {
|
|
1001
|
-
top: 68px;
|
|
1002
|
-
left: 24px;
|
|
1003
|
-
}
|
|
1004
|
-
.lds-roller div:nth-child(7) {
|
|
1005
|
-
animation-delay: -0.252s;
|
|
1006
|
-
}
|
|
1007
|
-
.lds-roller div:nth-child(7):after {
|
|
1008
|
-
top: 63px;
|
|
1009
|
-
left: 17px;
|
|
1010
|
-
}
|
|
1011
|
-
.lds-roller div:nth-child(8) {
|
|
1012
|
-
animation-delay: -0.288s;
|
|
1013
|
-
}
|
|
1014
|
-
.lds-roller div:nth-child(8):after {
|
|
1015
|
-
top: 56px;
|
|
1016
|
-
left: 12px;
|
|
1017
|
-
}
|
|
1018
|
-
@keyframes lds-roller {
|
|
1019
|
-
0% {
|
|
1020
|
-
transform: rotate(0deg);
|
|
1021
|
-
}
|
|
1022
|
-
100% {
|
|
1023
|
-
transform: rotate(360deg);
|
|
1024
|
-
}
|
|
1025
|
-
}
|
|
1026
|
-
`;render(){return R`
|
|
1027
|
-
<div
|
|
1028
|
-
style="
|
|
1029
|
-
background: #151f2a;
|
|
1030
|
-
width: 100%;
|
|
1031
|
-
position: absolute;
|
|
1032
|
-
z-index: 5;
|
|
1033
|
-
height: 100%;
|
|
1034
|
-
margin: 0;
|
|
1035
|
-
padding: 0;
|
|
1036
|
-
top: 0;
|
|
1037
|
-
left: 0;
|
|
1038
|
-
"
|
|
1039
|
-
>
|
|
1040
|
-
<img
|
|
1041
|
-
src="copio.svg"
|
|
1042
|
-
style="
|
|
1043
|
-
position: absolute;
|
|
1044
|
-
top: 50%;
|
|
1045
|
-
left: 50%;
|
|
1046
|
-
transform: translate(-50%, -50%);
|
|
1047
|
-
opacity: 0.3;
|
|
1048
|
-
z-index: 1;
|
|
1049
|
-
max-width: 320px;
|
|
1050
|
-
"
|
|
1051
|
-
/>
|
|
1052
|
-
<div
|
|
1053
|
-
class="lds-roller"
|
|
1054
|
-
style="
|
|
1055
|
-
position: absolute;
|
|
1056
|
-
top: calc(50% + -50px);
|
|
1057
|
-
left: 50%;
|
|
1058
|
-
transform: translate(-50%) scale(1);
|
|
1059
|
-
opacity: 0.5;
|
|
1060
|
-
"
|
|
1061
|
-
>
|
|
1062
|
-
<div></div>
|
|
1063
|
-
<div></div>
|
|
1064
|
-
<div></div>
|
|
1065
|
-
<div></div>
|
|
1066
|
-
<div></div>
|
|
1067
|
-
<div></div>
|
|
1068
|
-
<div></div>
|
|
1069
|
-
<div></div>
|
|
1070
|
-
</div>
|
|
1071
|
-
</div>
|
|
1072
|
-
`}};customElements.define("copio-loader",rt);var kt=`
|
|
1073
|
-
:host {
|
|
1074
|
-
all: initial;
|
|
1075
|
-
display: block;
|
|
1076
|
-
position: relative;
|
|
1077
|
-
width: 100%;
|
|
1078
|
-
height: 100%;
|
|
1079
|
-
min-height: 200px;
|
|
1080
|
-
container-type: size;
|
|
1081
|
-
container-name: copio-scanner;
|
|
1082
|
-
overflow: hidden;
|
|
1083
|
-
contain: layout;
|
|
1084
|
-
box-sizing: border-box;
|
|
1085
|
-
text-align: left;
|
|
1086
|
-
direction: ltr;
|
|
1087
|
-
-webkit-font-smoothing: antialiased;
|
|
1088
|
-
-moz-osx-font-smoothing: grayscale;
|
|
1089
|
-
--copio-font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
1090
|
-
--copio-font-mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
|
|
1091
|
-
--copio-color-bg: #0b0f17;
|
|
1092
|
-
--copio-color-surface: #131b26;
|
|
1093
|
-
--copio-color-surface-elevated: #1c2736;
|
|
1094
|
-
--copio-color-surface-overlay: rgba(15, 22, 32, 0.88);
|
|
1095
|
-
--copio-color-stage-bg: #070a0f;
|
|
1096
|
-
--copio-color-text: #f1f5f9;
|
|
1097
|
-
--copio-color-text-muted: #94a3b8;
|
|
1098
|
-
--copio-color-text-inverse: #090d14;
|
|
1099
|
-
--copio-color-primary: #38bdf8;
|
|
1100
|
-
--copio-color-primary-hover: #7dd3fc;
|
|
1101
|
-
--copio-color-primary-contrast: #06131f;
|
|
1102
|
-
--copio-color-success: #22c55e;
|
|
1103
|
-
--copio-color-warning: #f59e0b;
|
|
1104
|
-
--copio-color-danger: #ef4444;
|
|
1105
|
-
--copio-color-border: rgba(148, 163, 184, 0.18);
|
|
1106
|
-
--copio-color-border-strong: rgba(148, 163, 184, 0.34);
|
|
1107
|
-
--copio-focus-ring: 0 0 0 2px #0b0f17, 0 0 0 4px #38bdf8;
|
|
1108
|
-
--copio-radius-sm: 6px;
|
|
1109
|
-
--copio-radius-md: 10px;
|
|
1110
|
-
--copio-radius-lg: 14px;
|
|
1111
|
-
--copio-radius-pill: 9999px;
|
|
1112
|
-
--copio-spacing-xs: 4px;
|
|
1113
|
-
--copio-spacing-sm: 8px;
|
|
1114
|
-
--copio-spacing-md: 12px;
|
|
1115
|
-
--copio-spacing-lg: 16px;
|
|
1116
|
-
--copio-spacing-xl: 24px;
|
|
1117
|
-
--copio-touch-target-min: 44px;
|
|
1118
|
-
--copio-crop-handle-hit: 48px;
|
|
1119
|
-
--copio-crop-handle-visual: 16px;
|
|
1120
|
-
--copio-shadow-elevated: 0 12px 32px -4px rgba(0, 0, 0, 0.55);
|
|
1121
|
-
--copio-transition-fast: 150ms cubic-bezier(0.22, 1, 0.36, 1);
|
|
1122
|
-
--copio-transition-normal: 240ms cubic-bezier(0.22, 1, 0.36, 1);
|
|
1123
|
-
--sl-font-sans: var(--copio-font-family);
|
|
1124
|
-
--sl-font-mono: var(--copio-font-mono);
|
|
1125
|
-
--sl-color-primary-50: #f0f9ff;
|
|
1126
|
-
--sl-color-primary-100: #e0f2fe;
|
|
1127
|
-
--sl-color-primary-200: #bae6fd;
|
|
1128
|
-
--sl-color-primary-300: #7dd3fc;
|
|
1129
|
-
--sl-color-primary-400: #38bdf8;
|
|
1130
|
-
--sl-color-primary-500: #0ea5e9;
|
|
1131
|
-
--sl-color-primary-600: var(--copio-color-primary);
|
|
1132
|
-
--sl-color-primary-700: #0369a1;
|
|
1133
|
-
--sl-color-primary-800: #075985;
|
|
1134
|
-
--sl-color-primary-900: #0c4a6e;
|
|
1135
|
-
--sl-color-primary-950: #082f49;
|
|
1136
|
-
font-family: var(--copio-font-family);
|
|
1137
|
-
font-size: 14px;
|
|
1138
|
-
line-height: 1.5;
|
|
1139
|
-
color: var(--copio-color-text);
|
|
1140
|
-
background-color: var(--copio-color-bg);
|
|
1141
|
-
color-scheme: dark;
|
|
1142
|
-
}
|
|
1143
|
-
|
|
1144
|
-
:host([theme="dark"]),
|
|
1145
|
-
:host(.copio-theme-dark),
|
|
1146
|
-
:host-context([data-theme="dark"]),
|
|
1147
|
-
:host-context(.sl-theme-dark),
|
|
1148
|
-
:host-context(.theme-dark) {
|
|
1149
|
-
color-scheme: dark;
|
|
1150
|
-
}
|
|
1151
|
-
|
|
1152
|
-
/* Light Theme Override */
|
|
1153
|
-
:host([theme="light"]),
|
|
1154
|
-
:host(.copio-theme-light),
|
|
1155
|
-
:host-context([data-theme="light"]),
|
|
1156
|
-
:host-context(.sl-theme-light),
|
|
1157
|
-
:host-context(.theme-light) {
|
|
1158
|
-
--copio-color-bg: #f8fafc;
|
|
1159
|
-
--copio-color-surface: #ffffff;
|
|
1160
|
-
--copio-color-surface-elevated: #f1f5f9;
|
|
1161
|
-
--copio-color-surface-overlay: rgba(255, 255, 255, 0.92);
|
|
1162
|
-
--copio-color-stage-bg: #1e293b;
|
|
1163
|
-
--copio-color-text: #0f172a;
|
|
1164
|
-
--copio-color-text-muted: #475569;
|
|
1165
|
-
--copio-color-text-inverse: #ffffff;
|
|
1166
|
-
--copio-color-primary: #0284c7;
|
|
1167
|
-
--copio-color-primary-hover: #0369a1;
|
|
1168
|
-
--copio-color-primary-contrast: #ffffff;
|
|
1169
|
-
--copio-color-success: #16a34a;
|
|
1170
|
-
--copio-color-warning: #d97706;
|
|
1171
|
-
--copio-color-danger: #dc2626;
|
|
1172
|
-
--copio-color-border: rgba(15, 23, 42, 0.12);
|
|
1173
|
-
--copio-color-border-strong: rgba(15, 23, 42, 0.26);
|
|
1174
|
-
--copio-focus-ring: 0 0 0 2px #ffffff, 0 0 0 4px #0284c7;
|
|
1175
|
-
--copio-radius-sm: 6px;
|
|
1176
|
-
--copio-radius-md: 10px;
|
|
1177
|
-
--copio-radius-lg: 14px;
|
|
1178
|
-
--copio-shadow-elevated: 0 12px 28px -4px rgba(15, 23, 42, 0.18);
|
|
1179
|
-
color-scheme: light;
|
|
1180
|
-
}
|
|
1181
|
-
|
|
1182
|
-
/* Brand Theme Override (Emerald) */
|
|
1183
|
-
:host([theme="brand"]),
|
|
1184
|
-
:host(.copio-theme-brand),
|
|
1185
|
-
:host-context([data-theme="brand"]),
|
|
1186
|
-
:host-context(.theme-brand) {
|
|
1187
|
-
--copio-color-bg: #0f111a;
|
|
1188
|
-
--copio-color-surface: #181b28;
|
|
1189
|
-
--copio-color-surface-elevated: #23273a;
|
|
1190
|
-
--copio-color-surface-overlay: rgba(24, 27, 40, 0.90);
|
|
1191
|
-
--copio-color-stage-bg: #090a10;
|
|
1192
|
-
--copio-color-text: #f8fafc;
|
|
1193
|
-
--copio-color-text-muted: #9ca3af;
|
|
1194
|
-
--copio-color-text-inverse: #ffffff;
|
|
1195
|
-
--copio-color-primary: #10b981;
|
|
1196
|
-
--copio-color-primary-hover: #34d399;
|
|
1197
|
-
--copio-color-primary-contrast: #042f2e;
|
|
1198
|
-
--copio-color-success: #10b981;
|
|
1199
|
-
--copio-color-warning: #f59e0b;
|
|
1200
|
-
--copio-color-danger: #ef4444;
|
|
1201
|
-
--copio-color-border: rgba(16, 185, 129, 0.22);
|
|
1202
|
-
--copio-color-border-strong: rgba(16, 185, 129, 0.42);
|
|
1203
|
-
--copio-focus-ring: 0 0 0 2px #0f111a, 0 0 0 4px #10b981;
|
|
1204
|
-
--copio-radius-sm: 4px;
|
|
1205
|
-
--copio-radius-md: 8px;
|
|
1206
|
-
--copio-radius-lg: 12px;
|
|
1207
|
-
--copio-shadow-elevated: 0 12px 32px -4px rgba(0, 0, 0, 0.65);
|
|
1208
|
-
color-scheme: dark;
|
|
1209
|
-
}
|
|
1210
|
-
|
|
1211
|
-
/* Auto Theme: follows prefers-color-scheme when theme is auto */
|
|
1212
|
-
@media (prefers-color-scheme: light) {
|
|
1213
|
-
:host([theme="auto"]),
|
|
1214
|
-
:host(.copio-theme-auto) {
|
|
1215
|
-
--copio-color-bg: #f8fafc;
|
|
1216
|
-
--copio-color-surface: #ffffff;
|
|
1217
|
-
--copio-color-surface-elevated: #f1f5f9;
|
|
1218
|
-
--copio-color-surface-overlay: rgba(255, 255, 255, 0.92);
|
|
1219
|
-
--copio-color-stage-bg: #1e293b;
|
|
1220
|
-
--copio-color-text: #0f172a;
|
|
1221
|
-
--copio-color-text-muted: #475569;
|
|
1222
|
-
--copio-color-text-inverse: #ffffff;
|
|
1223
|
-
--copio-color-primary: #0284c7;
|
|
1224
|
-
--copio-color-primary-hover: #0369a1;
|
|
1225
|
-
--copio-color-primary-contrast: #ffffff;
|
|
1226
|
-
--copio-color-success: #16a34a;
|
|
1227
|
-
--copio-color-warning: #d97706;
|
|
1228
|
-
--copio-color-danger: #dc2626;
|
|
1229
|
-
--copio-color-border: rgba(15, 23, 42, 0.12);
|
|
1230
|
-
--copio-color-border-strong: rgba(15, 23, 42, 0.26);
|
|
1231
|
-
--copio-focus-ring: 0 0 0 2px #ffffff, 0 0 0 4px #0284c7;
|
|
1232
|
-
--copio-radius-sm: 6px;
|
|
1233
|
-
--copio-radius-md: 10px;
|
|
1234
|
-
--copio-radius-lg: 14px;
|
|
1235
|
-
--copio-shadow-elevated: 0 12px 28px -4px rgba(15, 23, 42, 0.18);
|
|
1236
|
-
color-scheme: light;
|
|
1237
|
-
}
|
|
1238
|
-
}
|
|
1239
|
-
|
|
1240
|
-
/* ==========================================================================
|
|
1241
|
-
2. INTERNAL ELEMENT RESET (Scoped to Shadow DOM)
|
|
1242
|
-
========================================================================== */
|
|
1243
|
-
*, *::before, *::after {
|
|
1244
|
-
box-sizing: border-box;
|
|
1245
|
-
}
|
|
1246
|
-
|
|
1247
|
-
::slotted(*) {
|
|
1248
|
-
box-sizing: border-box;
|
|
1249
|
-
}
|
|
1250
|
-
|
|
1251
|
-
/* ==========================================================================
|
|
1252
|
-
3. ROOT CONTAINER & COMPONENT SHELL
|
|
1253
|
-
========================================================================== */
|
|
1254
|
-
.copio-scanner-container {
|
|
1255
|
-
width: 100%;
|
|
1256
|
-
height: 100%;
|
|
1257
|
-
position: relative;
|
|
1258
|
-
display: flex;
|
|
1259
|
-
flex-direction: column;
|
|
1260
|
-
overflow: hidden;
|
|
1261
|
-
box-sizing: border-box;
|
|
1262
|
-
container-type: size;
|
|
1263
|
-
container-name: copio-scanner;
|
|
1264
|
-
contain: layout;
|
|
1265
|
-
background: var(--copio-color-bg);
|
|
1266
|
-
color: var(--copio-color-text);
|
|
1267
|
-
font-family: var(--copio-font-family);
|
|
1268
|
-
font-size: 14px;
|
|
1269
|
-
line-height: 1.5;
|
|
1270
|
-
text-align: left;
|
|
1271
|
-
direction: ltr;
|
|
1272
|
-
user-select: none;
|
|
1273
|
-
}
|
|
1274
|
-
|
|
1275
|
-
/* Header (Shadow Part: header) */
|
|
1276
|
-
.copio-header {
|
|
1277
|
-
display: flex;
|
|
1278
|
-
align-items: center;
|
|
1279
|
-
justify-content: space-between;
|
|
1280
|
-
gap: var(--copio-spacing-sm);
|
|
1281
|
-
padding: var(--copio-spacing-sm) var(--copio-spacing-md);
|
|
1282
|
-
background: var(--copio-color-surface);
|
|
1283
|
-
border-bottom: 1px solid var(--copio-color-border);
|
|
1284
|
-
min-height: 52px;
|
|
1285
|
-
flex-shrink: 0;
|
|
1286
|
-
z-index: 5;
|
|
1287
|
-
box-sizing: border-box;
|
|
1288
|
-
}
|
|
1289
|
-
|
|
1290
|
-
.copio-header-left {
|
|
1291
|
-
display: flex;
|
|
1292
|
-
align-items: center;
|
|
1293
|
-
gap: var(--copio-spacing-sm);
|
|
1294
|
-
min-width: 0;
|
|
1295
|
-
}
|
|
1296
|
-
|
|
1297
|
-
.copio-mode-badge {
|
|
1298
|
-
display: inline-flex;
|
|
1299
|
-
align-items: center;
|
|
1300
|
-
gap: 5px;
|
|
1301
|
-
font-size: 11px;
|
|
1302
|
-
font-weight: 600;
|
|
1303
|
-
padding: 4px 8px;
|
|
1304
|
-
border-radius: var(--copio-radius-pill);
|
|
1305
|
-
background: var(--copio-color-surface-elevated);
|
|
1306
|
-
color: var(--copio-color-primary);
|
|
1307
|
-
border: 1px solid var(--copio-color-border);
|
|
1308
|
-
white-space: nowrap;
|
|
1309
|
-
}
|
|
1310
|
-
|
|
1311
|
-
.copio-title-group {
|
|
1312
|
-
display: flex;
|
|
1313
|
-
flex-direction: column;
|
|
1314
|
-
min-width: 0;
|
|
1315
|
-
}
|
|
1316
|
-
|
|
1317
|
-
.copio-title {
|
|
1318
|
-
font-size: 13px;
|
|
1319
|
-
font-weight: 600;
|
|
1320
|
-
color: var(--copio-color-text);
|
|
1321
|
-
margin: 0;
|
|
1322
|
-
white-space: nowrap;
|
|
1323
|
-
overflow: hidden;
|
|
1324
|
-
text-overflow: ellipsis;
|
|
1325
|
-
}
|
|
1326
|
-
|
|
1327
|
-
.copio-subtitle {
|
|
1328
|
-
font-size: 11px;
|
|
1329
|
-
color: var(--copio-color-text-muted);
|
|
1330
|
-
margin: 0;
|
|
1331
|
-
white-space: nowrap;
|
|
1332
|
-
overflow: hidden;
|
|
1333
|
-
text-overflow: ellipsis;
|
|
1334
|
-
}
|
|
1335
|
-
|
|
1336
|
-
.copio-header-actions {
|
|
1337
|
-
display: flex;
|
|
1338
|
-
align-items: center;
|
|
1339
|
-
gap: 6px;
|
|
1340
|
-
flex-shrink: 0;
|
|
1341
|
-
}
|
|
1342
|
-
|
|
1343
|
-
/* Interactive Stage Switcher Pill (Viewfinder vs Workbench) */
|
|
1344
|
-
.copio-stage-tabs {
|
|
1345
|
-
display: inline-flex;
|
|
1346
|
-
background: var(--copio-color-bg);
|
|
1347
|
-
padding: 2px;
|
|
1348
|
-
border-radius: var(--copio-radius-md);
|
|
1349
|
-
border: 1px solid var(--copio-color-border);
|
|
1350
|
-
}
|
|
1351
|
-
|
|
1352
|
-
.copio-stage-tab {
|
|
1353
|
-
appearance: none;
|
|
1354
|
-
border: none;
|
|
1355
|
-
background: transparent;
|
|
1356
|
-
color: var(--copio-color-text-muted);
|
|
1357
|
-
font-family: inherit;
|
|
1358
|
-
font-size: 11px;
|
|
1359
|
-
font-weight: 600;
|
|
1360
|
-
padding: 6px 10px;
|
|
1361
|
-
min-height: var(--copio-touch-target-min);
|
|
1362
|
-
min-width: var(--copio-touch-target-min);
|
|
1363
|
-
border-radius: var(--copio-radius-sm);
|
|
1364
|
-
cursor: pointer;
|
|
1365
|
-
display: inline-flex;
|
|
1366
|
-
align-items: center;
|
|
1367
|
-
justify-content: center;
|
|
1368
|
-
transition: background var(--copio-transition-fast), color var(--copio-transition-fast);
|
|
1369
|
-
}
|
|
1370
|
-
|
|
1371
|
-
.copio-stage-tab[aria-selected="true"] {
|
|
1372
|
-
background: var(--copio-color-surface-elevated);
|
|
1373
|
-
color: var(--copio-color-text);
|
|
1374
|
-
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
|
|
1375
|
-
}
|
|
1376
|
-
|
|
1377
|
-
/* Touch-Safe Interactive Buttons (>=44px touch invariant) */
|
|
1378
|
-
.copio-btn {
|
|
1379
|
-
appearance: none;
|
|
1380
|
-
border: 1px solid var(--copio-color-border);
|
|
1381
|
-
background: var(--copio-color-surface-elevated);
|
|
1382
|
-
color: var(--copio-color-text);
|
|
1383
|
-
font-family: inherit;
|
|
1384
|
-
font-size: 13px;
|
|
1385
|
-
font-weight: 600;
|
|
1386
|
-
min-height: var(--copio-touch-target-min);
|
|
1387
|
-
min-width: var(--copio-touch-target-min);
|
|
1388
|
-
padding: 0 12px;
|
|
1389
|
-
border-radius: var(--copio-radius-md);
|
|
1390
|
-
display: inline-flex;
|
|
1391
|
-
align-items: center;
|
|
1392
|
-
justify-content: center;
|
|
1393
|
-
gap: 7px;
|
|
1394
|
-
cursor: pointer;
|
|
1395
|
-
transition: all var(--copio-transition-fast);
|
|
1396
|
-
white-space: nowrap;
|
|
1397
|
-
text-decoration: none;
|
|
1398
|
-
box-sizing: border-box;
|
|
1399
|
-
}
|
|
1400
|
-
|
|
1401
|
-
.copio-btn:hover {
|
|
1402
|
-
background: var(--copio-color-primary-hover);
|
|
1403
|
-
color: var(--copio-color-primary-contrast);
|
|
1404
|
-
border-color: var(--copio-color-primary);
|
|
1405
|
-
}
|
|
1406
|
-
|
|
1407
|
-
.copio-btn-primary {
|
|
1408
|
-
background: var(--copio-color-primary);
|
|
1409
|
-
color: var(--copio-color-primary-contrast);
|
|
1410
|
-
border-color: var(--copio-color-primary);
|
|
1411
|
-
}
|
|
1412
|
-
|
|
1413
|
-
.copio-btn-danger {
|
|
1414
|
-
background: rgba(239, 68, 68, 0.15);
|
|
1415
|
-
color: var(--copio-color-danger);
|
|
1416
|
-
border-color: rgba(239, 68, 68, 0.35);
|
|
1417
|
-
}
|
|
1418
|
-
|
|
1419
|
-
.copio-btn-danger:hover {
|
|
1420
|
-
background: var(--copio-color-danger);
|
|
1421
|
-
color: #fff;
|
|
1422
|
-
}
|
|
1423
|
-
|
|
1424
|
-
/* Viewfinder (Shadow Part: viewfinder) */
|
|
1425
|
-
.copio-viewfinder,
|
|
1426
|
-
.copio-viewfinder-stage {
|
|
1427
|
-
position: relative;
|
|
1428
|
-
flex: 1 1 auto;
|
|
1429
|
-
display: flex;
|
|
1430
|
-
flex-direction: column;
|
|
1431
|
-
justify-content: space-between;
|
|
1432
|
-
background: var(--copio-color-stage-bg);
|
|
1433
|
-
overflow: hidden;
|
|
1434
|
-
min-height: 0;
|
|
1435
|
-
width: 100%;
|
|
1436
|
-
}
|
|
1437
|
-
|
|
1438
|
-
.copio-viewfinder-feed,
|
|
1439
|
-
.copio-camera-feed {
|
|
1440
|
-
position: absolute;
|
|
1441
|
-
inset: 0;
|
|
1442
|
-
display: flex;
|
|
1443
|
-
align-items: center;
|
|
1444
|
-
justify-content: center;
|
|
1445
|
-
padding: 56px 20px 104px 20px;
|
|
1446
|
-
background: radial-gradient(circle at 50% 45%, #1e293b 0%, #090d14 75%);
|
|
1447
|
-
}
|
|
1448
|
-
|
|
1449
|
-
/* Framing Guide Overlay (receipt | card | a4 | auto) */
|
|
1450
|
-
.copio-framing-guide {
|
|
1451
|
-
position: relative;
|
|
1452
|
-
display: flex;
|
|
1453
|
-
align-items: center;
|
|
1454
|
-
justify-content: center;
|
|
1455
|
-
max-width: 100%;
|
|
1456
|
-
max-height: 100%;
|
|
1457
|
-
border: 1.5px dashed rgba(56, 189, 248, 0.55);
|
|
1458
|
-
border-radius: 12px;
|
|
1459
|
-
box-shadow: 0 0 0 9999px rgba(4, 7, 12, 0.52);
|
|
1460
|
-
transition: all var(--copio-transition-normal);
|
|
1461
|
-
overflow: hidden;
|
|
1462
|
-
}
|
|
1463
|
-
|
|
1464
|
-
.copio-framing-guide[data-aspect="receipt"] {
|
|
1465
|
-
aspect-ratio: 1 / 2.1;
|
|
1466
|
-
height: 100%;
|
|
1467
|
-
}
|
|
1468
|
-
|
|
1469
|
-
.copio-framing-guide[data-aspect="card"] {
|
|
1470
|
-
aspect-ratio: 1.586 / 1;
|
|
1471
|
-
width: 92%;
|
|
1472
|
-
max-height: 82%;
|
|
1473
|
-
}
|
|
1474
|
-
|
|
1475
|
-
.copio-framing-guide[data-aspect="a4"] {
|
|
1476
|
-
aspect-ratio: 1 / 1.414;
|
|
1477
|
-
height: 96%;
|
|
1478
|
-
}
|
|
1479
|
-
|
|
1480
|
-
.copio-framing-guide[data-aspect="auto"] {
|
|
1481
|
-
width: 94%;
|
|
1482
|
-
height: 94%;
|
|
1483
|
-
}
|
|
1484
|
-
|
|
1485
|
-
/* Corner Targeting Brackets */
|
|
1486
|
-
.copio-corner {
|
|
1487
|
-
position: absolute;
|
|
1488
|
-
width: 22px;
|
|
1489
|
-
height: 22px;
|
|
1490
|
-
border-color: var(--copio-color-primary);
|
|
1491
|
-
border-style: solid;
|
|
1492
|
-
border-width: 0;
|
|
1493
|
-
pointer-events: none;
|
|
1494
|
-
z-index: 2;
|
|
1495
|
-
}
|
|
1496
|
-
.copio-corner.tl { top: 6px; left: 6px; border-top-width: 3px; border-left-width: 3px; border-top-left-radius: 6px; }
|
|
1497
|
-
.copio-corner.tr { top: 6px; right: 6px; border-top-width: 3px; border-right-width: 3px; border-top-right-radius: 6px; }
|
|
1498
|
-
.copio-corner.bl { bottom: 6px; left: 6px; border-bottom-width: 3px; border-left-width: 3px; border-bottom-left-radius: 6px; }
|
|
1499
|
-
.copio-corner.br { bottom: 6px; right: 6px; border-bottom-width: 3px; border-right-width: 3px; border-bottom-right-radius: 6px; }
|
|
1500
|
-
|
|
1501
|
-
.copio-edge-quad {
|
|
1502
|
-
position: absolute;
|
|
1503
|
-
inset: 12px;
|
|
1504
|
-
border: 1px solid rgba(56, 189, 248, 0.28);
|
|
1505
|
-
border-radius: 8px;
|
|
1506
|
-
background: rgba(56, 189, 248, 0.04);
|
|
1507
|
-
pointer-events: none;
|
|
1508
|
-
z-index: 1;
|
|
1509
|
-
}
|
|
1510
|
-
|
|
1511
|
-
.copio-camera-placeholder {
|
|
1512
|
-
position: relative;
|
|
1513
|
-
z-index: 2;
|
|
1514
|
-
display: flex;
|
|
1515
|
-
flex-direction: column;
|
|
1516
|
-
align-items: center;
|
|
1517
|
-
justify-content: center;
|
|
1518
|
-
gap: 8px;
|
|
1519
|
-
padding: 16px;
|
|
1520
|
-
text-align: center;
|
|
1521
|
-
color: var(--copio-color-text-muted);
|
|
1522
|
-
font-size: 12px;
|
|
1523
|
-
font-weight: 500;
|
|
1524
|
-
}
|
|
1525
|
-
|
|
1526
|
-
.copio-status-dot {
|
|
1527
|
-
width: 7px;
|
|
1528
|
-
height: 7px;
|
|
1529
|
-
border-radius: 50%;
|
|
1530
|
-
background: var(--copio-color-primary);
|
|
1531
|
-
box-shadow: 0 0 8px var(--copio-color-primary);
|
|
1532
|
-
flex-shrink: 0;
|
|
1533
|
-
}
|
|
1534
|
-
|
|
1535
|
-
/* Top Viewfinder HUD Overlay (Step Pill + Privacy Assurance Badge) */
|
|
1536
|
-
.copio-viewfinder-hud-top {
|
|
1537
|
-
position: relative;
|
|
1538
|
-
z-index: 3;
|
|
1539
|
-
display: flex;
|
|
1540
|
-
align-items: center;
|
|
1541
|
-
justify-content: space-between;
|
|
1542
|
-
gap: 8px;
|
|
1543
|
-
padding: 10px 14px;
|
|
1544
|
-
background: linear-gradient(to bottom, rgba(7, 10, 15, 0.85), transparent);
|
|
1545
|
-
}
|
|
1546
|
-
|
|
1547
|
-
.copio-step-pill {
|
|
1548
|
-
display: inline-flex;
|
|
1549
|
-
align-items: center;
|
|
1550
|
-
gap: 6px;
|
|
1551
|
-
padding: 5px 12px;
|
|
1552
|
-
border-radius: var(--copio-radius-pill);
|
|
1553
|
-
background: rgba(15, 23, 42, 0.88);
|
|
1554
|
-
border: 1px solid rgba(56, 189, 248, 0.45);
|
|
1555
|
-
color: #f8fafc;
|
|
1556
|
-
font-size: 12px;
|
|
1557
|
-
font-weight: 600;
|
|
1558
|
-
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
|
|
1559
|
-
}
|
|
1560
|
-
|
|
1561
|
-
.copio-privacy-pill {
|
|
1562
|
-
display: inline-flex;
|
|
1563
|
-
align-items: center;
|
|
1564
|
-
gap: 5px;
|
|
1565
|
-
padding: 4px 9px;
|
|
1566
|
-
border-radius: var(--copio-radius-pill);
|
|
1567
|
-
background: rgba(22, 101, 52, 0.35);
|
|
1568
|
-
border: 1px solid rgba(34, 197, 94, 0.4);
|
|
1569
|
-
color: #86efac;
|
|
1570
|
-
font-size: 11px;
|
|
1571
|
-
font-weight: 500;
|
|
1572
|
-
}
|
|
1573
|
-
|
|
1574
|
-
/* Shutter Dock (Shadow Part: shutter-dock) */
|
|
1575
|
-
.copio-shutter-dock {
|
|
1576
|
-
position: relative;
|
|
1577
|
-
z-index: 3;
|
|
1578
|
-
display: flex;
|
|
1579
|
-
align-items: center;
|
|
1580
|
-
justify-content: space-between;
|
|
1581
|
-
gap: 12px;
|
|
1582
|
-
padding: 12px 16px;
|
|
1583
|
-
background: var(--copio-color-surface);
|
|
1584
|
-
border-top: 1px solid var(--copio-color-border);
|
|
1585
|
-
min-height: 84px;
|
|
1586
|
-
flex-shrink: 0;
|
|
1587
|
-
}
|
|
1588
|
-
|
|
1589
|
-
.copio-shutter-side {
|
|
1590
|
-
flex: 1;
|
|
1591
|
-
display: flex;
|
|
1592
|
-
align-items: center;
|
|
1593
|
-
}
|
|
1594
|
-
|
|
1595
|
-
.copio-shutter-side.right {
|
|
1596
|
-
justify-content: flex-end;
|
|
1597
|
-
}
|
|
1598
|
-
|
|
1599
|
-
.copio-shutter-btn {
|
|
1600
|
-
appearance: none;
|
|
1601
|
-
width: 64px;
|
|
1602
|
-
height: 64px;
|
|
1603
|
-
border-radius: var(--copio-radius-pill);
|
|
1604
|
-
border: 4px solid var(--copio-color-primary);
|
|
1605
|
-
background: transparent;
|
|
1606
|
-
padding: 4px;
|
|
1607
|
-
cursor: pointer;
|
|
1608
|
-
display: inline-flex;
|
|
1609
|
-
align-items: center;
|
|
1610
|
-
justify-content: center;
|
|
1611
|
-
transition: transform var(--copio-transition-fast), border-color 150ms ease;
|
|
1612
|
-
flex-shrink: 0;
|
|
1613
|
-
}
|
|
1614
|
-
|
|
1615
|
-
.copio-shutter-btn:hover {
|
|
1616
|
-
transform: scale(1.04);
|
|
1617
|
-
}
|
|
1618
|
-
|
|
1619
|
-
.copio-shutter-btn:active {
|
|
1620
|
-
transform: scale(0.94);
|
|
1621
|
-
}
|
|
1622
|
-
|
|
1623
|
-
.copio-shutter-btn-inner,
|
|
1624
|
-
.copio-shutter-inner {
|
|
1625
|
-
width: 100%;
|
|
1626
|
-
height: 100%;
|
|
1627
|
-
border-radius: var(--copio-radius-pill);
|
|
1628
|
-
background: var(--copio-color-primary);
|
|
1629
|
-
display: flex;
|
|
1630
|
-
align-items: center;
|
|
1631
|
-
justify-content: center;
|
|
1632
|
-
color: var(--copio-color-primary-contrast);
|
|
1633
|
-
transition: transform var(--copio-transition-fast);
|
|
1634
|
-
}
|
|
1635
|
-
|
|
1636
|
-
.copio-shutter-btn:active .copio-shutter-btn-inner,
|
|
1637
|
-
.copio-shutter-btn:active .copio-shutter-inner {
|
|
1638
|
-
transform: scale(0.88);
|
|
1639
|
-
}
|
|
1640
|
-
|
|
1641
|
-
/* Stacking Thumbnail Counter Pill in Viewfinder */
|
|
1642
|
-
.copio-stack-pill {
|
|
1643
|
-
display: inline-flex;
|
|
1644
|
-
align-items: center;
|
|
1645
|
-
gap: 8px;
|
|
1646
|
-
min-height: var(--copio-touch-target-min);
|
|
1647
|
-
padding: 4px 12px 4px 6px;
|
|
1648
|
-
border-radius: var(--copio-radius-md);
|
|
1649
|
-
background: var(--copio-color-surface-elevated);
|
|
1650
|
-
border: 1px solid var(--copio-color-primary);
|
|
1651
|
-
color: var(--copio-color-text);
|
|
1652
|
-
font-size: 12px;
|
|
1653
|
-
font-weight: 600;
|
|
1654
|
-
cursor: pointer;
|
|
1655
|
-
}
|
|
1656
|
-
|
|
1657
|
-
.copio-stack-thumb {
|
|
1658
|
-
width: 30px;
|
|
1659
|
-
height: 36px;
|
|
1660
|
-
border-radius: 4px;
|
|
1661
|
-
object-fit: cover;
|
|
1662
|
-
border: 1px solid rgba(255, 255, 255, 0.35);
|
|
1663
|
-
background: #000;
|
|
1664
|
-
}
|
|
1665
|
-
|
|
1666
|
-
/* Workbench & Filmstrip (Shadow Part: workbench) */
|
|
1667
|
-
.copio-workbench,
|
|
1668
|
-
.copio-workbench-stage {
|
|
1669
|
-
position: relative;
|
|
1670
|
-
flex: 1 1 auto;
|
|
1671
|
-
display: flex;
|
|
1672
|
-
flex-direction: column;
|
|
1673
|
-
background: var(--copio-color-bg);
|
|
1674
|
-
overflow: hidden;
|
|
1675
|
-
min-height: 0;
|
|
1676
|
-
width: 100%;
|
|
1677
|
-
}
|
|
1678
|
-
|
|
1679
|
-
.copio-workbench-main {
|
|
1680
|
-
flex: 1;
|
|
1681
|
-
display: flex;
|
|
1682
|
-
flex-direction: column;
|
|
1683
|
-
min-height: 0;
|
|
1684
|
-
width: 100%;
|
|
1685
|
-
overflow: hidden;
|
|
1686
|
-
}
|
|
1687
|
-
|
|
1688
|
-
.copio-stage-canvas,
|
|
1689
|
-
.copio-canvas-viewport {
|
|
1690
|
-
position: relative;
|
|
1691
|
-
flex: 1 1 auto;
|
|
1692
|
-
display: flex;
|
|
1693
|
-
flex-direction: column;
|
|
1694
|
-
align-items: center;
|
|
1695
|
-
justify-content: center;
|
|
1696
|
-
overflow: hidden;
|
|
1697
|
-
padding: 16px 20px 44px 20px;
|
|
1698
|
-
background: var(--copio-color-stage-bg);
|
|
1699
|
-
min-height: 180px;
|
|
1700
|
-
}
|
|
1701
|
-
|
|
1702
|
-
.copio-canvas-viewport.has-card-switcher {
|
|
1703
|
-
padding-top: 66px;
|
|
1704
|
-
}
|
|
1705
|
-
|
|
1706
|
-
.copio-canvas-viewport.is-cropping {
|
|
1707
|
-
padding: 74px 26px 26px 26px;
|
|
1708
|
-
}
|
|
1709
|
-
|
|
1710
|
-
/* Card Side Switcher */
|
|
1711
|
-
.copio-card-side-switcher {
|
|
1712
|
-
position: absolute;
|
|
1713
|
-
top: 8px;
|
|
1714
|
-
left: 50%;
|
|
1715
|
-
transform: translateX(-50%);
|
|
1716
|
-
z-index: 6;
|
|
1717
|
-
display: inline-flex;
|
|
1718
|
-
gap: 4px;
|
|
1719
|
-
padding: 3px;
|
|
1720
|
-
background: var(--copio-color-surface-overlay, rgba(15, 22, 32, 0.88));
|
|
1721
|
-
border: 1px solid var(--copio-color-border-strong);
|
|
1722
|
-
border-radius: var(--copio-radius-pill);
|
|
1723
|
-
backdrop-filter: blur(8px);
|
|
1724
|
-
}
|
|
1725
|
-
|
|
1726
|
-
.copio-side-pill {
|
|
1727
|
-
appearance: none;
|
|
1728
|
-
border: none;
|
|
1729
|
-
background: transparent;
|
|
1730
|
-
color: var(--copio-color-text-muted);
|
|
1731
|
-
font-family: inherit;
|
|
1732
|
-
font-size: 11px;
|
|
1733
|
-
font-weight: 600;
|
|
1734
|
-
padding: 6px 12px;
|
|
1735
|
-
min-height: var(--copio-touch-target-min);
|
|
1736
|
-
min-width: var(--copio-touch-target-min);
|
|
1737
|
-
border-radius: var(--copio-radius-pill);
|
|
1738
|
-
cursor: pointer;
|
|
1739
|
-
display: inline-flex;
|
|
1740
|
-
align-items: center;
|
|
1741
|
-
justify-content: center;
|
|
1742
|
-
}
|
|
1743
|
-
|
|
1744
|
-
.copio-side-pill[aria-selected="true"] {
|
|
1745
|
-
background: var(--copio-color-primary);
|
|
1746
|
-
color: var(--copio-color-primary-contrast);
|
|
1747
|
-
}
|
|
1748
|
-
|
|
1749
|
-
.copio-stage-figure,
|
|
1750
|
-
.copio-canvas-wrapper {
|
|
1751
|
-
position: relative;
|
|
1752
|
-
display: flex;
|
|
1753
|
-
align-items: center;
|
|
1754
|
-
justify-content: center;
|
|
1755
|
-
max-width: 100%;
|
|
1756
|
-
max-height: 100%;
|
|
1757
|
-
}
|
|
1758
|
-
|
|
1759
|
-
.copio-stage-canvas img,
|
|
1760
|
-
.copio-stage-img,
|
|
1761
|
-
.copio-stage-image {
|
|
1762
|
-
display: block;
|
|
1763
|
-
max-width: 100%;
|
|
1764
|
-
max-height: 100%;
|
|
1765
|
-
width: auto;
|
|
1766
|
-
height: auto;
|
|
1767
|
-
object-fit: contain;
|
|
1768
|
-
box-shadow: var(--copio-shadow-elevated);
|
|
1769
|
-
border-radius: var(--copio-radius-sm);
|
|
1770
|
-
user-select: none;
|
|
1771
|
-
}
|
|
1772
|
-
|
|
1773
|
-
.copio-crop-layer {
|
|
1774
|
-
position: absolute;
|
|
1775
|
-
inset: 0;
|
|
1776
|
-
width: 100%;
|
|
1777
|
-
height: 100%;
|
|
1778
|
-
overflow: hidden;
|
|
1779
|
-
z-index: 8;
|
|
1780
|
-
touch-action: none;
|
|
1781
|
-
}
|
|
1782
|
-
|
|
1783
|
-
.copio-crop-box {
|
|
1784
|
-
position: absolute;
|
|
1785
|
-
border: 2px solid var(--copio-color-primary);
|
|
1786
|
-
box-shadow: 0 0 0 9999px rgba(5, 8, 14, 0.68);
|
|
1787
|
-
cursor: move;
|
|
1788
|
-
touch-action: none;
|
|
1789
|
-
box-sizing: border-box;
|
|
1790
|
-
}
|
|
1791
|
-
|
|
1792
|
-
/* Rule-of-thirds crop grid */
|
|
1793
|
-
.copio-crop-grid {
|
|
1794
|
-
position: absolute;
|
|
1795
|
-
inset: 0;
|
|
1796
|
-
pointer-events: none;
|
|
1797
|
-
background-image:
|
|
1798
|
-
linear-gradient(to right, rgba(56, 189, 248, 0.28) 1px, transparent 1px),
|
|
1799
|
-
linear-gradient(to bottom, rgba(56, 189, 248, 0.28) 1px, transparent 1px);
|
|
1800
|
-
background-size: 33.333% 33.333%;
|
|
1801
|
-
}
|
|
1802
|
-
|
|
1803
|
-
/* 48px x 48px Touch Target Handles (exceeds 44px requirement) */
|
|
1804
|
-
.copio-crop-handle {
|
|
1805
|
-
position: absolute;
|
|
1806
|
-
width: var(--copio-crop-handle-hit);
|
|
1807
|
-
height: var(--copio-crop-handle-hit);
|
|
1808
|
-
min-width: 44px;
|
|
1809
|
-
min-height: 44px;
|
|
1810
|
-
display: flex;
|
|
1811
|
-
align-items: center;
|
|
1812
|
-
justify-content: center;
|
|
1813
|
-
z-index: 10;
|
|
1814
|
-
touch-action: none;
|
|
1815
|
-
box-sizing: border-box;
|
|
1816
|
-
}
|
|
1817
|
-
|
|
1818
|
-
.copio-crop-handle::after {
|
|
1819
|
-
content: '';
|
|
1820
|
-
width: var(--copio-crop-handle-visual);
|
|
1821
|
-
height: var(--copio-crop-handle-visual);
|
|
1822
|
-
border-radius: 50%;
|
|
1823
|
-
background: var(--copio-color-primary);
|
|
1824
|
-
border: 2.5px solid #ffffff;
|
|
1825
|
-
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
|
|
1826
|
-
transition: transform 120ms ease;
|
|
1827
|
-
box-sizing: border-box;
|
|
1828
|
-
}
|
|
1829
|
-
|
|
1830
|
-
.copio-crop-handle:hover::after,
|
|
1831
|
-
.copio-crop-handle:active::after {
|
|
1832
|
-
transform: scale(1.25);
|
|
1833
|
-
background: var(--copio-color-success, #22c55e);
|
|
1834
|
-
}
|
|
1835
|
-
|
|
1836
|
-
.copio-crop-handle.nw { top: -24px; left: -24px; cursor: nwse-resize; }
|
|
1837
|
-
.copio-crop-handle.ne { top: -24px; right: -24px; cursor: nesw-resize; }
|
|
1838
|
-
.copio-crop-handle.sw { bottom: -24px; left: -24px; cursor: nesw-resize; }
|
|
1839
|
-
.copio-crop-handle.se { bottom: -24px; right: -24px; cursor: nwse-resize; }
|
|
1840
|
-
.copio-crop-handle.n, .copio-crop-handle.edge-n { top: -24px; left: calc(50% - 24px); cursor: ns-resize; }
|
|
1841
|
-
.copio-crop-handle.s, .copio-crop-handle.edge-s { bottom: -24px; left: calc(50% - 24px); cursor: ns-resize; }
|
|
1842
|
-
.copio-crop-handle.w, .copio-crop-handle.edge-w { left: -24px; top: calc(50% - 24px); cursor: ew-resize; }
|
|
1843
|
-
.copio-crop-handle.e, .copio-crop-handle.edge-e { right: -24px; top: calc(50% - 24px); cursor: ew-resize; }
|
|
1844
|
-
|
|
1845
|
-
/* Filmstrip & Reorder Tray */
|
|
1846
|
-
.copio-filmstrip,
|
|
1847
|
-
.copio-filmstrip-bar {
|
|
1848
|
-
display: flex;
|
|
1849
|
-
align-items: center;
|
|
1850
|
-
gap: 8px;
|
|
1851
|
-
padding: 8px 12px;
|
|
1852
|
-
background: var(--copio-color-surface);
|
|
1853
|
-
border-top: 1px solid var(--copio-color-border);
|
|
1854
|
-
overflow-x: auto;
|
|
1855
|
-
min-height: 80px;
|
|
1856
|
-
flex-shrink: 0;
|
|
1857
|
-
scrollbar-width: thin;
|
|
1858
|
-
}
|
|
1859
|
-
|
|
1860
|
-
.copio-filmstrip-scroll {
|
|
1861
|
-
display: flex;
|
|
1862
|
-
align-items: center;
|
|
1863
|
-
gap: 8px;
|
|
1864
|
-
}
|
|
1865
|
-
|
|
1866
|
-
.copio-filmstrip-item {
|
|
1867
|
-
display: flex;
|
|
1868
|
-
flex-direction: column;
|
|
1869
|
-
align-items: center;
|
|
1870
|
-
gap: 4px;
|
|
1871
|
-
flex-shrink: 0;
|
|
1872
|
-
}
|
|
1873
|
-
|
|
1874
|
-
.copio-thumb-container {
|
|
1875
|
-
position: relative;
|
|
1876
|
-
width: 56px;
|
|
1877
|
-
height: 70px;
|
|
1878
|
-
border-radius: var(--copio-radius-sm);
|
|
1879
|
-
overflow: hidden;
|
|
1880
|
-
background: var(--copio-color-surface-elevated, #1c2736);
|
|
1881
|
-
border: 2px solid var(--copio-color-border);
|
|
1882
|
-
cursor: pointer;
|
|
1883
|
-
transition: all var(--copio-transition-fast);
|
|
1884
|
-
display: flex;
|
|
1885
|
-
align-items: center;
|
|
1886
|
-
justify-content: center;
|
|
1887
|
-
}
|
|
1888
|
-
|
|
1889
|
-
.copio-filmstrip-item.is-active .copio-thumb-container {
|
|
1890
|
-
border-color: var(--copio-color-primary);
|
|
1891
|
-
box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.25);
|
|
1892
|
-
}
|
|
1893
|
-
|
|
1894
|
-
.copio-thumb-num {
|
|
1895
|
-
position: absolute;
|
|
1896
|
-
bottom: 3px;
|
|
1897
|
-
right: 3px;
|
|
1898
|
-
min-width: 16px;
|
|
1899
|
-
height: 16px;
|
|
1900
|
-
padding: 0 4px;
|
|
1901
|
-
border-radius: 999px;
|
|
1902
|
-
background: rgba(15, 23, 42, 0.85);
|
|
1903
|
-
color: #f8fafc;
|
|
1904
|
-
font-size: 10px;
|
|
1905
|
-
font-weight: 700;
|
|
1906
|
-
display: inline-flex;
|
|
1907
|
-
align-items: center;
|
|
1908
|
-
justify-content: center;
|
|
1909
|
-
}
|
|
1910
|
-
|
|
1911
|
-
.copio-thumb-reorder {
|
|
1912
|
-
display: flex;
|
|
1913
|
-
align-items: center;
|
|
1914
|
-
gap: 4px;
|
|
1915
|
-
}
|
|
1916
|
-
|
|
1917
|
-
.copio-reorder-btn {
|
|
1918
|
-
appearance: none;
|
|
1919
|
-
border: 1px solid var(--copio-color-border);
|
|
1920
|
-
background: var(--copio-color-surface-elevated);
|
|
1921
|
-
color: var(--copio-color-text-muted);
|
|
1922
|
-
border-radius: 4px;
|
|
1923
|
-
font-size: 9px;
|
|
1924
|
-
padding: 2px 5px;
|
|
1925
|
-
cursor: pointer;
|
|
1926
|
-
}
|
|
1927
|
-
|
|
1928
|
-
.copio-reorder-btn:disabled {
|
|
1929
|
-
opacity: 0.35;
|
|
1930
|
-
cursor: not-allowed;
|
|
1931
|
-
}
|
|
1932
|
-
|
|
1933
|
-
.copio-thumb-img {
|
|
1934
|
-
max-width: 100%;
|
|
1935
|
-
max-height: 100%;
|
|
1936
|
-
width: auto;
|
|
1937
|
-
height: auto;
|
|
1938
|
-
object-fit: contain;
|
|
1939
|
-
}
|
|
1940
|
-
|
|
1941
|
-
/* Edit Action Toolbar & Primary Completion Dock */
|
|
1942
|
-
.copio-toolbar,
|
|
1943
|
-
.copio-controls-dock {
|
|
1944
|
-
display: flex;
|
|
1945
|
-
flex-direction: column;
|
|
1946
|
-
gap: 8px;
|
|
1947
|
-
padding: 10px 12px;
|
|
1948
|
-
background: var(--copio-color-surface);
|
|
1949
|
-
border-top: 1px solid var(--copio-color-border);
|
|
1950
|
-
min-height: 56px;
|
|
1951
|
-
flex-shrink: 0;
|
|
1952
|
-
z-index: 6;
|
|
1953
|
-
}
|
|
1954
|
-
|
|
1955
|
-
.copio-edit-toolbar,
|
|
1956
|
-
.copio-toolbar-tools {
|
|
1957
|
-
display: flex;
|
|
1958
|
-
flex-wrap: wrap;
|
|
1959
|
-
align-items: center;
|
|
1960
|
-
gap: 6px;
|
|
1961
|
-
width: 100%;
|
|
1962
|
-
}
|
|
1963
|
-
|
|
1964
|
-
.copio-toolbar-tools .copio-tool-btn {
|
|
1965
|
-
flex: 1 1 56px;
|
|
1966
|
-
}
|
|
1967
|
-
|
|
1968
|
-
.copio-toolbar-actions {
|
|
1969
|
-
display: flex;
|
|
1970
|
-
align-items: center;
|
|
1971
|
-
gap: 8px;
|
|
1972
|
-
width: 100%;
|
|
1973
|
-
}
|
|
1974
|
-
|
|
1975
|
-
.copio-toolbar-actions .copio-btn-primary {
|
|
1976
|
-
width: 100%;
|
|
1977
|
-
}
|
|
1978
|
-
|
|
1979
|
-
.copio-tool-btn {
|
|
1980
|
-
appearance: none;
|
|
1981
|
-
border: 1px solid var(--copio-color-border);
|
|
1982
|
-
background: var(--copio-color-surface-elevated);
|
|
1983
|
-
color: var(--copio-color-text);
|
|
1984
|
-
font-family: inherit;
|
|
1985
|
-
font-size: 11px;
|
|
1986
|
-
font-weight: 600;
|
|
1987
|
-
min-height: var(--copio-touch-target-min);
|
|
1988
|
-
min-width: var(--copio-touch-target-min);
|
|
1989
|
-
padding: 4px 6px;
|
|
1990
|
-
border-radius: var(--copio-radius-md);
|
|
1991
|
-
display: flex;
|
|
1992
|
-
flex-direction: column;
|
|
1993
|
-
align-items: center;
|
|
1994
|
-
justify-content: center;
|
|
1995
|
-
gap: 3px;
|
|
1996
|
-
cursor: pointer;
|
|
1997
|
-
transition: all var(--copio-transition-fast);
|
|
1998
|
-
}
|
|
1999
|
-
|
|
2000
|
-
.copio-tool-btn:hover:not(:disabled) {
|
|
2001
|
-
border-color: var(--copio-color-border-strong);
|
|
2002
|
-
background: rgba(255, 255, 255, 0.06);
|
|
2003
|
-
}
|
|
2004
|
-
|
|
2005
|
-
.copio-tool-btn[aria-pressed="true"] {
|
|
2006
|
-
background: rgba(56, 189, 248, 0.16);
|
|
2007
|
-
color: var(--copio-color-primary);
|
|
2008
|
-
border-color: var(--copio-color-primary);
|
|
2009
|
-
}
|
|
2010
|
-
|
|
2011
|
-
.copio-tool-btn.danger {
|
|
2012
|
-
color: #fca5a5;
|
|
2013
|
-
}
|
|
2014
|
-
|
|
2015
|
-
.copio-tool-btn.danger:hover:not(:disabled) {
|
|
2016
|
-
background: rgba(239, 68, 68, 0.16);
|
|
2017
|
-
border-color: rgba(239, 68, 68, 0.45);
|
|
2018
|
-
}
|
|
2019
|
-
|
|
2020
|
-
.copio-toast-region {
|
|
2021
|
-
position: absolute;
|
|
2022
|
-
bottom: 124px;
|
|
2023
|
-
left: 12px;
|
|
2024
|
-
right: 12px;
|
|
2025
|
-
z-index: 30;
|
|
2026
|
-
display: flex;
|
|
2027
|
-
flex-direction: column;
|
|
2028
|
-
gap: 8px;
|
|
2029
|
-
pointer-events: none;
|
|
2030
|
-
}
|
|
2031
|
-
|
|
2032
|
-
.copio-toast {
|
|
2033
|
-
pointer-events: auto;
|
|
2034
|
-
display: flex;
|
|
2035
|
-
align-items: center;
|
|
2036
|
-
justify-content: space-between;
|
|
2037
|
-
gap: 10px;
|
|
2038
|
-
padding: 8px 12px;
|
|
2039
|
-
border-radius: var(--copio-radius-md);
|
|
2040
|
-
background: #0f172a;
|
|
2041
|
-
color: #f8fafc;
|
|
2042
|
-
border: 1px solid var(--copio-color-primary);
|
|
2043
|
-
box-shadow: var(--copio-shadow-elevated);
|
|
2044
|
-
font-size: 12px;
|
|
2045
|
-
font-weight: 500;
|
|
2046
|
-
position: relative;
|
|
2047
|
-
overflow: hidden;
|
|
2048
|
-
}
|
|
2049
|
-
|
|
2050
|
-
.copio-toast-progress {
|
|
2051
|
-
position: absolute;
|
|
2052
|
-
bottom: 0;
|
|
2053
|
-
left: 0;
|
|
2054
|
-
height: 3px;
|
|
2055
|
-
background: var(--copio-color-primary);
|
|
2056
|
-
transition: width 100ms linear;
|
|
2057
|
-
}
|
|
2058
|
-
|
|
2059
|
-
.copio-toast-undo-btn,
|
|
2060
|
-
.copio-btn-toast-undo {
|
|
2061
|
-
appearance: none;
|
|
2062
|
-
border: 1px solid rgba(56, 189, 248, 0.45);
|
|
2063
|
-
background: rgba(56, 189, 248, 0.16);
|
|
2064
|
-
color: #38bdf8;
|
|
2065
|
-
font-family: inherit;
|
|
2066
|
-
font-size: 12px;
|
|
2067
|
-
font-weight: 700;
|
|
2068
|
-
min-height: var(--copio-touch-target-min);
|
|
2069
|
-
min-width: var(--copio-touch-target-min);
|
|
2070
|
-
padding: 0 12px;
|
|
2071
|
-
border-radius: var(--copio-radius-sm);
|
|
2072
|
-
cursor: pointer;
|
|
2073
|
-
flex-shrink: 0;
|
|
2074
|
-
}
|
|
2075
|
-
|
|
2076
|
-
.copio-ocr-content {
|
|
2077
|
-
display: flex;
|
|
2078
|
-
flex-direction: column;
|
|
2079
|
-
gap: 8px;
|
|
2080
|
-
}
|
|
2081
|
-
|
|
2082
|
-
.copio-ocr-text {
|
|
2083
|
-
margin: 0;
|
|
2084
|
-
padding: 10px;
|
|
2085
|
-
max-height: 180px;
|
|
2086
|
-
overflow: auto;
|
|
2087
|
-
background: var(--copio-color-bg);
|
|
2088
|
-
color: var(--copio-color-text);
|
|
2089
|
-
border: 1px solid var(--copio-color-border);
|
|
2090
|
-
border-radius: var(--copio-radius-sm);
|
|
2091
|
-
font-family: var(--copio-font-mono);
|
|
2092
|
-
font-size: 11px;
|
|
2093
|
-
line-height: 1.5;
|
|
2094
|
-
white-space: pre-wrap;
|
|
2095
|
-
}
|
|
2096
|
-
|
|
2097
|
-
.copio-ocr-meta {
|
|
2098
|
-
font-size: 11px;
|
|
2099
|
-
color: var(--copio-color-text-muted);
|
|
2100
|
-
}
|
|
2101
|
-
|
|
2102
|
-
/* Slide-up OCR Extraction Sheet */
|
|
2103
|
-
.copio-ocr-sheet {
|
|
2104
|
-
position: absolute;
|
|
2105
|
-
inset: auto 0 0 0;
|
|
2106
|
-
max-height: 78%;
|
|
2107
|
-
background: var(--copio-color-surface);
|
|
2108
|
-
border-top: 1px solid var(--copio-color-primary);
|
|
2109
|
-
border-radius: 16px 16px 0 0;
|
|
2110
|
-
box-shadow: 0 -16px 40px rgba(0, 0, 0, 0.65);
|
|
2111
|
-
z-index: 25;
|
|
2112
|
-
display: flex;
|
|
2113
|
-
flex-direction: column;
|
|
2114
|
-
padding: 14px;
|
|
2115
|
-
gap: 10px;
|
|
2116
|
-
}
|
|
2117
|
-
|
|
2118
|
-
.copio-ocr-header {
|
|
2119
|
-
display: flex;
|
|
2120
|
-
align-items: center;
|
|
2121
|
-
justify-content: space-between;
|
|
2122
|
-
gap: 8px;
|
|
2123
|
-
}
|
|
2124
|
-
|
|
2125
|
-
.copio-ocr-textarea {
|
|
2126
|
-
width: 100%;
|
|
2127
|
-
min-height: 130px;
|
|
2128
|
-
flex: 1;
|
|
2129
|
-
resize: none;
|
|
2130
|
-
background: var(--copio-color-bg);
|
|
2131
|
-
color: var(--copio-color-text);
|
|
2132
|
-
border: 1px solid var(--copio-color-border);
|
|
2133
|
-
border-radius: var(--copio-radius-sm);
|
|
2134
|
-
padding: 10px;
|
|
2135
|
-
font-family: var(--copio-font-mono);
|
|
2136
|
-
font-size: 11px;
|
|
2137
|
-
line-height: 1.5;
|
|
2138
|
-
}
|
|
2139
|
-
|
|
2140
|
-
/* Container-Scoped Toast Stack */
|
|
2141
|
-
.sl-toast-stack,
|
|
2142
|
-
.copio-toast-stack-scoped {
|
|
2143
|
-
position: absolute !important;
|
|
2144
|
-
top: auto !important;
|
|
2145
|
-
bottom: 0 !important;
|
|
2146
|
-
left: 0 !important;
|
|
2147
|
-
right: 0 !important;
|
|
2148
|
-
width: 100% !important;
|
|
2149
|
-
max-width: 100% !important;
|
|
2150
|
-
padding: var(--copio-spacing-md) !important;
|
|
2151
|
-
box-sizing: border-box !important;
|
|
2152
|
-
z-index: 1000 !important;
|
|
2153
|
-
pointer-events: none;
|
|
2154
|
-
}
|
|
2155
|
-
|
|
2156
|
-
.sl-toast-stack sl-alert,
|
|
2157
|
-
.copio-toast-stack-scoped sl-alert {
|
|
2158
|
-
pointer-events: auto;
|
|
2159
|
-
margin-top: var(--copio-spacing-sm);
|
|
2160
|
-
}
|
|
2161
|
-
|
|
2162
|
-
/* ==========================================================================
|
|
2163
|
-
4. @container BREAKPOINTS (Strictly Container Queries)
|
|
2164
|
-
========================================================================== */
|
|
2165
|
-
|
|
2166
|
-
@container copio-scanner (max-width: 400px) {
|
|
2167
|
-
.copio-header {
|
|
2168
|
-
padding: 6px 10px;
|
|
2169
|
-
min-height: 52px;
|
|
2170
|
-
}
|
|
2171
|
-
.copio-header-left {
|
|
2172
|
-
flex-direction: column;
|
|
2173
|
-
align-items: flex-start;
|
|
2174
|
-
gap: 2px;
|
|
2175
|
-
}
|
|
2176
|
-
.copio-mode-badge {
|
|
2177
|
-
font-size: 10px;
|
|
2178
|
-
padding: 2px 6px;
|
|
2179
|
-
}
|
|
2180
|
-
.copio-subtitle {
|
|
2181
|
-
display: none;
|
|
2182
|
-
}
|
|
2183
|
-
.copio-filmstrip,
|
|
2184
|
-
.copio-filmstrip-bar {
|
|
2185
|
-
gap: 6px;
|
|
2186
|
-
padding: 6px 8px;
|
|
2187
|
-
}
|
|
2188
|
-
.copio-tool-btn {
|
|
2189
|
-
font-size: 10px;
|
|
2190
|
-
padding: 3px 4px;
|
|
2191
|
-
}
|
|
2192
|
-
.copio-btn {
|
|
2193
|
-
padding: 0 8px;
|
|
2194
|
-
font-size: 12px;
|
|
2195
|
-
}
|
|
2196
|
-
}
|
|
2197
|
-
|
|
2198
|
-
@container copio-scanner (min-width: 401px) and (max-width: 767px) {
|
|
2199
|
-
.copio-header {
|
|
2200
|
-
padding: var(--copio-spacing-sm) var(--copio-spacing-md);
|
|
2201
|
-
}
|
|
2202
|
-
.copio-tool-btn {
|
|
2203
|
-
flex-direction: row;
|
|
2204
|
-
font-size: 12px;
|
|
2205
|
-
gap: 6px;
|
|
2206
|
-
}
|
|
2207
|
-
}
|
|
2208
|
-
|
|
2209
|
-
@container copio-scanner (min-width: 768px) {
|
|
2210
|
-
.copio-header {
|
|
2211
|
-
padding: var(--copio-spacing-md) var(--copio-spacing-lg);
|
|
2212
|
-
}
|
|
2213
|
-
.copio-workbench-main {
|
|
2214
|
-
flex-direction: row;
|
|
2215
|
-
}
|
|
2216
|
-
.copio-filmstrip,
|
|
2217
|
-
.copio-filmstrip-bar {
|
|
2218
|
-
order: -1;
|
|
2219
|
-
flex-direction: column;
|
|
2220
|
-
width: 168px;
|
|
2221
|
-
height: 100%;
|
|
2222
|
-
border-top: none;
|
|
2223
|
-
border-right: 1px solid var(--copio-color-border);
|
|
2224
|
-
overflow-y: auto;
|
|
2225
|
-
overflow-x: hidden;
|
|
2226
|
-
padding: 12px;
|
|
2227
|
-
}
|
|
2228
|
-
.copio-filmstrip-scroll {
|
|
2229
|
-
flex-direction: column;
|
|
2230
|
-
width: 100%;
|
|
2231
|
-
}
|
|
2232
|
-
.copio-thumb-container {
|
|
2233
|
-
width: 112px;
|
|
2234
|
-
height: 140px;
|
|
2235
|
-
}
|
|
2236
|
-
.copio-toolbar,
|
|
2237
|
-
.copio-controls-dock {
|
|
2238
|
-
flex-direction: row;
|
|
2239
|
-
align-items: center;
|
|
2240
|
-
justify-content: space-between;
|
|
2241
|
-
}
|
|
2242
|
-
.copio-toolbar-tools {
|
|
2243
|
-
width: auto;
|
|
2244
|
-
flex: 1;
|
|
2245
|
-
}
|
|
2246
|
-
.copio-toolbar-actions {
|
|
2247
|
-
width: auto;
|
|
2248
|
-
min-width: 200px;
|
|
2249
|
-
}
|
|
2250
|
-
}
|
|
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=`
|
|
2252
|
-
<div class="copio-scanner-container copio-scanner-host" part="scanner-root">
|
|
2253
|
-
<header class="copio-header" part="header">
|
|
2254
|
-
<div class="copio-header-left">
|
|
2255
|
-
<span class="copio-mode-badge" id="mode-badge">${(this.mode||"single").toUpperCase()}</span>
|
|
2256
|
-
<div class="copio-title-group">
|
|
2257
|
-
<h2 class="copio-title" id="header-title">Copio Scanner</h2>
|
|
2258
|
-
<p class="copio-subtitle" id="header-subtitle">Non-destructive mobile document scanner</p>
|
|
2259
|
-
</div>
|
|
2260
|
-
</div>
|
|
2261
|
-
<div class="copio-header-actions" part="header-actions">
|
|
2262
|
-
<div class="copio-stage-tabs" role="tablist" aria-label="Scanner Stage">
|
|
2263
|
-
<button type="button" class="copio-stage-tab" id="tab-viewfinder" role="tab" aria-selected="true">Camera</button>
|
|
2264
|
-
<button type="button" class="copio-stage-tab" id="tab-workbench" role="tab" aria-selected="false">Workbench</button>
|
|
2265
|
-
</div>
|
|
2266
|
-
<slot name="header-actions"></slot>
|
|
2267
|
-
</div>
|
|
2268
|
-
</header>
|
|
2269
|
-
|
|
2270
|
-
<!-- Viewfinder Stage -->
|
|
2271
|
-
<div class="copio-viewfinder copio-viewfinder-stage" part="viewfinder" id="viewfinder-section">
|
|
2272
|
-
<div class="copio-viewfinder-hud-top">
|
|
2273
|
-
<div class="copio-step-pill" id="step-pill">
|
|
2274
|
-
<span class="copio-status-dot"></span>
|
|
2275
|
-
<span id="step-pill-text">${e}</span>
|
|
2276
|
-
</div>
|
|
2277
|
-
<div class="copio-privacy-pill" title="100% Local On-Device Processing">
|
|
2278
|
-
<span>\u{1F512} 100% Local</span>
|
|
2279
|
-
</div>
|
|
2280
|
-
</div>
|
|
2281
|
-
|
|
2282
|
-
<div class="copio-camera-feed" id="camera-feed">
|
|
2283
|
-
<video id="camera-video" autoplay playsinline muted style="display:none; position:absolute; inset:0; width:100%; height:100%; object-fit:cover; z-index:0;"></video>
|
|
2284
|
-
<slot name="viewfinder">
|
|
2285
|
-
<div class="copio-framing-guide" id="framing-guide" data-aspect="${this.aspect}">
|
|
2286
|
-
<span class="copio-corner tl"></span>
|
|
2287
|
-
<span class="copio-corner tr"></span>
|
|
2288
|
-
<span class="copio-corner bl"></span>
|
|
2289
|
-
<span class="copio-corner br"></span>
|
|
2290
|
-
<div class="copio-edge-quad"></div>
|
|
2291
|
-
<div class="copio-camera-placeholder">
|
|
2292
|
-
<svg width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
|
|
2293
|
-
<path d="M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z"/>
|
|
2294
|
-
<circle cx="12" cy="13" r="4"/>
|
|
2295
|
-
</svg>
|
|
2296
|
-
<span>Position document within guide lines</span>
|
|
2297
|
-
</div>
|
|
2298
|
-
</div>
|
|
2299
|
-
</slot>
|
|
2300
|
-
</div>
|
|
2301
|
-
|
|
2302
|
-
<div class="copio-shutter-dock" part="shutter-dock">
|
|
2303
|
-
<div class="copio-shutter-side left">
|
|
2304
|
-
<button type="button" class="copio-btn copio-btn-secondary" id="btn-import-file" title="Import image from file">
|
|
2305
|
-
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
2306
|
-
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/>
|
|
2307
|
-
<polyline points="17 8 12 3 7 8"/>
|
|
2308
|
-
<line x1="12" y1="3" x2="12" y2="15"/>
|
|
2309
|
-
</svg>
|
|
2310
|
-
<span>Import</span>
|
|
2311
|
-
</button>
|
|
2312
|
-
</div>
|
|
2313
|
-
|
|
2314
|
-
<slot name="shutter-dock">
|
|
2315
|
-
<button type="button" class="copio-shutter-btn" id="btn-shutter" aria-label="Capture page">
|
|
2316
|
-
<span class="copio-shutter-btn-inner"></span>
|
|
2317
|
-
</button>
|
|
2318
|
-
</slot>
|
|
2319
|
-
|
|
2320
|
-
<div class="copio-shutter-side right">
|
|
2321
|
-
<button type="button" class="copio-stack-pill" id="btn-review" title="Review pages" style="display:none;">
|
|
2322
|
-
<span id="review-pill-text">Review (0) \u2192</span>
|
|
2323
|
-
</button>
|
|
2324
|
-
</div>
|
|
2325
|
-
</div>
|
|
2326
|
-
</div>
|
|
2327
|
-
|
|
2328
|
-
<!-- Workbench Stage -->
|
|
2329
|
-
<div class="copio-workbench copio-workbench-stage" part="workbench" id="workbench-section" style="display: none;">
|
|
2330
|
-
<div class="copio-workbench-main">
|
|
2331
|
-
<div class="copio-canvas-viewport" id="canvas-viewport">
|
|
2332
|
-
<div class="copio-card-side-switcher" id="card-side-switcher" style="display:none;" role="tablist" aria-label="Card side switcher">
|
|
2333
|
-
<button type="button" role="tab" class="copio-side-pill active" id="btn-card-front" aria-selected="true">1. Front Side</button>
|
|
2334
|
-
<button type="button" role="tab" class="copio-side-pill" id="btn-card-back" aria-selected="false">2. Back Side</button>
|
|
2335
|
-
</div>
|
|
2336
|
-
|
|
2337
|
-
<div class="copio-canvas-wrapper" id="canvas-wrapper">
|
|
2338
|
-
<img id="stage-img" class="copio-stage-image" alt="Active document page" />
|
|
2339
|
-
</div>
|
|
2340
|
-
</div>
|
|
2341
|
-
|
|
2342
|
-
<!-- Filmstrip Tray -->
|
|
2343
|
-
<div class="copio-filmstrip" id="filmstrip-tray" part="filmstrip">
|
|
2344
|
-
<div class="copio-filmstrip-scroll" id="filmstrip-scroll">
|
|
2345
|
-
<slot name="filmstrip"></slot>
|
|
2346
|
-
</div>
|
|
2347
|
-
</div>
|
|
2348
|
-
</div>
|
|
2349
|
-
|
|
2350
|
-
<!-- Bottom Action Toolbar -->
|
|
2351
|
-
<footer class="copio-toolbar" part="toolbar" id="workbench-toolbar">
|
|
2352
|
-
<div class="copio-toolbar-tools">
|
|
2353
|
-
<button type="button" class="copio-tool-btn" id="btn-retake" title="Retake page">
|
|
2354
|
-
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
2355
|
-
<path d="M23 4v6h-6M1 20v-6h6"/>
|
|
2356
|
-
<path d="M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"/>
|
|
2357
|
-
</svg>
|
|
2358
|
-
<span>Retake</span>
|
|
2359
|
-
</button>
|
|
2360
|
-
|
|
2361
|
-
<button type="button" class="copio-tool-btn" id="btn-crop" title="Adjust crop">
|
|
2362
|
-
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
2363
|
-
<path d="M6 2v14a2 2 0 0 0 2 2h14"/>
|
|
2364
|
-
<path d="M18 22V8a2 2 0 0 0-2-2H2"/>
|
|
2365
|
-
</svg>
|
|
2366
|
-
<span id="crop-btn-label">Crop</span>
|
|
2367
|
-
</button>
|
|
2368
|
-
|
|
2369
|
-
<button type="button" class="copio-tool-btn" id="btn-rotate" title="Rotate 90\xB0">
|
|
2370
|
-
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
2371
|
-
<path d="M21.5 2v6h-6M21.34 15.57a10 10 0 1 1-.57-8.38l5.67-5.67"/>
|
|
2372
|
-
</svg>
|
|
2373
|
-
<span>Rotate</span>
|
|
2374
|
-
</button>
|
|
2375
|
-
|
|
2376
|
-
<button type="button" class="copio-tool-btn" id="btn-filter-bw" title="Toggle B&W filter">
|
|
2377
|
-
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
2378
|
-
<circle cx="12" cy="12" r="10"/>
|
|
2379
|
-
<path d="M12 2a10 10 0 0 1 0 20z" fill="currentColor"/>
|
|
2380
|
-
</svg>
|
|
2381
|
-
<span>B&W</span>
|
|
2382
|
-
</button>
|
|
2383
|
-
|
|
2384
|
-
<button type="button" class="copio-tool-btn" id="btn-ocr" title="Recognize text">
|
|
2385
|
-
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
2386
|
-
<path d="M4 7V4h16v3M9 20h6M12 4v16"/>
|
|
2387
|
-
</svg>
|
|
2388
|
-
<span>OCR</span>
|
|
2389
|
-
</button>
|
|
2390
|
-
|
|
2391
|
-
<button type="button" class="copio-tool-btn copio-btn-danger" id="btn-delete" title="Delete active page">
|
|
2392
|
-
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
2393
|
-
<polyline points="3 6 5 6 21 6"/>
|
|
2394
|
-
<path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/>
|
|
2395
|
-
</svg>
|
|
2396
|
-
<span>Delete</span>
|
|
2397
|
-
</button>
|
|
2398
|
-
</div>
|
|
2399
|
-
|
|
2400
|
-
<div class="copio-toolbar-actions">
|
|
2401
|
-
<slot name="toolbar">
|
|
2402
|
-
<button type="button" class="copio-btn copio-btn-primary" id="btn-primary-complete">
|
|
2403
|
-
\u2713 Use Photo
|
|
2404
|
-
</button>
|
|
2405
|
-
</slot>
|
|
2406
|
-
</div>
|
|
2407
|
-
</footer>
|
|
2408
|
-
|
|
2409
|
-
<!-- Scoped OCR Slide-out / Bottom Sheet -->
|
|
2410
|
-
<div class="copio-ocr-sheet" id="ocr-sheet" style="display:none;" part="ocr-sheet">
|
|
2411
|
-
<div class="copio-ocr-header">
|
|
2412
|
-
<strong class="copio-ocr-title">Text Recognition (OCR)</strong>
|
|
2413
|
-
<button type="button" class="copio-btn copio-btn-secondary" id="btn-close-ocr">\u2715</button>
|
|
2414
|
-
</div>
|
|
2415
|
-
<div class="copio-ocr-body" id="ocr-body">
|
|
2416
|
-
<p class="copio-ocr-placeholder">Select text or extract full page data...</p>
|
|
2417
|
-
</div>
|
|
2418
|
-
</div>
|
|
2419
|
-
|
|
2420
|
-
<!-- Container-scoped Toast Region (5s undo) -->
|
|
2421
|
-
<div class="copio-toast-region" id="toast-region" aria-live="polite"></div>
|
|
2422
|
-
</div>
|
|
2423
|
-
|
|
2424
|
-
<!-- Hidden input for file picker fallback -->
|
|
2425
|
-
<input type="file" id="internal-file-input" accept="image/*" style="display: none;" />
|
|
2426
|
-
<slot></slot>
|
|
2427
|
-
</div>
|
|
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=`
|
|
2429
|
-
<div class="copio-crop-box" id="crop-box">
|
|
2430
|
-
<div class="copio-crop-grid"></div>
|
|
2431
|
-
<span class="copio-crop-handle nw" data-handle="nw"></span>
|
|
2432
|
-
<span class="copio-crop-handle ne" data-handle="ne"></span>
|
|
2433
|
-
<span class="copio-crop-handle se" data-handle="se"></span>
|
|
2434
|
-
<span class="copio-crop-handle sw" data-handle="sw"></span>
|
|
2435
|
-
<span class="copio-crop-handle n edge-n" data-handle="n"></span>
|
|
2436
|
-
<span class="copio-crop-handle e edge-e" data-handle="e"></span>
|
|
2437
|
-
<span class="copio-crop-handle s edge-s" data-handle="s"></span>
|
|
2438
|
-
<span class="copio-crop-handle w edge-w" data-handle="w"></span>
|
|
2439
|
-
</div>
|
|
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=`
|
|
2441
|
-
<div class="copio-thumb-container">
|
|
2442
|
-
<img src="${r.src||r.originalSrc}" alt="Page ${a+1}" class="copio-thumb-img" />
|
|
2443
|
-
<span class="copio-thumb-num">${a+1}</span>
|
|
2444
|
-
</div>
|
|
2445
|
-
${this.mode==="batch"?`
|
|
2446
|
-
<div class="copio-thumb-reorder">
|
|
2447
|
-
<button type="button" class="copio-reorder-btn move-left" title="Move Left" ${a===0?"disabled":""}>\u25C0</button>
|
|
2448
|
-
<button type="button" class="copio-reorder-btn move-right" title="Move Right" ${a===e.length-1?"disabled":""}>\u25B6</button>
|
|
2449
|
-
</div>
|
|
2450
|
-
`:""}
|
|
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=`
|
|
2452
|
-
<div class="copio-toast copio-toast-undo">
|
|
2453
|
-
<span>Page deleted</span>
|
|
2454
|
-
<button type="button" class="copio-btn-toast-undo" id="btn-toast-undo">
|
|
2455
|
-
Undo (${this.#m}s)
|
|
2456
|
-
</button>
|
|
2457
|
-
</div>
|
|
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=`
|
|
2459
|
-
<div class="copio-ocr-content">
|
|
2460
|
-
<pre class="copio-ocr-text">${n.text||"No text detected."}</pre>
|
|
2461
|
-
<div class="copio-ocr-meta">
|
|
2462
|
-
<span>Confidence: ${s}%</span>
|
|
2463
|
-
</div>
|
|
2464
|
-
</div>
|
|
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};
|
|
2466
|
-
/**!
|
|
2467
|
-
* Sortable 1.15.6
|
|
2468
|
-
* @author RubaXa <trash@rubaxa.org>
|
|
2469
|
-
* @author owenm <owen23355@gmail.com>
|
|
2470
|
-
* @license MIT
|
|
2471
|
-
*/
|
|
2472
|
-
//# sourceMappingURL=chunk-4XWSVHFW.js.map
|